diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 5c9d8574d5..417f0f5aa5 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -1,34 +1,15 @@
-name: Publish plugin
+# .github/workflows/publish.yml
+name: Publish to pub.dev
on:
- release:
- types: [published]
+ push:
+ tags:
+ - 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Install Flutter
- uses: subosito/flutter-action@v2
- with:
- channel: 'stable'
- - name: Install project dependencies
- run: flutter pub get
- - name: Dart Format Check
- run: dart format lib/ test/ --set-exit-if-changed
- - name: Import Sorter Check
- run: flutter pub run import_sorter:main --no-comments --exit-if-changed
- - name: Dart Analyze Check
- run: flutter analyze
- - name: Dart Test Check
- run: flutter test
- #- name: Check Publish Warnings
- # run: dart pub publish --dry-run
- - name: Publish
- uses: k-paxian/dart-package-publisher@v1.5.1
- with:
- credentialJson: ${{ secrets.CREDENTIAL_JSON }}
- flutter: true
- skipTests: true
- force: true
+ publish:
+ permissions:
+ id-token: write # Required for authentication using OIDC
+ uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
+ # with:
+ # working-directory: path/to/package/within/repository
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35cfc9a872..6120e9fb8c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,57 @@
+
# Changelog
---------------------------------------------
+[0.14.1] - 2025-05-22
+
+* [Android] fix: Recording bug (#1839)
+* [Android] fix: calls in terminated mode by disabling orientation manager (#1840)
+* [Android] fix: Wait for audio and video thread to fully stop to avoid corrupted recordings (#1836)
+
+[0.14.0] - 2025-05-06
+
+* [iOS/Android]feat: Media Recorder implementation Android and iOS (#1810)
+* [Wndows] fix: Pickup registrar for plugin by plugin registrar manager (#1752)
+* [Linux] fix: add task runner for linux. (#1821)
+* [iOS/macOS] fix: Fix deadlock when creating a frame cryptor on iOS/macOS.
+
+[0.13.1+hotfix.1] - 2025-04-07
+
+* [Android] fix: Fix `clearAndroidCommunicationDevice` call blocking.
+
+[0.13.1] - 2025-04-03
+
+* [Android] fix: remove setPreferredInputDevice when getUserAduio. (#1808)
+* [Web] fix: race condition in RTCVideoRenderer for Web (#1805)
+* [Android] fix: Migrate from onSurfaceDestroyed to onSurfaceCleanup for SurfaceProducer.Callback. (#1806)
+
+[0.13.0] - 2025-03-24
+
+* [All] feat: add getBufferedAmount for DataChannel. (#1796)
+* [Windows] fix: fixed non-platform thread call error. (#1795)
+
+[0.12.12+hotfix.1] - 2025-03-12
+
+* [Android] fix: fixed video not rendered after resume from background.
+
+[0.12.12] - 2025-03-09
+
+* [Android] feat: Migrate to the new Surface API. (#1726)
+* [Chore] chore: fix sponsors logo and links.
+
+[0.12.11] - 2025-02-23
+
+* [web] bump version for dart_webrtc.
+* [web] fix: compile error for web with --wasm.
+
+[0.12.10] - 2025-02-18
+
+* [web] bump version for dart_webrtc.
+* [web] fix: compile error for web with --wasm.
+
+[0.12.9] - 2025-02-13
+
+* [iOS] feat: Add option to start capture without broadcast picker (#1764)
+
[0.12.8] - 2025-02-07
* [Dart] feat: expose rtc video value (#1754)
diff --git a/README.md b/README.md
index eeb8d8c255..2715e5a31c 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ WebRTC plugin for Flutter Mobile/Desktop/Web
Sponsored with 💖   by
-
+
Enterprise Grade APIs for Feeds, Chat, & Video. Try the Flutter Video tutorial 💬
@@ -17,10 +17,10 @@ Enterprise Grade APIs for Feeds, Chat, & Video.
-
+
- LiveKit - Open source WebRTC infrastructure
+ LiveKit - Open source WebRTC and realtime AI infrastructure
## Functionality
@@ -38,8 +38,8 @@ Enterprise Grade APIs for Feeds, Chat, & Video. {
- plugin.stopListening();
- return false;
- });
- }
-
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
startListening(binding.getApplicationContext(), binding.getBinaryMessenger(),
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java
index b72236600f..0b0998f384 100755
--- a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java
@@ -4,6 +4,7 @@
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
+import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@@ -13,12 +14,14 @@
import android.media.AudioDeviceInfo;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
+import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.os.ParcelFileDescriptor;
import android.os.ResultReceiver;
import android.provider.MediaStore;
import android.util.Log;
@@ -69,6 +72,9 @@
import org.webrtc.audio.JavaAudioDeviceModule;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -365,17 +371,6 @@ private ConstraintsMap getUserAudio(ConstraintsMap constraints, MediaStream stre
String trackId = stateProvider.getNextTrackUUID();
PeerConnectionFactory pcFactory = stateProvider.getPeerConnectionFactory();
AudioSource audioSource = pcFactory.createAudioSource(audioConstraints);
-
- if (deviceId != null) {
- try {
- if (VERSION.SDK_INT >= VERSION_CODES.M) {
- setPreferredInputDevice(deviceId);
- }
- } catch (Exception e) {
- Log.e(TAG, "setPreferredInputDevice failed", e);
- }
- }
-
AudioTrack track = pcFactory.createAudioTrack(trackId, audioSource);
stream.addTrack(track);
@@ -974,22 +969,64 @@ void startRecordingToFile(
mediaRecorders.append(id, mediaRecorder);
}
- void stopRecording(Integer id) {
- MediaRecorderImpl mediaRecorder = mediaRecorders.get(id);
- if (mediaRecorder != null) {
- mediaRecorder.stopRecording();
- mediaRecorders.remove(id);
- File file = mediaRecorder.getRecordFile();
- if (file != null) {
- ContentValues values = new ContentValues(3);
- values.put(MediaStore.Video.Media.TITLE, file.getName());
- values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
- values.put(MediaStore.Video.Media.DATA, file.getAbsolutePath());
- applicationContext
- .getContentResolver()
- .insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);
+ void stopRecording(Integer id, String albumName) {
+ try {
+ MediaRecorderImpl mediaRecorder = mediaRecorders.get(id);
+ if (mediaRecorder != null) {
+ mediaRecorder.stopRecording();
+ mediaRecorders.remove(id);
+ File file = mediaRecorder.getRecordFile();
+ Uri collection;
+
+ if (file != null) {
+ ContentValues values = new ContentValues();
+ values.put(MediaStore.Video.Media.TITLE, file.getName());
+ values.put(MediaStore.Video.Media.DISPLAY_NAME, file.getName());
+ values.put(MediaStore.Video.Media.ALBUM, albumName);
+ values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
+ values.put(MediaStore.Video.Media.DATE_ADDED, System.currentTimeMillis() / 1000);
+ values.put(MediaStore.Video.Media.DATE_TAKEN, System.currentTimeMillis());
+
+ //Android version above 9 MediaStore uses RELATIVE_PATH
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ values.put(MediaStore.Video.Media.RELATIVE_PATH, "Movies/" + albumName);
+ values.put(MediaStore.Video.Media.IS_PENDING, 1);
+
+ collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
+ } else {
+ //Android version 9 and below MediaStore uses DATA
+ values.put(MediaStore.Video.Media.DATA, "/storage/emulated/0/Movies/" + albumName + "/" + file.getName());
+
+ collection = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
+ }
+
+ ContentResolver resolver = applicationContext.getContentResolver();
+ Uri uriSavedMedia = resolver.insert(collection, values);
+
+ assert uriSavedMedia != null;
+ ParcelFileDescriptor pfd = resolver.openFileDescriptor(uriSavedMedia, "w");
+ assert pfd != null;
+ FileOutputStream out = new FileOutputStream(pfd.getFileDescriptor());
+
+ InputStream in = new FileInputStream(file);
+
+ byte[] buf = new byte[8192];
+ int len;
+
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+
+ out.close();
+ in.close();
+ pfd.close();
+ values.clear();
+ }
}
+ } catch(Exception e){
+
}
+
}
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java
index 9c92d2371b..8444c0e66b 100644
--- a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java
@@ -14,6 +14,7 @@
import android.os.Build;
import android.util.Log;
import android.util.LongSparseArray;
+import android.view.Surface;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -481,6 +482,12 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
createDataChannel(peerConnectionId, label, new ConstraintsMap(dataChannelDict), result);
break;
}
+ case "dataChannelGetBufferedAmount": {
+ String peerConnectionId = call.argument("peerConnectionId");
+ String dataChannelId = call.argument("dataChannelId");
+ dataChannelGetBufferedAmount(peerConnectionId, dataChannelId, result);
+ break;
+ }
case "dataChannelSend": {
String peerConnectionId = call.argument("peerConnectionId");
String dataChannelId = call.argument("dataChannelId");
@@ -565,22 +572,21 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
break;
}
case "createVideoRenderer": {
- SurfaceTextureEntry entry = textures.createSurfaceTexture();
- SurfaceTexture surfaceTexture = entry.surfaceTexture();
- FlutterRTCVideoRenderer render = new FlutterRTCVideoRenderer(surfaceTexture, entry);
- renders.put(entry.id(), render);
+ TextureRegistry.SurfaceProducer producer = textures.createSurfaceProducer();
+ FlutterRTCVideoRenderer render = new FlutterRTCVideoRenderer(producer);
+ renders.put(producer.id(), render);
EventChannel eventChannel =
new EventChannel(
messenger,
- "FlutterWebRTC/Texture" + entry.id());
+ "FlutterWebRTC/Texture" + producer.id());
eventChannel.setStreamHandler(render);
render.setEventChannel(eventChannel);
- render.setId((int) entry.id());
+ render.setId((int) producer.id());
ConstraintsMap params = new ConstraintsMap();
- params.putInt("textureId", (int) entry.id());
+ params.putInt("textureId", (int) producer.id());
result.success(params.toMap());
break;
}
@@ -690,6 +696,7 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
}
case "clearAndroidCommunicationDevice": {
AudioSwitchManager.instance.clearCommunicationDevice();
+ result.success(null);
break;
}
case "setMicrophoneMute":
@@ -763,7 +770,8 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
break;
case "stopRecordToFile":
Integer recorderId = call.argument("recorderId");
- getUserMediaImpl.stopRecording(recorderId);
+ String albumName = call.argument("albumName");
+ getUserMediaImpl.stopRecording(recorderId, albumName);
result.success(null);
break;
case "captureFrame": {
@@ -2039,6 +2047,17 @@ public void dataChannelSend(String peerConnectionId, String dataChannelId, ByteB
}
}
+ public void dataChannelGetBufferedAmount(String peerConnectionId, String dataChannelId, Result result) {
+ PeerConnectionObserver pco
+ = mPeerConnectionObservers.get(peerConnectionId);
+ if (pco == null || pco.getPeerConnection() == null) {
+ Log.d(TAG, "dataChannelGetBufferedAmount() peerConnection is null");
+ resultError("dataChannelGetBufferedAmount", "peerConnection is null", result);
+ } else {
+ pco.dataChannelGetBufferedAmount(dataChannelId, result);
+ }
+ }
+
public void dataChannelClose(String peerConnectionId, String dataChannelId) {
// Forward to PeerConnectionObserver which deals with DataChannels
// because DataChannel is owned by PeerConnection.
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/OrientationAwareScreenCapturer.java b/android/src/main/java/com/cloudwebrtc/webrtc/OrientationAwareScreenCapturer.java
index 13a46c4964..7bee5d0dc2 100644
--- a/android/src/main/java/com/cloudwebrtc/webrtc/OrientationAwareScreenCapturer.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/OrientationAwareScreenCapturer.java
@@ -15,6 +15,7 @@
import android.view.WindowManager;
import android.app.Activity;
import android.hardware.display.DisplayManager;
+import android.util.DisplayMetrics;
import android.hardware.display.VirtualDisplay;
import android.media.projection.MediaProjectionManager;
import android.os.Looper;
@@ -76,9 +77,11 @@ public void onFrame(VideoFrame frame) {
}
private boolean isDeviceOrientationPortrait() {
- final int surfaceRotation = windowManager.getDefaultDisplay().getRotation();
-
- return surfaceRotation != Surface.ROTATION_90 && surfaceRotation != Surface.ROTATION_270;
+ final Display display = windowManager.getDefaultDisplay();
+ final DisplayMetrics metrics = new DisplayMetrics();
+ display.getRealMetrics(metrics);
+
+ return metrics.heightPixels > metrics.widthPixels;
}
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/PeerConnectionObserver.java b/android/src/main/java/com/cloudwebrtc/webrtc/PeerConnectionObserver.java
index a4e8736268..9c36dce354 100755
--- a/android/src/main/java/com/cloudwebrtc/webrtc/PeerConnectionObserver.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/PeerConnectionObserver.java
@@ -168,6 +168,18 @@ void dataChannelSend(String dataChannelId, ByteBuffer byteBuffer, Boolean isBina
}
}
+ void dataChannelGetBufferedAmount(String dataChannelId, Result result) {
+ DataChannel dataChannel = dataChannels.get(dataChannelId);
+ if (dataChannel != null) {
+ ConstraintsMap params = new ConstraintsMap();
+ params.putLong("bufferedAmount", dataChannel.bufferedAmount());
+ result.success(params.toMap());
+ } else {
+ Log.d(TAG, "dataChannelGetBufferedAmount() dataChannel is null");
+ resultError("dataChannelGetBufferedAmount", "DataChannel is null", result);
+ }
+ }
+
RtpTransceiver getRtpTransceiverById(String id) {
RtpTransceiver transceiver = transceivers.get(id);
if (null == transceiver) {
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/SurfaceTextureRenderer.java b/android/src/main/java/com/cloudwebrtc/webrtc/SurfaceTextureRenderer.java
index d4b7edbddd..faa783a351 100755
--- a/android/src/main/java/com/cloudwebrtc/webrtc/SurfaceTextureRenderer.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/SurfaceTextureRenderer.java
@@ -1,6 +1,7 @@
package com.cloudwebrtc.webrtc;
import android.graphics.SurfaceTexture;
+import android.view.Surface;
import org.webrtc.EglBase;
import org.webrtc.EglRenderer;
@@ -11,6 +12,8 @@
import java.util.concurrent.CountDownLatch;
+import io.flutter.view.TextureRegistry;
+
/**
* Display the video stream on a Surface.
* renderFrame() is asynchronous to avoid blocking the calling thread.
@@ -95,19 +98,35 @@ public void pauseVideo() {
// VideoSink interface.
@Override
public void onFrame(VideoFrame frame) {
- if(!isFirstFrameRendered) {
- texture.setDefaultBufferSize(frame.getRotatedWidth(), frame.getRotatedHeight());
- createEglSurface(texture);
+ if(surface == null) {
+ producer.setSize(frame.getRotatedWidth(),frame.getRotatedHeight());
+ surface = producer.getSurface();
+ createEglSurface(surface);
}
updateFrameDimensionsAndReportEvents(frame);
super.onFrame(frame);
}
- private SurfaceTexture texture;
+ private Surface surface = null;
+
+ private TextureRegistry.SurfaceProducer producer;
- public void surfaceCreated(final SurfaceTexture texture) {
+ public void surfaceCreated(final TextureRegistry.SurfaceProducer producer) {
ThreadUtils.checkIsOnMainThread();
- this.texture = texture;
+ this.producer = producer;
+ this.producer.setCallback(
+ new TextureRegistry.SurfaceProducer.Callback() {
+ @Override
+ public void onSurfaceAvailable() {
+ // Do surface initialization here, and draw the current frame.
+ }
+
+ @Override
+ public void onSurfaceCleanup() {
+ surfaceDestroyed();
+ }
+ }
+ );
}
public void surfaceDestroyed() {
@@ -115,6 +134,7 @@ public void surfaceDestroyed() {
final CountDownLatch completionLatch = new CountDownLatch(1);
releaseEglSurface(completionLatch::countDown);
ThreadUtils.awaitUninterruptibly(completionLatch);
+ surface = null;
}
// Update frame dimensions and report any changes to |rendererEvents|.
@@ -138,7 +158,7 @@ private void updateFrameDimensionsAndReportEvents(VideoFrame frame) {
}
rotatedFrameWidth = frame.getRotatedWidth();
rotatedFrameHeight = frame.getRotatedHeight();
- texture.setDefaultBufferSize(rotatedFrameWidth, rotatedFrameHeight);
+ producer.setSize(rotatedFrameWidth, rotatedFrameHeight);
frameRotation = frame.getRotation();
}
}
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java
index f2a0de795c..030c36bf16 100644
--- a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java
@@ -1,3 +1,5 @@
+// Modifications by Signify, Copyright 2025, Signify Holding - SPDX-License-Identifier: MIT
+
package com.cloudwebrtc.webrtc.record;
import android.media.MediaCodec;
@@ -19,6 +21,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.concurrent.CountDownLatch;
class VideoFileRenderer implements VideoSink, SamplesReadyCallback {
private static final String TAG = "VideoFileRenderer";
@@ -127,27 +130,50 @@ private void renderFrameOnRenderThread(VideoFrame frame) {
/**
* Release all resources. All already posted frames will be rendered first.
*/
+ // Start Signify modification
void release() {
isRunning = false;
- if (audioThreadHandler != null)
+ CountDownLatch latch = new CountDownLatch(audioThreadHandler != null ? 2 : 1);
+ if (audioThreadHandler != null) {
audioThreadHandler.post(() -> {
- if (audioEncoder != null) {
- audioEncoder.stop();
- audioEncoder.release();
+ try{
+ if (audioEncoder != null) {
+ audioEncoder.stop();
+ audioEncoder.release();
+ }
+ audioThread.quit();
+ } finally {
+ latch.countDown();
}
- audioThread.quit();
});
+ }
+
renderThreadHandler.post(() -> {
- if (encoder != null) {
- encoder.stop();
- encoder.release();
+ try {
+ if (encoder != null) {
+ encoder.stop();
+ encoder.release();
+ }
+ eglBase.release();
+ if (muxerStarted) {
+ mediaMuxer.stop();
+ mediaMuxer.release();
+ muxerStarted = false;
+ }
+ renderThread.quit();
+ } finally {
+ latch.countDown();
}
- eglBase.release();
- mediaMuxer.stop();
- mediaMuxer.release();
- renderThread.quit();
});
+
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Release interrupted", e);
+ Thread.currentThread().interrupt();
+ }
}
+ // End Signify modification
private boolean encoderStarted = false;
private volatile boolean muxerStarted = false;
@@ -174,7 +200,7 @@ private void drainEncoder() {
Log.e(TAG, "encoder output format changed: " + newFormat);
trackIndex = mediaMuxer.addTrack(newFormat);
- if (audioTrackIndex != -1 && !muxerStarted) {
+ if (trackIndex != -1 && !muxerStarted) {
mediaMuxer.start();
muxerStarted = true;
}
@@ -230,7 +256,7 @@ private void drainAudio() {
Log.w(TAG, "encoder output format changed: " + newFormat);
audioTrackIndex = mediaMuxer.addTrack(newFormat);
- if (trackIndex != -1 && !muxerStarted) {
+ if (audioTrackIndex != -1 && !muxerStarted) {
mediaMuxer.start();
muxerStarted = true;
}
diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java b/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java
index 04c189eeec..12802ce1d0 100644
--- a/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java
+++ b/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java
@@ -45,7 +45,14 @@ public CameraUtils(GetUserMediaImpl getUserMediaImpl, Activity activity) {
this.getUserMediaImpl = getUserMediaImpl;
this.activity = activity;
this.deviceOrientationManager = new DeviceOrientationManager(activity, 0);
- this.deviceOrientationManager.start();
+ // commented out because you cannot register a reciever when the app is terminated
+ // because the activity is null?
+ // this causes the call to break if the app is terminated
+ // the manager seems to end up at handleOrientationChange which does not do
+ // anything at the moment so this should be ok
+
+ // TODO: get a proper fix at some point
+ // this.deviceOrientationManager.start();
}
public void setFocusMode(MethodCall call, AnyThreadResult result) {
diff --git a/assets/sponsors/stream-logo.png b/assets/sponsors/stream-logo.png
new file mode 100644
index 0000000000..671eea96df
Binary files /dev/null and b/assets/sponsors/stream-logo.png differ
diff --git a/common/cpp/include/flutter_common.h b/common/cpp/include/flutter_common.h
index f82054d68d..50e6097bf9 100644
--- a/common/cpp/include/flutter_common.h
+++ b/common/cpp/include/flutter_common.h
@@ -12,8 +12,10 @@
#include
#include
-#include
+#include
#include
+#include
+#include
typedef flutter::EncodableValue EncodableValue;
typedef flutter::EncodableMap EncodableMap;
@@ -27,6 +29,8 @@ typedef flutter::EventSink EventSink;
typedef flutter::MethodCall MethodCall;
typedef flutter::MethodResult MethodResult;
+class TaskRunner;
+
// foo.StringValue() becomes std::get(foo)
// foo.IsString() becomes std::holds_alternative(foo)
@@ -90,7 +94,8 @@ inline double findDouble(const EncodableMap& map, const std::string& key) {
return 0.0;
}
-inline std::optional maybeFindDouble(const EncodableMap& map, const std::string& key) {
+inline std::optional maybeFindDouble(const EncodableMap& map,
+ const std::string& key) {
auto it = map.find(EncodableValue(key));
if (it != map.end() && TypeIs(it->second))
return GetValue(it->second);
@@ -171,6 +176,7 @@ class EventChannelProxy {
public:
static std::unique_ptr Create(
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channelName);
virtual ~EventChannelProxy() = default;
diff --git a/common/cpp/include/flutter_data_channel.h b/common/cpp/include/flutter_data_channel.h
index ccffa511cd..1e5bfd1584 100644
--- a/common/cpp/include/flutter_data_channel.h
+++ b/common/cpp/include/flutter_data_channel.h
@@ -10,6 +10,7 @@ class FlutterRTCDataChannelObserver : public RTCDataChannelObserver {
public:
FlutterRTCDataChannelObserver(scoped_refptr data_channel,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channel_name);
virtual ~FlutterRTCDataChannelObserver();
@@ -39,6 +40,9 @@ class FlutterDataChannel {
const EncodableValue& data,
std::unique_ptr);
+ void DataChannelGetBufferedAmount(RTCDataChannel* data_channel,
+ std::unique_ptr result);
+
void DataChannelClose(RTCDataChannel* data_channel,
const std::string& data_channel_uuid,
std::unique_ptr);
diff --git a/common/cpp/include/flutter_frame_cryptor.h b/common/cpp/include/flutter_frame_cryptor.h
index 111b2f6abf..36756272f9 100644
--- a/common/cpp/include/flutter_frame_cryptor.h
+++ b/common/cpp/include/flutter_frame_cryptor.h
@@ -10,8 +10,8 @@ namespace flutter_webrtc_plugin {
class FlutterFrameCryptorObserver : public libwebrtc::RTCFrameCryptorObserver {
public:
- FlutterFrameCryptorObserver(BinaryMessenger* messenger,const std::string& channelName)
- : event_channel_(EventChannelProxy::Create(messenger, channelName)) {}
+ FlutterFrameCryptorObserver(BinaryMessenger* messenger, TaskRunner* task_runner, const std::string& channelName)
+ : event_channel_(EventChannelProxy::Create(messenger, task_runner, channelName)) {}
void OnFrameCryptionStateChanged(
const string participant_id,
libwebrtc::RTCFrameCryptionState state);
diff --git a/common/cpp/include/flutter_peerconnection.h b/common/cpp/include/flutter_peerconnection.h
index 5efd1e5a45..699823dfdc 100644
--- a/common/cpp/include/flutter_peerconnection.h
+++ b/common/cpp/include/flutter_peerconnection.h
@@ -11,6 +11,7 @@ class FlutterPeerConnectionObserver : public RTCPeerConnectionObserver {
FlutterPeerConnectionObserver(FlutterWebRTCBase* base,
scoped_refptr peerconnection,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channel_name,
std::string& peerConnectionId);
diff --git a/common/cpp/include/flutter_video_renderer.h b/common/cpp/include/flutter_video_renderer.h
index 41bec0c4de..b2454f8458 100644
--- a/common/cpp/include/flutter_video_renderer.h
+++ b/common/cpp/include/flutter_video_renderer.h
@@ -22,6 +22,7 @@ class FlutterVideoRenderer
void initialize(TextureRegistrar* registrar,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
std::unique_ptr texture,
int64_t texture_id);
diff --git a/common/cpp/include/flutter_webrtc.h b/common/cpp/include/flutter_webrtc.h
index 5886a67dff..573956b9aa 100644
--- a/common/cpp/include/flutter_webrtc.h
+++ b/common/cpp/include/flutter_webrtc.h
@@ -21,6 +21,8 @@ class FlutterWebRTCPlugin : public flutter::Plugin {
virtual BinaryMessenger* messenger() = 0;
virtual TextureRegistrar* textures() = 0;
+
+ virtual TaskRunner* task_runner() = 0;
};
class FlutterWebRTC : public FlutterWebRTCBase,
diff --git a/common/cpp/include/flutter_webrtc_base.h b/common/cpp/include/flutter_webrtc_base.h
index 9d24455df7..9edabc7680 100644
--- a/common/cpp/include/flutter_webrtc_base.h
+++ b/common/cpp/include/flutter_webrtc_base.h
@@ -43,7 +43,7 @@ class FlutterWebRTCBase {
enum ParseConstraintType { kMandatory, kOptional };
public:
- FlutterWebRTCBase(BinaryMessenger* messenger, TextureRegistrar* textures);
+ FlutterWebRTCBase(BinaryMessenger* messenger, TextureRegistrar* textures, TaskRunner* task_runner);
~FlutterWebRTCBase();
std::string GenerateUUID();
@@ -122,6 +122,7 @@ class FlutterWebRTCBase {
protected:
BinaryMessenger* messenger_;
+ TaskRunner *task_runner_;
TextureRegistrar* textures_;
std::unique_ptr event_channel_;
};
diff --git a/common/cpp/include/task_runner.h b/common/cpp/include/task_runner.h
new file mode 100644
index 0000000000..74c510c581
--- /dev/null
+++ b/common/cpp/include/task_runner.h
@@ -0,0 +1,17 @@
+// Copyright 2024 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+ #ifndef PACKAGES_FLUTTER_WEBRTC_TASK_RUNNER_H_
+ #define PACKAGES_FLUTTER_WEBRTC_TASK_RUNNER_H_
+
+ #include
+
+ using TaskClosure = std::function;
+
+ class TaskRunner {
+ public:
+ virtual void EnqueueTask(TaskClosure task) = 0;
+ virtual ~TaskRunner() = default;
+ };
+
+ #endif // PACKAGES_FLUTTER_WEBRTC_TASK_RUNNER_H_
\ No newline at end of file
diff --git a/common/cpp/src/flutter_common.cc b/common/cpp/src/flutter_common.cc
index c967f2eb12..1daa606a17 100644
--- a/common/cpp/src/flutter_common.cc
+++ b/common/cpp/src/flutter_common.cc
@@ -1,4 +1,7 @@
#include "flutter_common.h"
+#include "task_runner.h"
+
+#include
class MethodCallProxyImpl : public MethodCallProxy {
public:
@@ -66,56 +69,75 @@ std::unique_ptr MethodResultProxy::Create(
}
class EventChannelProxyImpl : public EventChannelProxy {
- public:
- EventChannelProxyImpl(BinaryMessenger* messenger,
- const std::string& channelName)
- : channel_(std::make_unique(
- messenger,
- channelName,
- &flutter::StandardMethodCodec::GetInstance())) {
- auto handler = std::make_unique<
- flutter::StreamHandlerFunctions>(
- [&](const EncodableValue* arguments,
- std::unique_ptr>&& events)
- -> std::unique_ptr> {
- sink_ = std::move(events);
- for (auto& event : event_queue_) {
- sink_->Success(event);
- }
- event_queue_.clear();
- on_listen_called_ = true;
- return nullptr;
- },
- [&](const EncodableValue* arguments)
- -> std::unique_ptr> {
- on_listen_called_ = false;
- return nullptr;
- });
-
- channel_->SetStreamHandler(std::move(handler));
- }
-
- virtual ~EventChannelProxyImpl() {}
-
- void Success(const EncodableValue& event, bool cache_event = true) override {
- if (on_listen_called_) {
+ public:
+ EventChannelProxyImpl(BinaryMessenger* messenger,
+ TaskRunner* task_runner,
+ const std::string& channelName)
+ : channel_(std::make_unique(
+ messenger,
+ channelName,
+ &flutter::StandardMethodCodec::GetInstance())),
+ task_runner_(task_runner) {
+ auto handler = std::make_unique<
+ flutter::StreamHandlerFunctions>(
+ [&](const EncodableValue* arguments,
+ std::unique_ptr>&& events)
+ -> std::unique_ptr> {
+ sink_ = std::move(events);
+ std::weak_ptr weak_sink = sink_;
+ for (auto& event : event_queue_) {
+ PostEvent(event);
+ }
+ event_queue_.clear();
+ on_listen_called_ = true;
+ return nullptr;
+ },
+ [&](const EncodableValue* arguments)
+ -> std::unique_ptr> {
+ on_listen_called_ = false;
+ return nullptr;
+ });
+
+ channel_->SetStreamHandler(std::move(handler));
+ }
+
+ virtual ~EventChannelProxyImpl() {}
+
+ void Success(const EncodableValue& event, bool cache_event = true) override {
+ if (on_listen_called_) {
+ PostEvent(event);
+ } else {
+ if (cache_event) {
+ event_queue_.push_back(event);
+ }
+ }
+ }
+
+ void PostEvent(const EncodableValue& event) {
+ if(task_runner_) {
+ std::weak_ptr weak_sink = sink_;
+ task_runner_->EnqueueTask([weak_sink, event]() {
+ auto sink = weak_sink.lock();
+ if (sink) {
+ sink->Success(event);
+ }
+ });
+ } else {
sink_->Success(event);
- } else {
- if (cache_event) {
- event_queue_.push_back(event);
- }
- }
- }
-
- private:
- std::unique_ptr channel_;
- std::unique_ptr sink_;
- std::list event_queue_;
- bool on_listen_called_ = false;
-};
+ }
+ }
+
+ private:
+ std::unique_ptr channel_;
+ std::shared_ptr> sink_;
+ std::list event_queue_;
+ bool on_listen_called_ = false;
+ TaskRunner* task_runner_;
+ };
std::unique_ptr EventChannelProxy::Create(
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channelName) {
- return std::make_unique(messenger, channelName);
-}
+ return std::make_unique(messenger, task_runner, channelName);
+}
\ No newline at end of file
diff --git a/common/cpp/src/flutter_data_channel.cc b/common/cpp/src/flutter_data_channel.cc
index f333d42a6f..37afd12b54 100644
--- a/common/cpp/src/flutter_data_channel.cc
+++ b/common/cpp/src/flutter_data_channel.cc
@@ -7,8 +7,9 @@ namespace flutter_webrtc_plugin {
FlutterRTCDataChannelObserver::FlutterRTCDataChannelObserver(
scoped_refptr data_channel,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channelName)
- : event_channel_(EventChannelProxy::Create(messenger, channelName)),
+ : event_channel_(EventChannelProxy::Create(messenger, task_runner, channelName)),
data_channel_(data_channel) {
data_channel_->RegisterObserver(this);
}
@@ -53,7 +54,7 @@ void FlutterDataChannel::CreateDataChannel(
"FlutterWebRTC/dataChannelEvent" + peerConnectionId + uuid;
std::unique_ptr observer(
- new FlutterRTCDataChannelObserver(data_channel, base_->messenger_,
+ new FlutterRTCDataChannelObserver(data_channel, base_->messenger_, base_->task_runner_,
event_channel));
base_->lock();
@@ -86,6 +87,13 @@ void FlutterDataChannel::DataChannelSend(
result->Success();
}
+void FlutterDataChannel::DataChannelGetBufferedAmount(RTCDataChannel* data_channel,
+ std::unique_ptr result) {
+ EncodableMap params;
+ params[EncodableValue("bufferedAmount")] = EncodableValue((int64_t)data_channel->buffered_amount());
+ result->Success(EncodableValue(params));
+}
+
void FlutterDataChannel::DataChannelClose(
RTCDataChannel* data_channel,
const std::string& data_channel_uuid,
diff --git a/common/cpp/src/flutter_frame_cryptor.cc b/common/cpp/src/flutter_frame_cryptor.cc
index 975f400751..a9e44e9bd6 100644
--- a/common/cpp/src/flutter_frame_cryptor.cc
+++ b/common/cpp/src/flutter_frame_cryptor.cc
@@ -166,7 +166,7 @@ void FlutterFrameCryptor::FrameCryptorFactoryCreateFrameCryptor(
keyProvider);
std::string event_channel = "FlutterWebRTC/frameCryptorEvent" + uuid;
- scoped_refptr observer(new RefCountedObject(base_->messenger_, event_channel));
+ scoped_refptr observer(new RefCountedObject(base_->messenger_, base_->task_runner_, event_channel));
frameCryptor->RegisterRTCFrameCryptorObserver(observer);
@@ -192,7 +192,7 @@ void FlutterFrameCryptor::FrameCryptorFactoryCreateFrameCryptor(
std::string event_channel = "FlutterWebRTC/frameCryptorEvent" + uuid;
- scoped_refptr observer(new RefCountedObject(base_->messenger_, event_channel));
+ scoped_refptr observer(new RefCountedObject(base_->messenger_, base_->task_runner_, event_channel));
frameCryptor->RegisterRTCFrameCryptorObserver(observer.get());
diff --git a/common/cpp/src/flutter_peerconnection.cc b/common/cpp/src/flutter_peerconnection.cc
index d77af9c5f2..691ec29f19 100644
--- a/common/cpp/src/flutter_peerconnection.cc
+++ b/common/cpp/src/flutter_peerconnection.cc
@@ -338,6 +338,7 @@ void FlutterPeerConnection::CreateRTCPeerConnection(
std::unique_ptr observer(
new FlutterPeerConnectionObserver(base_, pc, base_->messenger_,
+ base_->task_runner_,
event_channel, uuid));
base_->peerconnection_observers_[uuid] = std::move(observer);
@@ -1118,9 +1119,10 @@ FlutterPeerConnectionObserver::FlutterPeerConnectionObserver(
FlutterWebRTCBase* base,
scoped_refptr peerconnection,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
const std::string& channel_name,
std::string& peerConnectionId)
- : event_channel_(EventChannelProxy::Create(messenger, channel_name)),
+ : event_channel_(EventChannelProxy::Create(messenger, task_runner, channel_name)),
peerconnection_(peerconnection),
base_(base),
id_(peerConnectionId) {
@@ -1326,6 +1328,7 @@ void FlutterPeerConnectionObserver::OnDataChannel(
std::unique_ptr observer(
new FlutterRTCDataChannelObserver(data_channel, base_->messenger_,
+ base_->task_runner_,
event_channel));
base_->lock();
diff --git a/common/cpp/src/flutter_video_renderer.cc b/common/cpp/src/flutter_video_renderer.cc
index e7e1774a39..77c5dd12c6 100644
--- a/common/cpp/src/flutter_video_renderer.cc
+++ b/common/cpp/src/flutter_video_renderer.cc
@@ -7,6 +7,7 @@ FlutterVideoRenderer::~FlutterVideoRenderer() {}
void FlutterVideoRenderer::initialize(
TextureRegistrar* registrar,
BinaryMessenger* messenger,
+ TaskRunner* task_runner,
std::unique_ptr texture,
int64_t trxture_id) {
registrar_ = registrar;
@@ -14,7 +15,7 @@ void FlutterVideoRenderer::initialize(
texture_id_ = trxture_id;
std::string channel_name =
"FlutterWebRTC/Texture" + std::to_string(texture_id_);
- event_channel_ = EventChannelProxy::Create(messenger, channel_name);
+ event_channel_ = EventChannelProxy::Create(messenger, task_runner, channel_name);
}
const FlutterDesktopPixelBuffer* FlutterVideoRenderer::CopyPixelBuffer(
@@ -121,7 +122,7 @@ void FlutterVideoRendererManager::CreateVideoRendererTexture(
}));
auto texture_id = base_->textures_->RegisterTexture(textureVariant.get());
- texture->initialize(base_->textures_, base_->messenger_,
+ texture->initialize(base_->textures_, base_->messenger_, base_->task_runner_,
std::move(textureVariant), texture_id);
renderers_[texture_id] = texture;
EncodableMap params;
diff --git a/common/cpp/src/flutter_webrtc.cc b/common/cpp/src/flutter_webrtc.cc
index 77cddc1bd4..a402e47ed9 100644
--- a/common/cpp/src/flutter_webrtc.cc
+++ b/common/cpp/src/flutter_webrtc.cc
@@ -6,7 +6,8 @@ namespace flutter_webrtc_plugin {
FlutterWebRTC::FlutterWebRTC(FlutterWebRTCPlugin* plugin)
: FlutterWebRTCBase::FlutterWebRTCBase(plugin->messenger(),
- plugin->textures()),
+ plugin->textures(),
+ plugin->task_runner()),
FlutterVideoRendererManager::FlutterVideoRendererManager(this),
FlutterMediaStream::FlutterMediaStream(this),
FlutterPeerConnection::FlutterPeerConnection(this),
@@ -351,6 +352,29 @@ void FlutterWebRTC::HandleMethodCall(
return;
}
DataChannelSend(data_channel, type, data, std::move(result));
+ } else if (method_call.method_name().compare("dataChannelGetBufferedAmount") == 0) {
+ if (!method_call.arguments()) {
+ result->Error("Bad Arguments", "Null constraints arguments received");
+ return;
+ }
+ const EncodableMap params =
+ GetValue(*method_call.arguments());
+ const std::string peerConnectionId = findString(params, "peerConnectionId");
+ RTCPeerConnection* pc = PeerConnectionForId(peerConnectionId);
+ if (pc == nullptr) {
+ result->Error("dataChannelGetBufferedAmountFailed",
+ "dataChannelGetBufferedAmount() peerConnection is null");
+ return;
+ }
+
+ const std::string dataChannelId = findString(params, "dataChannelId");
+ RTCDataChannel* data_channel = DataChannelForId(dataChannelId);
+ if (data_channel == nullptr) {
+ result->Error("dataChannelGetBufferedAmountFailed",
+ "dataChannelGetBufferedAmount() data_channel is null");
+ return;
+ }
+ DataChannelGetBufferedAmount(data_channel, std::move(result));
} else if (method_call.method_name().compare("dataChannelClose") == 0) {
if (!method_call.arguments()) {
result->Error("Bad Arguments", "Null constraints arguments received");
diff --git a/common/cpp/src/flutter_webrtc_base.cc b/common/cpp/src/flutter_webrtc_base.cc
index 901ba384eb..a8c184ba15 100644
--- a/common/cpp/src/flutter_webrtc_base.cc
+++ b/common/cpp/src/flutter_webrtc_base.cc
@@ -8,14 +8,15 @@ namespace flutter_webrtc_plugin {
const char* kEventChannelName = "FlutterWebRTC.Event";
FlutterWebRTCBase::FlutterWebRTCBase(BinaryMessenger* messenger,
- TextureRegistrar* textures)
- : messenger_(messenger), textures_(textures) {
+ TextureRegistrar* textures,
+ TaskRunner *task_runner)
+ : messenger_(messenger), task_runner_(task_runner), textures_(textures) {
LibWebRTC::Initialize();
factory_ = LibWebRTC::CreateRTCPeerConnectionFactory();
audio_device_ = factory_->GetAudioDevice();
video_device_ = factory_->GetVideoDevice();
desktop_device_ = factory_->GetDesktopDevice();
- event_channel_ = EventChannelProxy::Create(messenger_, kEventChannelName);
+ event_channel_ = EventChannelProxy::Create(messenger_, task_runner_, kEventChannelName);
}
FlutterWebRTCBase::~FlutterWebRTCBase() {
diff --git a/common/darwin/Classes/FlutterRTCAudioSink-Interface.h b/common/darwin/Classes/FlutterRTCAudioSink-Interface.h
new file mode 100644
index 0000000000..8a0352333d
--- /dev/null
+++ b/common/darwin/Classes/FlutterRTCAudioSink-Interface.h
@@ -0,0 +1,6 @@
+void RTCAudioSinkCallback (void *object,
+ const void *audio_data,
+ int bits_per_sample,
+ int sample_rate,
+ size_t number_of_channels,
+ size_t number_of_frames);
diff --git a/common/darwin/Classes/FlutterRTCAudioSink.h b/common/darwin/Classes/FlutterRTCAudioSink.h
new file mode 100644
index 0000000000..34cf46669c
--- /dev/null
+++ b/common/darwin/Classes/FlutterRTCAudioSink.h
@@ -0,0 +1,14 @@
+#import
+#import
+#import
+
+@interface FlutterRTCAudioSink : NSObject
+
+@property (nonatomic, copy) void (^bufferCallback)(CMSampleBufferRef);
+@property (nonatomic) CMAudioFormatDescriptionRef format;
+
+- (instancetype) initWithAudioTrack:(RTCAudioTrack*)audio;
+
+- (void) close;
+
+@end
diff --git a/common/darwin/Classes/FlutterRTCAudioSink.mm b/common/darwin/Classes/FlutterRTCAudioSink.mm
new file mode 100644
index 0000000000..4fb575b398
--- /dev/null
+++ b/common/darwin/Classes/FlutterRTCAudioSink.mm
@@ -0,0 +1,67 @@
+#import
+#import "FlutterRTCAudioSink.h"
+#import "RTCAudioSource+Private.h"
+#include "media_stream_interface.h"
+#include "audio_sink_bridge.cpp"
+
+@implementation FlutterRTCAudioSink {
+ AudioSinkBridge *_bridge;
+ webrtc::AudioSourceInterface* _audioSource;
+}
+
+- (instancetype) initWithAudioTrack:(RTCAudioTrack* )audio {
+ self = [super init];
+ rtc::scoped_refptr audioSourcePtr = audio.source.nativeAudioSource;
+ _audioSource = audioSourcePtr.get();
+ _bridge = new AudioSinkBridge((void*)CFBridgingRetain(self));
+ _audioSource->AddSink(_bridge);
+ return self;
+}
+
+- (void) close {
+ _audioSource->RemoveSink(_bridge);
+ delete _bridge;
+ _bridge = nil;
+ _audioSource = nil;
+}
+
+void RTCAudioSinkCallback (void *object, const void *audio_data, int bits_per_sample, int sample_rate, size_t number_of_channels, size_t number_of_frames)
+{
+ AudioBufferList audioBufferList;
+ AudioBuffer audioBuffer;
+ audioBuffer.mData = (void*) audio_data;
+ audioBuffer.mDataByteSize = bits_per_sample / 8 * number_of_channels * number_of_frames;
+ audioBuffer.mNumberChannels = number_of_channels;
+ audioBufferList.mNumberBuffers = 1;
+ audioBufferList.mBuffers[0] = audioBuffer;
+ AudioStreamBasicDescription audioDescription;
+ audioDescription.mBytesPerFrame = bits_per_sample / 8 * number_of_channels;
+ audioDescription.mBitsPerChannel = bits_per_sample;
+ audioDescription.mBytesPerPacket = bits_per_sample / 8 * number_of_channels;
+ audioDescription.mChannelsPerFrame = number_of_channels;
+ audioDescription.mFormatID = kAudioFormatLinearPCM;
+ audioDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
+ audioDescription.mFramesPerPacket = 1;
+ audioDescription.mReserved = 0;
+ audioDescription.mSampleRate = sample_rate;
+ CMAudioFormatDescriptionRef formatDesc;
+ CMAudioFormatDescriptionCreate(kCFAllocatorDefault, &audioDescription, 0, nil, 0, nil, nil, &formatDesc);
+ CMSampleBufferRef buffer;
+ CMSampleTimingInfo timing;
+ timing.decodeTimeStamp = kCMTimeInvalid;
+ timing.presentationTimeStamp = CMTimeMake(0, sample_rate);
+ timing.duration = CMTimeMake(1, sample_rate);
+ CMSampleBufferCreate(kCFAllocatorDefault, nil, false, nil, nil, formatDesc, number_of_frames * number_of_channels, 1, &timing, 0, nil, &buffer);
+ CMSampleBufferSetDataBufferFromAudioBufferList(buffer, kCFAllocatorDefault, kCFAllocatorDefault, 0, &audioBufferList);
+ @autoreleasepool {
+ FlutterRTCAudioSink* sink = (__bridge FlutterRTCAudioSink*)(object);
+ sink.format = formatDesc;
+ if (sink.bufferCallback != nil) {
+ sink.bufferCallback(buffer);
+ } else {
+ NSLog(@"Buffer callback is nil");
+ }
+ }
+}
+
+@end
diff --git a/common/darwin/Classes/FlutterRTCDataChannel.h b/common/darwin/Classes/FlutterRTCDataChannel.h
index 96f4b5b86a..2b1d685274 100644
--- a/common/darwin/Classes/FlutterRTCDataChannel.h
+++ b/common/darwin/Classes/FlutterRTCDataChannel.h
@@ -24,4 +24,7 @@
data:(nonnull NSString*)data
type:(nonnull NSString*)type;
+- (void)dataChannelGetBufferedAmount:(nonnull NSString*)peerConnectionId
+ dataChannelId:(nonnull NSString*)dataChannelId
+ result:(nonnull FlutterResult)result;
@end
diff --git a/common/darwin/Classes/FlutterRTCDataChannel.m b/common/darwin/Classes/FlutterRTCDataChannel.m
index 03003fcca5..67e1083b2f 100644
--- a/common/darwin/Classes/FlutterRTCDataChannel.m
+++ b/common/darwin/Classes/FlutterRTCDataChannel.m
@@ -118,6 +118,21 @@ - (void)dataChannelClose:(nonnull NSString*)peerConnectionId
}
}
+- (void)dataChannelGetBufferedAmount:(nonnull NSString*)peerConnectionId
+ dataChannelId:(nonnull NSString*)dataChannelId
+ result:(nonnull FlutterResult)result {
+ RTCPeerConnection* peerConnection = self.peerConnections[peerConnectionId];
+ RTCDataChannel* dataChannel = peerConnection.dataChannels[dataChannelId];
+ if(dataChannel == NULL || dataChannel.readyState != RTCDataChannelStateOpen) {
+ result([FlutterError
+ errorWithCode:[NSString stringWithFormat:@"%@Failed", @"dataChannelGetBufferedAmount"]
+ message:[NSString stringWithFormat:@"Error: dataChannel not found or not opened!"]
+ details:nil]);
+ } else {
+ result(@{@"bufferedAmount": @(dataChannel.bufferedAmount)});
+ }
+}
+
- (void)dataChannelSend:(nonnull NSString*)peerConnectionId
dataChannelId:(nonnull NSString*)dataChannelId
data:(id)data
diff --git a/common/darwin/Classes/FlutterRTCDesktopCapturer.m b/common/darwin/Classes/FlutterRTCDesktopCapturer.m
index b719ee3e8c..fd88a8b689 100644
--- a/common/darwin/Classes/FlutterRTCDesktopCapturer.m
+++ b/common/darwin/Classes/FlutterRTCDesktopCapturer.m
@@ -28,11 +28,16 @@ - (void)getDisplayMedia:(NSDictionary*)constraints result:(FlutterResult)result
#if TARGET_OS_IPHONE
BOOL useBroadcastExtension = false;
+ BOOL presentBroadcastPicker = false;
+
id videoConstraints = constraints[@"video"];
if ([videoConstraints isKindOfClass:[NSDictionary class]]) {
// constraints.video.deviceId
useBroadcastExtension =
- [((NSDictionary*)videoConstraints)[@"deviceId"] isEqualToString:@"broadcast"];
+ [((NSDictionary*)videoConstraints)[@"deviceId"] hasPrefix:@"broadcast"];
+ presentBroadcastPicker =
+ useBroadcastExtension &&
+ ![((NSDictionary*)videoConstraints)[@"deviceId"] hasSuffix:@"-manual"];
}
id screenCapturer;
@@ -52,7 +57,7 @@ - (void)getDisplayMedia:(NSDictionary*)constraints result:(FlutterResult)result
[screenCapturer stopCaptureWithCompletionHandler:handler];
};
- if (useBroadcastExtension) {
+ if (presentBroadcastPicker) {
NSString* extension =
[[[NSBundle mainBundle] infoDictionary] valueForKey:kRTCScreenSharingExtension];
@@ -112,7 +117,7 @@ - (void)getDisplayMedia:(NSDictionary*)constraints result:(FlutterResult)result
}
RTCDesktopCapturer* desktopCapturer;
RTCDesktopSource* source = nil;
-
+
if (useDefaultScreen) {
desktopCapturer = [[RTCDesktopCapturer alloc] initWithDefaultScreen:self
captureDelegate:videoProcessingAdapter];
@@ -137,13 +142,13 @@ - (void)getDisplayMedia:(NSDictionary*)constraints result:(FlutterResult)result
handler();
};
#endif
-
+
RTCVideoTrack* videoTrack = [self.peerConnectionFactory videoTrackWithSource:videoSource
trackId:trackUUID];
[mediaStream addVideoTrack:videoTrack];
LocalVideoTrack *localVideoTrack = [[LocalVideoTrack alloc] initWithTrack:videoTrack videoProcessing:videoProcessingAdapter];
-
+
[self.localTracks setObject:localVideoTrack forKey:trackUUID];
NSMutableArray* audioTracks = [NSMutableArray array];
diff --git a/common/darwin/Classes/FlutterRTCFrameCapturer.h b/common/darwin/Classes/FlutterRTCFrameCapturer.h
index ba4c801d92..7cc0ff28c2 100644
--- a/common/darwin/Classes/FlutterRTCFrameCapturer.h
+++ b/common/darwin/Classes/FlutterRTCFrameCapturer.h
@@ -12,4 +12,6 @@
toPath:(NSString*)path
result:(FlutterResult)result;
++ (CVPixelBufferRef)convertToCVPixelBuffer:(RTCVideoFrame *) frame;
+
@end
diff --git a/common/darwin/Classes/FlutterRTCFrameCapturer.m b/common/darwin/Classes/FlutterRTCFrameCapturer.m
index baf12de1e0..fe748b1223 100644
--- a/common/darwin/Classes/FlutterRTCFrameCapturer.m
+++ b/common/darwin/Classes/FlutterRTCFrameCapturer.m
@@ -41,7 +41,7 @@ - (void)renderFrame:(nullable RTCVideoFrame*)frame {
CVPixelBufferRef pixelBufferRef;
bool shouldRelease;
if (![buffer isKindOfClass:[RTCCVPixelBuffer class]]) {
- pixelBufferRef = [self convertToCVPixelBuffer:frame];
+ pixelBufferRef = [FlutterRTCFrameCapturer convertToCVPixelBuffer:frame];
shouldRelease = true;
} else {
pixelBufferRef = ((RTCCVPixelBuffer*)buffer).pixelBuffer;
@@ -108,7 +108,7 @@ - (void)renderFrame:(nullable RTCVideoFrame*)frame {
});
}
-- (CVPixelBufferRef)convertToCVPixelBuffer:(RTCVideoFrame*)frame {
++ (CVPixelBufferRef)convertToCVPixelBuffer:(RTCVideoFrame*)frame {
id i420Buffer = [frame.buffer toI420];
CVPixelBufferRef outputPixelBuffer;
size_t w = (size_t)roundf(i420Buffer.width);
diff --git a/common/darwin/Classes/FlutterRTCMediaRecorder.h b/common/darwin/Classes/FlutterRTCMediaRecorder.h
new file mode 100644
index 0000000000..eac82e8b4d
--- /dev/null
+++ b/common/darwin/Classes/FlutterRTCMediaRecorder.h
@@ -0,0 +1,24 @@
+#if TARGET_OS_IPHONE
+#import
+#elif TARGET_OS_OSX
+#import
+#endif
+#import
+
+@import Foundation;
+@import AVFoundation;
+
+@interface FlutterRTCMediaRecorder : NSObject
+
+@property(nonatomic, strong) RTCVideoTrack* _Nullable videoTrack;
+@property(nonatomic, strong) NSURL* _Nonnull output;
+@property(nonatomic, strong) AVAssetWriter* _Nullable assetWriter;
+@property(nonatomic, strong) AVAssetWriterInput* _Nullable writerInput;
+
+- (instancetype _Nonnull)initWithVideoTrack:(RTCVideoTrack* _Nullable)video
+ audioTrack:(RTCAudioTrack* _Nullable)audio
+ outputFile:(NSURL* _Nonnull)out;
+
+- (void)stop:(_Nonnull FlutterResult)result;
+
+@end
diff --git a/common/darwin/Classes/FlutterRTCMediaRecorder.m b/common/darwin/Classes/FlutterRTCMediaRecorder.m
new file mode 100644
index 0000000000..7661aae519
--- /dev/null
+++ b/common/darwin/Classes/FlutterRTCMediaRecorder.m
@@ -0,0 +1,168 @@
+#import
+#import "FlutterRTCMediaRecorder.h"
+#import "FlutterRTCAudioSink.h"
+#import "FlutterRTCFrameCapturer.h"
+
+@import AVFoundation;
+
+@implementation FlutterRTCMediaRecorder {
+ int framesCount;
+ bool isInitialized;
+ CGSize _renderSize;
+ FlutterRTCAudioSink* _audioSink;
+ AVAssetWriterInput* _audioWriter;
+ int64_t _startTime;
+}
+
+- (instancetype)initWithVideoTrack:(RTCVideoTrack *)video audioTrack:(RTCAudioTrack *)audio outputFile:(NSURL *)out {
+ self = [super init];
+ isInitialized = false;
+ self.videoTrack = video;
+ self.output = out;
+ [video addRenderer:self];
+ framesCount = 0;
+ if (audio != nil)
+ _audioSink = [[FlutterRTCAudioSink alloc] initWithAudioTrack:audio];
+ else
+ NSLog(@"Audio track is nil");
+ _startTime = -1;
+ return self;
+}
+
+- (void)initialize:(CGSize)size {
+ _renderSize = size;
+ NSDictionary *videoSettings = @{
+ AVVideoCompressionPropertiesKey: @{AVVideoAverageBitRateKey: @(6*1024*1024)},
+ AVVideoCodecKey: AVVideoCodecTypeH264,
+ AVVideoHeightKey: @(size.height),
+ AVVideoWidthKey: @(size.width),
+ };
+ self.writerInput = [[AVAssetWriterInput alloc]
+ initWithMediaType:AVMediaTypeVideo
+ outputSettings:videoSettings];
+ self.writerInput.expectsMediaDataInRealTime = true;
+ self.writerInput.mediaTimeScale = 30;
+
+ if (_audioSink != nil) {
+ AudioChannelLayout acl;
+ bzero(&acl, sizeof(acl));
+ acl.mChannelLayoutTag = kAudioChannelLayoutTag_Mono;
+ NSDictionary* audioSettings = @{
+ AVFormatIDKey: [NSNumber numberWithInt: kAudioFormatMPEG4AAC],
+ AVNumberOfChannelsKey: @1,
+ AVSampleRateKey: @44100.0,
+ AVChannelLayoutKey: [NSData dataWithBytes:&acl length:sizeof(AudioChannelLayout)],
+ AVEncoderBitRateKey: @64000,
+ };
+ _audioWriter = [[AVAssetWriterInput alloc]
+ initWithMediaType:AVMediaTypeAudio
+ outputSettings:audioSettings
+ sourceFormatHint:_audioSink.format];
+ _audioWriter.expectsMediaDataInRealTime = true;
+ }
+
+ NSError *error;
+ self.assetWriter = [[AVAssetWriter alloc]
+ initWithURL:self.output
+ fileType:AVFileTypeMPEG4
+ error:&error];
+ if (error != nil)
+ NSLog(@"%@",[error localizedDescription]);
+ self.assetWriter.shouldOptimizeForNetworkUse = true;
+ [self.assetWriter addInput:self.writerInput];
+ if (_audioWriter != nil) {
+ [self.assetWriter addInput:_audioWriter];
+ _audioSink.bufferCallback = ^(CMSampleBufferRef buffer){
+ if (self->_audioWriter.readyForMoreMediaData) {
+ if ([self->_audioWriter appendSampleBuffer:buffer])
+ NSLog(@"Audio frame appended");
+ else
+ NSLog(@"Audioframe not appended %@", self.assetWriter.error);
+ }
+ };
+ }
+ [self.assetWriter startWriting];
+ [self.assetWriter startSessionAtSourceTime:kCMTimeZero];
+
+ isInitialized = true;
+}
+
+- (void)setSize:(CGSize)size {
+}
+
+- (void)renderFrame:(nullable RTCVideoFrame *)frame {
+ if (frame == nil) {
+ return;
+ }
+ if (!isInitialized) {
+ [self initialize:CGSizeMake((CGFloat) frame.width, (CGFloat) frame.height)];
+ }
+ if (!self.writerInput.readyForMoreMediaData) {
+ NSLog(@"Drop frame, not ready");
+ return;
+ }
+ id buffer = frame.buffer;
+ CVPixelBufferRef pixelBufferRef;
+ BOOL shouldRelease = false;
+ if ([buffer isKindOfClass:[RTCCVPixelBuffer class]]) {
+ pixelBufferRef = ((RTCCVPixelBuffer *) buffer).pixelBuffer;
+ } else {
+ pixelBufferRef = [FlutterRTCFrameCapturer convertToCVPixelBuffer:frame];
+ shouldRelease = true;
+ }
+ CMVideoFormatDescriptionRef formatDescription;
+ OSStatus status = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, pixelBufferRef, &formatDescription);
+
+ CMSampleTimingInfo timingInfo;
+
+ timingInfo.decodeTimeStamp = kCMTimeInvalid;
+ if (_startTime == -1) {
+ _startTime = frame.timeStampNs / 1000;
+ }
+ int64_t frameTime = (frame.timeStampNs / 1000) - _startTime;
+ timingInfo.presentationTimeStamp = CMTimeMake(frameTime, 1000000);
+ framesCount++;
+
+ CMSampleBufferRef outBuffer;
+
+ status = CMSampleBufferCreateReadyWithImageBuffer(
+ kCFAllocatorDefault,
+ pixelBufferRef,
+ formatDescription,
+ &timingInfo,
+ &outBuffer
+ );
+
+ if (![self.writerInput appendSampleBuffer:outBuffer]) {
+ NSLog(@"Frame not appended %@", self.assetWriter.error);
+ }
+ #if TARGET_OS_IPHONE
+ if (shouldRelease) {
+ CVPixelBufferRelease(pixelBufferRef);
+ }
+ #endif
+}
+
+- (void)stop:(FlutterResult _Nonnull) result {
+ if (_audioSink != nil) {
+ _audioSink.bufferCallback = nil;
+ [_audioSink close];
+ }
+ [self.videoTrack removeRenderer:self];
+ [self.writerInput markAsFinished];
+ [_audioWriter markAsFinished];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.assetWriter finishWritingWithCompletionHandler:^{
+ NSError* error = self.assetWriter.error;
+ if (error == nil) {
+ result(nil);
+ } else {
+ result([FlutterError errorWithCode:@"Failed to save recording"
+ message:[error localizedDescription]
+ details:nil]);
+ }
+ }];
+ });
+}
+
+@end
diff --git a/common/darwin/Classes/FlutterWebRTCPlugin.h b/common/darwin/Classes/FlutterWebRTCPlugin.h
index bd2ae35c5b..ee39d6345f 100644
--- a/common/darwin/Classes/FlutterWebRTCPlugin.h
+++ b/common/darwin/Classes/FlutterWebRTCPlugin.h
@@ -10,6 +10,7 @@
@class FlutterRTCVideoRenderer;
@class FlutterRTCFrameCapturer;
+@class FlutterRTCMediaRecorder;
@class AudioManager;
void postEvent(FlutterEventSink _Nonnull sink, id _Nullable event);
@@ -29,18 +30,25 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
>
@property(nonatomic, strong) RTCPeerConnectionFactory* _Nullable peerConnectionFactory;
-@property(nonatomic, strong) NSMutableDictionary* _Nullable peerConnections;
-@property(nonatomic, strong) NSMutableDictionary* _Nullable localStreams;
+@property(nonatomic, strong)
+ NSMutableDictionary* _Nullable peerConnections;
+@property(nonatomic, strong)
+ NSMutableDictionary* _Nullable localStreams;
@property(nonatomic, strong) NSMutableDictionary>* _Nullable localTracks;
-@property(nonatomic, strong) NSMutableDictionary* _Nullable renders;
+@property(nonatomic, strong)
+ NSMutableDictionary* _Nullable renders;
+@property(nonatomic, strong) NSMutableDictionary* recorders;
@property(nonatomic, strong)
NSMutableDictionary* _Nullable videoCapturerStopHandlers;
-@property(nonatomic, strong) NSMutableDictionary* _Nullable frameCryptors;
-@property(nonatomic, strong) NSMutableDictionary* _Nullable keyProviders;
+@property(nonatomic, strong)
+ NSMutableDictionary* _Nullable frameCryptors;
+@property(nonatomic, strong)
+ NSMutableDictionary* _Nullable keyProviders;
#if TARGET_OS_IPHONE
-@property(nonatomic, retain) UIViewController* _Nullable viewController; /*for broadcast or ReplayKit */
+@property(nonatomic, retain)
+ UIViewController* _Nullable viewController; /*for broadcast or ReplayKit */
#endif
@property(nonatomic, strong) FlutterEventSink _Nullable eventSink;
@@ -49,8 +57,8 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
@property(nonatomic, strong) FlutterRTCFrameCapturer* _Nullable frameCapturer;
@property(nonatomic, strong) AVAudioSessionPort _Nullable preferredInput;
-@property(nonatomic, strong) NSString * _Nonnull focusMode;
-@property(nonatomic, strong) NSString * _Nonnull exposureMode;
+@property(nonatomic, strong) NSString* _Nonnull focusMode;
+@property(nonatomic, strong) NSString* _Nonnull exposureMode;
@property(nonatomic) BOOL _usingFrontCamera;
@property(nonatomic) NSInteger _lastTargetWidth;
@@ -59,10 +67,15 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
@property(nonatomic, strong) AudioManager* _Nullable audioManager;
-- (RTCMediaStream* _Nullable)streamForId:(NSString* _Nonnull)streamId peerConnectionId:(NSString* _Nullable)peerConnectionId;
-- (RTCMediaStreamTrack* _Nullable)trackForId:(NSString* _Nonnull)trackId peerConnectionId:(NSString* _Nullable)peerConnectionId;
-- (RTCRtpTransceiver* _Nullable)getRtpTransceiverById:(RTCPeerConnection* _Nonnull)peerConnection Id:(NSString* _Nullable)Id;
-- (NSDictionary* _Nullable)mediaStreamToMap:(RTCMediaStream* _Nonnull)stream ownerTag:(NSString* _Nullable)ownerTag;
+- (RTCMediaStream* _Nullable)streamForId:(NSString* _Nonnull)streamId
+ peerConnectionId:(NSString* _Nullable)peerConnectionId;
+- (RTCMediaStreamTrack* _Nullable)trackForId:(NSString* _Nonnull)trackId
+ peerConnectionId:(NSString* _Nullable)peerConnectionId;
+- (NSString*)audioTrackIdForVideoTrackId:(NSString*)videoTrackId;
+- (RTCRtpTransceiver* _Nullable)getRtpTransceiverById:(RTCPeerConnection* _Nonnull)peerConnection
+ Id:(NSString* _Nullable)Id;
+- (NSDictionary* _Nullable)mediaStreamToMap:(RTCMediaStream* _Nonnull)stream
+ ownerTag:(NSString* _Nullable)ownerTag;
- (NSDictionary* _Nullable)mediaTrackToMap:(RTCMediaStreamTrack* _Nonnull)track;
- (NSDictionary* _Nullable)receiverToMap:(RTCRtpReceiver* _Nonnull)receiver;
- (NSDictionary* _Nullable)transceiverToMap:(RTCRtpTransceiver* _Nonnull)transceiver;
@@ -73,9 +86,11 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
- (void)ensureAudioSession;
- (void)deactiveRtcAudioSession;
-- (RTCRtpReceiver* _Nullable)getRtpReceiverById:(RTCPeerConnection* _Nonnull)peerConnection Id:(NSString* _Nonnull)Id;
-- (RTCRtpSender* _Nullable)getRtpSenderById:(RTCPeerConnection* _Nonnull)peerConnection Id:(NSString* _Nonnull)Id;
+- (RTCRtpReceiver* _Nullable)getRtpReceiverById:(RTCPeerConnection* _Nonnull)peerConnection
+ Id:(NSString* _Nonnull)Id;
+- (RTCRtpSender* _Nullable)getRtpSenderById:(RTCPeerConnection* _Nonnull)peerConnection
+ Id:(NSString* _Nonnull)Id;
-+ (FlutterWebRTCPlugin * _Nullable)sharedSingleton;
++ (FlutterWebRTCPlugin* _Nullable)sharedSingleton;
@end
diff --git a/common/darwin/Classes/FlutterWebRTCPlugin.m b/common/darwin/Classes/FlutterWebRTCPlugin.m
index 7e4867417e..73f01aebe1 100644
--- a/common/darwin/Classes/FlutterWebRTCPlugin.m
+++ b/common/darwin/Classes/FlutterWebRTCPlugin.m
@@ -8,6 +8,7 @@
#import "FlutterRTCVideoRenderer.h"
#import "FlutterRTCFrameCryptor.h"
#if TARGET_OS_IPHONE
+#import "FlutterRTCMediaRecorder.h"
#import "FlutterRTCVideoPlatformViewFactory.h"
#import "FlutterRTCVideoPlatformViewController.h"
#endif
@@ -184,6 +185,7 @@ - (instancetype)initWithChannel:(FlutterMethodChannel*)channel
self.frameCryptors = [NSMutableDictionary new];
self.keyProviders = [NSMutableDictionary new];
self.videoCapturerStopHandlers = [NSMutableDictionary new];
+ self.recorders = [NSMutableDictionary new];
#if TARGET_OS_IPHONE
self.focusMode = @"locked";
self.exposureMode = @"locked";
@@ -570,7 +572,14 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
[self dataChannelSend:peerConnectionId dataChannelId:dataChannelId data:data type:type];
result(nil);
- } else if ([@"dataChannelClose" isEqualToString:call.method]) {
+ } else if ([@"dataChannelGetBufferedAmount" isEqualToString:call.method]) {
+ NSDictionary* argsMap = call.arguments;
+ NSString* peerConnectionId = argsMap[@"peerConnectionId"];
+ NSString* dataChannelId = argsMap[@"dataChannelId"];
+
+ [self dataChannelGetBufferedAmount:peerConnectionId dataChannelId:dataChannelId result:result];
+ }
+ else if ([@"dataChannelClose" isEqualToString:call.method]) {
NSDictionary* argsMap = call.arguments;
NSString* peerConnectionId = argsMap[@"peerConnectionId"];
NSString* dataChannelId = argsMap[@"dataChannelId"];
@@ -1498,7 +1507,41 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
message:[NSString stringWithFormat:@"Error: peerConnection not found!"]
details:nil]);
}
- } else {
+#if TARGET_OS_IOS
+ } else if ([@"startRecordToFile" isEqualToString:call.method]){
+
+ NSDictionary* argsMap = call.arguments;
+ NSNumber* recorderId = argsMap[@"recorderId"];
+ NSString* path = argsMap[@"path"];
+ NSString* trackId = argsMap[@"videoTrackId"];
+ NSString* peerConnectionId = argsMap[@"peerConnectionId"];
+ NSString* audioTrackId = [self audioTrackIdForVideoTrackId:trackId];
+
+ RTCMediaStreamTrack *track = [self trackForId:trackId peerConnectionId:peerConnectionId];
+ RTCMediaStreamTrack *audioTrack = [self trackForId:audioTrackId peerConnectionId:peerConnectionId];
+ if (track != nil && [track isKindOfClass:[RTCVideoTrack class]]) {
+ NSURL* pathUrl = [NSURL fileURLWithPath:path];
+ self.recorders[recorderId] = [[FlutterRTCMediaRecorder alloc]
+ initWithVideoTrack:(RTCVideoTrack *)track
+ audioTrack:(RTCAudioTrack *)audioTrack
+ outputFile:pathUrl
+ ];
+ }
+ result(nil);
+ } else if ([@"stopRecordToFile" isEqualToString:call.method]) {
+ NSDictionary* argsMap = call.arguments;
+ NSNumber* recorderId = argsMap[@"recorderId"];
+ FlutterRTCMediaRecorder* recorder = self.recorders[recorderId];
+ if (recorder != nil) {
+ [recorder stop:result];
+ [self.recorders removeObjectForKey:recorderId];
+ } else {
+ result([FlutterError errorWithCode:[NSString stringWithFormat:@"%@ failed",call.method]
+ message:[NSString stringWithFormat:@"Error: recorder with id %@ not found!",recorderId]
+ details:nil]);
+ }
+#endif
+ } else {
[self handleFrameCryptorMethodCall:call result:result];
}
}
@@ -1622,6 +1665,38 @@ - (RTCMediaStreamTrack* _Nullable)remoteTrackForId:(NSString* _Nonnull)trackId {
return mediaStreamTrack;
}
+- (NSString *)audioTrackIdForVideoTrackId:(NSString *)videoTrackId {
+ NSString *audioTrackId = nil;
+
+ // Iterate through all peerConnections
+ for (NSString *peerConnectionId in self.peerConnections) {
+ RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
+
+ // Iterate through the receivers to find the video track
+ for (RTCRtpReceiver *receiver in peerConnection.receivers) {
+ RTCMediaStreamTrack *track = [receiver valueForKey:@"track"];
+ if ([track.kind isEqualToString:@"video"] && [track.trackId isEqualToString:videoTrackId]) {
+ // Found the video track, now look for the audio track in the same peerConnection
+ for (RTCRtpReceiver *audioReceiver in peerConnection.receivers) {
+ RTCMediaStreamTrack *audioTrack = [audioReceiver valueForKey:@"track"];
+ if ([audioTrack.kind isEqualToString:@"audio"]) {
+ audioTrackId = audioTrack.trackId;
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ // If the audioTrackId is found, break out of the loop
+ if (audioTrackId != nil) {
+ break;
+ }
+ }
+
+ return audioTrackId;
+}
+
- (RTCMediaStreamTrack*)trackForId:(NSString*)trackId peerConnectionId:(NSString*)peerConnectionId {
id track = _localTracks[trackId];
RTCMediaStreamTrack *mediaStreamTrack = nil;
diff --git a/common/darwin/Classes/RTCAudioSource+Private.h b/common/darwin/Classes/RTCAudioSource+Private.h
new file mode 100644
index 0000000000..6e45d12fbf
--- /dev/null
+++ b/common/darwin/Classes/RTCAudioSource+Private.h
@@ -0,0 +1,14 @@
+#ifdef __cplusplus
+#import "WebRTC/RTCAudioSource.h"
+#include "media_stream_interface.h"
+
+@interface RTCAudioSource ()
+
+/**
+ * The AudioSourceInterface object passed to this RTCAudioSource during
+ * construction.
+ */
+@property(nonatomic, readonly) rtc::scoped_refptr nativeAudioSource;
+
+@end
+#endif
diff --git a/common/darwin/Classes/audio_sink_bridge.cpp b/common/darwin/Classes/audio_sink_bridge.cpp
new file mode 100644
index 0000000000..16ce8fa841
--- /dev/null
+++ b/common/darwin/Classes/audio_sink_bridge.cpp
@@ -0,0 +1,27 @@
+#include "media_stream_interface.h"
+#include "FlutterRTCAudioSink-Interface.h"
+
+class AudioSinkBridge : public webrtc::AudioTrackSinkInterface {
+private:
+ void* sink;
+
+public:
+ AudioSinkBridge(void* sink1) {
+ sink = sink1;
+ }
+ void OnData(const void* audio_data,
+ int bits_per_sample,
+ int sample_rate,
+ size_t number_of_channels,
+ size_t number_of_frames) override
+ {
+ RTCAudioSinkCallback(sink,
+ audio_data,
+ bits_per_sample,
+ sample_rate,
+ number_of_channels,
+ number_of_frames
+ );
+ };
+ int NumPreferredChannels() const override { return 1; }
+};
diff --git a/common/darwin/Classes/media_stream_interface.h b/common/darwin/Classes/media_stream_interface.h
new file mode 100644
index 0000000000..e25553f9fa
--- /dev/null
+++ b/common/darwin/Classes/media_stream_interface.h
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+/// Source https://webrtc.googlesource.com/src/+/master/api/media_stream_interface.h
+
+#ifdef __cplusplus
+#ifndef API_MEDIA_STREAM_INTERFACE_H_
+#define API_MEDIA_STREAM_INTERFACE_H_
+
+#include
+#include
+#include
+#include
+#include
+
+namespace webrtc {
+
+ // Generic observer interface.
+ class ObserverInterface {
+ public:
+ virtual void OnChanged() = 0;
+ protected:
+ virtual ~ObserverInterface() {}
+ };
+ class NotifierInterface {
+ public:
+ virtual void RegisterObserver(ObserverInterface* observer) = 0;
+ virtual void UnregisterObserver(ObserverInterface* observer) = 0;
+ virtual ~NotifierInterface() {}
+ };
+
+ enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained };
+ // Interfaces where refcounting is part of the public api should
+ // inherit this abstract interface. The implementation of these
+ // methods is usually provided by the RefCountedObject template class,
+ // applied as a leaf in the inheritance tree.
+ class RefCountInterface {
+ public:
+ virtual void AddRef() const = 0;
+ virtual RefCountReleaseStatus Release() const = 0;
+ // Non-public destructor, because Release() has exclusive responsibility for
+ // destroying the object.
+ protected:
+ virtual ~RefCountInterface() {}
+ };
+
+ // Base class for sources. A MediaStreamTrack has an underlying source that
+ // provides media. A source can be shared by multiple tracks.
+ class MediaSourceInterface : public RefCountInterface,
+ public NotifierInterface {
+ public:
+ enum SourceState { kInitializing, kLive, kEnded, kMuted };
+ virtual SourceState state() const = 0;
+ virtual bool remote() const = 0;
+ protected:
+ ~MediaSourceInterface() override = default;
+ };
+
+ // Interface for receiving audio data from a AudioTrack.
+ class AudioTrackSinkInterface {
+ public:
+ virtual void OnData(const void* audio_data,
+ int bits_per_sample,
+ int sample_rate,
+ size_t number_of_channels,
+ size_t number_of_frames) {
+
+ };
+ virtual void OnData(const void* audio_data,
+ int bits_per_sample,
+ int sample_rate,
+ size_t number_of_channels,
+ size_t number_of_frames,
+ void* absolute_capture_timestamp_ms) {
+ // TODO(bugs.webrtc.org/10739): Deprecate the old OnData and make this one
+ // pure virtual.
+ return OnData(audio_data, bits_per_sample, sample_rate, number_of_channels,
+ number_of_frames);
+ }
+ virtual int NumPreferredChannels() const { return -1; }
+ protected:
+ virtual ~AudioTrackSinkInterface() {}
+ };
+ // AudioSourceInterface is a reference counted source used for AudioTracks.
+ // The same source can be used by multiple AudioTracks.
+ class AudioSourceInterface : public MediaSourceInterface {
+ public:
+ class AudioObserver {
+ public:
+ virtual void OnSetVolume(double volume) = 0;
+ protected:
+ virtual ~AudioObserver() {}
+ };
+ // TODO(deadbeef): Makes all the interfaces pure virtual after they're
+ // implemented in chromium.
+ // Sets the volume of the source. |volume| is in the range of [0, 10].
+ // TODO(tommi): This method should be on the track and ideally volume should
+ // be applied in the track in a way that does not affect clones of the track.
+ virtual void SetVolume(double volume) {}
+ // Registers/unregisters observers to the audio source.
+ virtual void RegisterAudioObserver(AudioObserver* observer) {}
+ virtual void UnregisterAudioObserver(AudioObserver* observer) {}
+ // TODO(tommi): Make pure virtual.
+ virtual void AddSink(AudioTrackSinkInterface* sink) {}
+ virtual void RemoveSink(AudioTrackSinkInterface* sink) {}
+ // Returns options for the AudioSource.
+ // (for some of the settings this approach is broken, e.g. setting
+ // audio network adaptation on the source is the wrong layer of abstraction).
+// virtual const AudioOptions options() const;
+ };
+}
+namespace rtc {
+
+ template
+ class scoped_refptr {
+ public:
+ typedef T element_type;
+ scoped_refptr() : ptr_(nullptr) {}
+ scoped_refptr(std::nullptr_t) : ptr_(nullptr) {} // NOLINT(runtime/explicit)
+ explicit scoped_refptr(T* p) : ptr_(p) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+ scoped_refptr(const scoped_refptr& r) : ptr_(r.ptr_) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+ template
+ scoped_refptr(const scoped_refptr& r) : ptr_(r.get()) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+ // Move constructors.
+ scoped_refptr(scoped_refptr&& r) noexcept : ptr_(r.release()) {}
+ template
+ scoped_refptr(scoped_refptr&& r) noexcept : ptr_(r.release()) {}
+ ~scoped_refptr() {
+ if (ptr_)
+ ptr_->Release();
+ }
+ T* get() const { return ptr_; }
+ explicit operator bool() const { return ptr_ != nullptr; }
+ T& operator*() const { return *ptr_; }
+ T* operator->() const { return ptr_; }
+ // Returns the (possibly null) raw pointer, and makes the scoped_refptr hold a
+ // null pointer, all without touching the reference count of the underlying
+ // pointed-to object. The object is still reference counted, and the caller of
+ // release() is now the proud owner of one reference, so it is responsible for
+ // calling Release() once on the object when no longer using it.
+ T* release() {
+ T* retVal = ptr_;
+ ptr_ = nullptr;
+ return retVal;
+ }
+ scoped_refptr& operator=(T* p) {
+ // AddRef first so that self assignment should work
+ if (p)
+ p->AddRef();
+ if (ptr_)
+ ptr_->Release();
+ ptr_ = p;
+ return *this;
+ }
+ scoped_refptr& operator=(const scoped_refptr& r) {
+ return *this = r.ptr_;
+ }
+ template
+ scoped_refptr& operator=(const scoped_refptr& r) {
+ return *this = r.get();
+ }
+ scoped_refptr& operator=(scoped_refptr&& r) noexcept {
+ scoped_refptr(std::move(r)).swap(*this);
+ return *this;
+ }
+ template
+ scoped_refptr& operator=(scoped_refptr&& r) noexcept {
+ scoped_refptr(std::move(r)).swap(*this);
+ return *this;
+ }
+ void swap(T** pp) noexcept {
+ T* p = ptr_;
+ ptr_ = *pp;
+ *pp = p;
+ }
+ void swap(scoped_refptr& r) noexcept { swap(&r.ptr_); }
+ protected:
+ T* ptr_;
+ };
+};
+
+#endif // API_MEDIA_STREAM_INTERFACE_H_
+#endif // __cplusplus
diff --git a/elinux/flutter_webrtc_plugin.cc b/elinux/flutter_webrtc_plugin.cc
index 9c2c5fd2b6..4e8a36656c 100644
--- a/elinux/flutter_webrtc_plugin.cc
+++ b/elinux/flutter_webrtc_plugin.cc
@@ -37,6 +37,8 @@ class FlutterWebRTCPluginImpl : public FlutterWebRTCPlugin {
TextureRegistrar* textures() { return textures_; }
+ TaskRunner* task_runner() { return nullptr; }
+
private:
// Creates a plugin that communicates on the given channel.
FlutterWebRTCPluginImpl(PluginRegistrar* registrar,
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 471777a970..64bfc07d0c 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -10,7 +10,7 @@ import 'package:flutter_webrtc_example/src/capture_frame_sample.dart';
import 'src/device_enumeration_sample.dart';
import 'src/get_display_media_sample.dart';
import 'src/get_user_media_sample.dart'
- if (dart.library.html) 'src/get_user_media_sample_web.dart';
+ if (dart.library.js_interop) 'src/get_user_media_sample_web.dart';
import 'src/loopback_data_channel_sample.dart';
import 'src/loopback_sample_unified_tracks.dart';
import 'src/route_item.dart';
diff --git a/example/lib/src/get_user_media_sample.dart b/example/lib/src/get_user_media_sample.dart
index 9fbff0da72..9c2dea81d0 100644
--- a/example/lib/src/get_user_media_sample.dart
+++ b/example/lib/src/get_user_media_sample.dart
@@ -5,6 +5,7 @@ import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
+import 'package:gallery_saver_plus/gallery_saver.dart';
import 'package:path_provider/path_provider.dart';
/*
@@ -24,6 +25,7 @@ class _GetUserMediaSampleState extends State {
bool _isTorchOn = false;
bool _isFrontCamera = true;
MediaRecorder? _mediaRecorder;
+ String? _mediaRecorderFilePath;
bool get _isRec => _mediaRecorder != null;
@@ -101,32 +103,60 @@ class _GetUserMediaSampleState extends State {
void _startRecording() async {
if (_localStream == null) throw Exception('Stream is not initialized');
- if (Platform.isIOS) {
- print('Recording is not available on iOS');
- return;
- }
// TODO(rostopira): request write storage permission
- final storagePath = await getExternalStorageDirectory();
- if (storagePath == null) throw Exception('Can\'t find storagePath');
+ final timestamp = DateTime.now().millisecondsSinceEpoch;
+
+ if (!(Platform.isAndroid || Platform.isIOS || Platform.isMacOS)) {
+ throw 'Unsupported platform';
+ }
+
+ final tempDir = await getTemporaryDirectory();
+ if (!(await tempDir.exists())) {
+ await tempDir.create(recursive: true);
+ }
+
+ _mediaRecorderFilePath = '${tempDir.path}/$timestamp.mp4';
+
+ if (_mediaRecorderFilePath == null) {
+ throw Exception('Can\'t find storagePath');
+ }
- final filePath = storagePath.path + '/webrtc_sample/test.mp4';
- _mediaRecorder = MediaRecorder();
+ final file = File(_mediaRecorderFilePath!);
+ if (await file.exists()) {
+ await file.delete();
+ }
+ _mediaRecorder = MediaRecorder(albumName: 'FlutterWebRTC');
setState(() {});
final videoTrack = _localStream!
.getVideoTracks()
.firstWhere((track) => track.kind == 'video');
+
await _mediaRecorder!.start(
- filePath,
+ _mediaRecorderFilePath!,
videoTrack: videoTrack,
+ audioChannel: RecorderAudioChannel.OUTPUT,
);
}
void _stopRecording() async {
+ if (_mediaRecorderFilePath == null) {
+ return;
+ }
+
+ // album name works only for android, for ios use gallerySaver
await _mediaRecorder?.stop();
setState(() {
_mediaRecorder = null;
});
+
+ // this is only for ios, android already saves to albumName
+ await GallerySaver.saveVideo(
+ _mediaRecorderFilePath!,
+ albumName: 'FlutterWebRTC',
+ );
+
+ _mediaRecorderFilePath = null;
}
void onViewFinderTap(TapDownDetails details, BoxConstraints constraints) {
diff --git a/example/lib/src/get_user_media_sample_web.dart b/example/lib/src/get_user_media_sample_web.dart
index b8b5b5dfe6..7df81cafad 100644
--- a/example/lib/src/get_user_media_sample_web.dart
+++ b/example/lib/src/get_user_media_sample_web.dart
@@ -1,11 +1,12 @@
// ignore: uri_does_not_exist
import 'dart:core';
-import 'dart:html' as html;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
+import 'package:web/web.dart' as web;
+
/*
* getUserMedia sample
*/
@@ -115,7 +116,7 @@ class _GetUserMediaSampleState extends State {
});
print(objectUrl);
// ignore: unsafe_html
- html.window.open(objectUrl, '_blank');
+ web.window.open(objectUrl, '_blank');
}
void _captureFrame() async {
diff --git a/example/lib/src/loopback_data_channel_sample.dart b/example/lib/src/loopback_data_channel_sample.dart
index 4e94b3030f..ba02873324 100644
--- a/example/lib/src/loopback_data_channel_sample.dart
+++ b/example/lib/src/loopback_data_channel_sample.dart
@@ -49,12 +49,14 @@ class _DataChannelLoopBackSampleState extends State {
_dataChannel2Status += '\ndataChannel2: state: ${state.toString()}';
});
};
- _dataChannel2!.onMessage = (data) {
+ _dataChannel2!.onMessage = (data) async {
+ var bufferedAmount = await _dataChannel2!.getBufferedAmount();
setState(() {
_dataChannel2Status +=
- '\ndataChannel2: Received message: ${data.text}';
+ '\ndataChannel2: Received message: ${data.text}, bufferedAmount: $bufferedAmount';
});
- _dataChannel2!.send(RTCDataChannelMessage(
+
+ await _dataChannel2!.send(RTCDataChannelMessage(
'(dataChannel2 ==> dataChannel1) Hello from dataChannel2 echo !!!'));
};
};
@@ -69,10 +71,12 @@ class _DataChannelLoopBackSampleState extends State {
}
};
- _dataChannel1!.onMessage = (data) => setState(() {
- _dataChannel1Status +=
- '\ndataChannel1: Received message: ${data.text}';
- });
+ _dataChannel1!.onMessage = (data) async {
+ var bufferedAmount = await _dataChannel2!.getBufferedAmount();
+ _dataChannel1Status +=
+ '\ndataChannel1: Received message: ${data.text}, bufferedAmount: $bufferedAmount';
+ setState(() {});
+ };
var offer = await _peerConnection1!.createOffer({});
print('peerConnection1 offer: ${offer.sdp}');
diff --git a/example/lib/src/loopback_sample_unified_tracks.dart b/example/lib/src/loopback_sample_unified_tracks.dart
index c3a6168d04..ba84cabbf2 100644
--- a/example/lib/src/loopback_sample_unified_tracks.dart
+++ b/example/lib/src/loopback_sample_unified_tracks.dart
@@ -132,7 +132,9 @@ class _MyAppState extends State {
}
void _selectAudioInput(String deviceId) async {
- await Helper.selectAudioInput(deviceId);
+ if (!WebRTC.platformIsWeb) {
+ await Helper.selectAudioInput(deviceId);
+ }
}
void _cleanUp() async {
@@ -539,7 +541,9 @@ class _MyAppState extends State {
void _switchSpeaker() async {
setState(() {
_speakerOn = !_speakerOn;
- Helper.setSpeakerphoneOn(_speakerOn);
+ if (!WebRTC.platformIsWeb) {
+ Helper.setSpeakerphoneOn(_speakerOn);
+ }
});
}
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 7817e98c1b..9c5d1492b5 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -3,8 +3,8 @@ description: Demonstrates how to use the webrtc plugin.
version: 1.0.0
publish_to: none
environment:
- sdk: '>=3.3.0 <4.0.0'
-
+ sdk: ">=3.3.0 <4.0.0"
+
dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
@@ -15,11 +15,11 @@ dependencies:
flutter_webrtc:
path: ../
# Required for MediaRecorder example
+ gallery_saver_plus: 3.2.4
path_provider: ^2.0.2
permission_handler: ^11.3.1
sdp_transform: ^0.3.2
-
dev_dependencies:
flutter_test:
sdk: flutter
@@ -31,7 +31,6 @@ dev_dependencies:
# The following section is specific to Flutter.
flutter:
-
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
@@ -65,5 +64,5 @@ flutter:
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
- # For details regarding fonts from package dependencies,
+ # For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
diff --git a/example/web/e2ee.worker.dart.js b/example/web/e2ee.worker.dart.js
index 94b7a4bfc1..546a5faa8a 100644
--- a/example/web/e2ee.worker.dart.js
+++ b/example/web/e2ee.worker.dart.js
@@ -1,4 +1,4 @@
-// Generated by dart2js (NullSafetyMode.sound, csp, deferred-serialization, intern-composite-values), the Dart to JavaScript compiler version: 2.19.6.
+// Generated by dart2js (NullSafetyMode.sound, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.7.0.
// The code supports the following hooks:
// dartPrint(message):
// if this function is defined it is called instead of the Dart [print]
@@ -9,12 +9,21 @@
// directly. Instead, a closure that will invoke [main], and its arguments
// [args] is passed to [dartMainRunner].
//
-// dartDeferredLibraryLoader(uri, successCallback, errorCallback, loadId):
+// dartDeferredLibraryLoader(uri, successCallback, errorCallback, loadId, loadPriority):
// if this function is defined, it will be called when a deferred library
// is loaded. It should load and eval the javascript of `uri`, and call
// successCallback. If it fails to do so, it should call errorCallback with
// an error. The loadId argument is the deferred import that resulted in
-// this uri being loaded.
+// this uri being loaded. The loadPriority argument is an arbitrary argument
+// string forwarded from the 'dart2js:load-priority' pragma option.
+// dartDeferredLibraryMultiLoader(uris, successCallback, errorCallback, loadId, loadPriority):
+// if this function is defined, it will be called when a deferred library
+// is loaded. It should load and eval the javascript of every URI in `uris`,
+// and call successCallback. If it fails to do so, it should call
+// errorCallback with an error. The loadId argument is the deferred import
+// that resulted in this uri being loaded. The loadPriority argument is an
+// arbitrary argument string forwarded from the 'dart2js:load-priority'
+// pragma option.
//
// dartCallInstrumentation(id, qualifiedName):
// if this function is defined, it will be called at each entry of a
@@ -32,8 +41,9 @@
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
- if (!to.hasOwnProperty(key))
+ if (!to.hasOwnProperty(key)) {
to[key] = from[key];
+ }
}
}
function mixinPropertiesEasy(from, to) {
@@ -44,7 +54,7 @@
};
cls.prototype = {p: {}};
var object = new cls();
- if (!(object.__proto__ && object.__proto__.p === cls.prototype.p))
+ if (!(Object.getPrototypeOf(object) && Object.getPrototypeOf(object).p === cls.prototype.p))
return false;
try {
if (typeof navigator != "undefined" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Chrome/") >= 0)
@@ -63,7 +73,7 @@
cls.prototype["$is" + cls.name] = cls;
if (sup != null) {
if (supportsDirectProtoAccess) {
- cls.prototype.__proto__ = sup.prototype;
+ Object.setPrototypeOf(cls.prototype, sup.prototype);
return;
}
var clsPrototype = Object.create(sup.prototype);
@@ -72,8 +82,9 @@
}
}
function inheritMany(sup, classes) {
- for (var i = 0; i < classes.length; i++)
+ for (var i = 0; i < classes.length; i++) {
inherit(classes[i], sup);
+ }
}
function mixinEasy(cls, mixin) {
mixinPropertiesEasy(mixin.prototype, cls.prototype);
@@ -83,37 +94,13 @@
mixinPropertiesHard(mixin.prototype, cls.prototype);
cls.prototype.constructor = cls;
}
- function lazyOld(holder, name, getterName, initializer) {
- var uninitializedSentinel = holder;
- holder[name] = uninitializedSentinel;
- holder[getterName] = function() {
- holder[getterName] = function() {
- A.throwCyclicInit(name);
- };
- var result;
- var sentinelInProgress = initializer;
- try {
- if (holder[name] === uninitializedSentinel) {
- result = holder[name] = sentinelInProgress;
- result = holder[name] = initializer();
- } else
- result = holder[name];
- } finally {
- if (result === sentinelInProgress)
- holder[name] = null;
- holder[getterName] = function() {
- return this[name];
- };
- }
- return result;
- };
- }
function lazy(holder, name, getterName, initializer) {
var uninitializedSentinel = holder;
holder[name] = uninitializedSentinel;
holder[getterName] = function() {
- if (holder[name] === uninitializedSentinel)
+ if (holder[name] === uninitializedSentinel) {
holder[name] = initializer();
+ }
holder[getterName] = function() {
return this[name];
};
@@ -126,8 +113,9 @@
holder[getterName] = function() {
if (holder[name] === uninitializedSentinel) {
var value = initializer();
- if (holder[name] !== uninitializedSentinel)
+ if (holder[name] !== uninitializedSentinel) {
A.throwLateFieldADI(name);
+ }
holder[name] = value;
}
var finalValue = holder[name];
@@ -138,8 +126,7 @@
};
}
function makeConstList(list) {
- list.immutable$list = Array;
- list.fixed$length = Array;
+ list.$flags = 7;
return list;
}
function convertToFastObject(properties) {
@@ -150,8 +137,9 @@
return properties;
}
function convertAllToFastObject(arrayOfObjects) {
- for (var i = 0; i < arrayOfObjects.length; ++i)
+ for (var i = 0; i < arrayOfObjects.length; ++i) {
convertToFastObject(arrayOfObjects[i]);
+ }
}
var functionCounter = 0;
function instanceTearOffGetter(isIntercepted, parameters) {
@@ -176,8 +164,9 @@
}
var typesOffset = 0;
function tearOffParameters(container, isStatic, isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex, needsDirectAccess) {
- if (typeof funType == "number")
+ if (typeof funType == "number") {
funType += typesOffset;
+ }
return {co: container, iS: isStatic, iI: isIntercepted, rC: requiredParameterCount, dV: optionalParameterDefaultValues, cs: callNames, fs: funsOrNames, fT: funType, aI: applyIndex || 0, nDA: needsDirectAccess};
}
function installStaticTearOff(holder, getterName, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex) {
@@ -228,16 +217,254 @@
return installStaticTearOff(container, getterName, requiredParameterCount, optionalParameterDefaultValues, callNames, [name], funType, applyIndex);
};
};
- return {inherit: inherit, inheritMany: inheritMany, mixin: mixinEasy, mixinHard: mixinHard, installStaticTearOff: installStaticTearOff, installInstanceTearOff: installInstanceTearOff, _instance_0u: mkInstance(0, 0, null, ["call$0"], 0), _instance_1u: mkInstance(0, 1, null, ["call$1"], 0), _instance_2u: mkInstance(0, 2, null, ["call$2"], 0), _instance_0i: mkInstance(1, 0, null, ["call$0"], 0), _instance_1i: mkInstance(1, 1, null, ["call$1"], 0), _instance_2i: mkInstance(1, 2, null, ["call$2"], 0), _static_0: mkStatic(0, null, ["call$0"], 0), _static_1: mkStatic(1, null, ["call$1"], 0), _static_2: mkStatic(2, null, ["call$2"], 0), makeConstList: makeConstList, lazy: lazy, lazyFinal: lazyFinal, lazyOld: lazyOld, updateHolder: updateHolder, convertToFastObject: convertToFastObject, updateTypes: updateTypes, setOrUpdateInterceptorsByTag: setOrUpdateInterceptorsByTag, setOrUpdateLeafTags: setOrUpdateLeafTags};
+ return {inherit: inherit, inheritMany: inheritMany, mixin: mixinEasy, mixinHard: mixinHard, installStaticTearOff: installStaticTearOff, installInstanceTearOff: installInstanceTearOff, _instance_0u: mkInstance(0, 0, null, ["call$0"], 0), _instance_1u: mkInstance(0, 1, null, ["call$1"], 0), _instance_2u: mkInstance(0, 2, null, ["call$2"], 0), _instance_0i: mkInstance(1, 0, null, ["call$0"], 0), _instance_1i: mkInstance(1, 1, null, ["call$1"], 0), _instance_2i: mkInstance(1, 2, null, ["call$2"], 0), _static_0: mkStatic(0, null, ["call$0"], 0), _static_1: mkStatic(1, null, ["call$1"], 0), _static_2: mkStatic(2, null, ["call$2"], 0), makeConstList: makeConstList, lazy: lazy, lazyFinal: lazyFinal, updateHolder: updateHolder, convertToFastObject: convertToFastObject, updateTypes: updateTypes, setOrUpdateInterceptorsByTag: setOrUpdateInterceptorsByTag, setOrUpdateLeafTags: setOrUpdateLeafTags};
}();
function initializeDeferredHunk(hunk) {
typesOffset = init.types.length;
hunk(hunkHelpers, init, holders, $);
}
- var A = {JS_CONST: function JS_CONST() {
+ var J = {
+ makeDispatchRecord(interceptor, proto, extension, indexability) {
+ return {i: interceptor, p: proto, e: extension, x: indexability};
+ },
+ getNativeInterceptor(object) {
+ var proto, objectProto, $constructor, interceptor, t1,
+ record = object[init.dispatchPropertyName];
+ if (record == null)
+ if ($.initNativeDispatchFlag == null) {
+ A.initNativeDispatch();
+ record = object[init.dispatchPropertyName];
+ }
+ if (record != null) {
+ proto = record.p;
+ if (false === proto)
+ return record.i;
+ if (true === proto)
+ return object;
+ objectProto = Object.getPrototypeOf(object);
+ if (proto === objectProto)
+ return record.i;
+ if (record.e === objectProto)
+ throw A.wrapException(A.UnimplementedError$("Return interceptor for " + A.S(proto(object, record))));
+ }
+ $constructor = object.constructor;
+ if ($constructor == null)
+ interceptor = null;
+ else {
+ t1 = $._JS_INTEROP_INTERCEPTOR_TAG;
+ if (t1 == null)
+ t1 = $._JS_INTEROP_INTERCEPTOR_TAG = init.getIsolateTag("_$dart_js");
+ interceptor = $constructor[t1];
+ }
+ if (interceptor != null)
+ return interceptor;
+ interceptor = A.lookupAndCacheInterceptor(object);
+ if (interceptor != null)
+ return interceptor;
+ if (typeof object == "function")
+ return B.JavaScriptFunction_methods;
+ proto = Object.getPrototypeOf(object);
+ if (proto == null)
+ return B.PlainJavaScriptObject_methods;
+ if (proto === Object.prototype)
+ return B.PlainJavaScriptObject_methods;
+ if (typeof $constructor == "function") {
+ t1 = $._JS_INTEROP_INTERCEPTOR_TAG;
+ if (t1 == null)
+ t1 = $._JS_INTEROP_INTERCEPTOR_TAG = init.getIsolateTag("_$dart_js");
+ Object.defineProperty($constructor, t1, {value: B.UnknownJavaScriptObject_methods, enumerable: false, writable: true, configurable: true});
+ return B.UnknownJavaScriptObject_methods;
+ }
+ return B.UnknownJavaScriptObject_methods;
+ },
+ JSArray_JSArray$fixed($length, $E) {
+ if ($length < 0 || $length > 4294967295)
+ throw A.wrapException(A.RangeError$range($length, 0, 4294967295, "length", null));
+ return J.JSArray_JSArray$markFixed(new Array($length), $E);
+ },
+ JSArray_JSArray$markFixed(allocation, $E) {
+ var t1 = A._setArrayType(allocation, $E._eval$1("JSArray<0>"));
+ t1.$flags = 1;
+ return t1;
+ },
+ getInterceptor$(receiver) {
+ if (typeof receiver == "number") {
+ if (Math.floor(receiver) == receiver)
+ return J.JSInt.prototype;
+ return J.JSNumNotInt.prototype;
+ }
+ if (typeof receiver == "string")
+ return J.JSString.prototype;
+ if (receiver == null)
+ return J.JSNull.prototype;
+ if (typeof receiver == "boolean")
+ return J.JSBool.prototype;
+ if (Array.isArray(receiver))
+ return J.JSArray.prototype;
+ if (typeof receiver != "object") {
+ if (typeof receiver == "function")
+ return J.JavaScriptFunction.prototype;
+ if (typeof receiver == "symbol")
+ return J.JavaScriptSymbol.prototype;
+ if (typeof receiver == "bigint")
+ return J.JavaScriptBigInt.prototype;
+ return receiver;
+ }
+ if (receiver instanceof A.Object)
+ return receiver;
+ return J.getNativeInterceptor(receiver);
+ },
+ getInterceptor$asx(receiver) {
+ if (typeof receiver == "string")
+ return J.JSString.prototype;
+ if (receiver == null)
+ return receiver;
+ if (Array.isArray(receiver))
+ return J.JSArray.prototype;
+ if (typeof receiver != "object") {
+ if (typeof receiver == "function")
+ return J.JavaScriptFunction.prototype;
+ if (typeof receiver == "symbol")
+ return J.JavaScriptSymbol.prototype;
+ if (typeof receiver == "bigint")
+ return J.JavaScriptBigInt.prototype;
+ return receiver;
+ }
+ if (receiver instanceof A.Object)
+ return receiver;
+ return J.getNativeInterceptor(receiver);
+ },
+ getInterceptor$ax(receiver) {
+ if (receiver == null)
+ return receiver;
+ if (Array.isArray(receiver))
+ return J.JSArray.prototype;
+ if (typeof receiver != "object") {
+ if (typeof receiver == "function")
+ return J.JavaScriptFunction.prototype;
+ if (typeof receiver == "symbol")
+ return J.JavaScriptSymbol.prototype;
+ if (typeof receiver == "bigint")
+ return J.JavaScriptBigInt.prototype;
+ return receiver;
+ }
+ if (receiver instanceof A.Object)
+ return receiver;
+ return J.getNativeInterceptor(receiver);
+ },
+ getInterceptor$x(receiver) {
+ if (receiver == null)
+ return receiver;
+ if (typeof receiver != "object") {
+ if (typeof receiver == "function")
+ return J.JavaScriptFunction.prototype;
+ if (typeof receiver == "symbol")
+ return J.JavaScriptSymbol.prototype;
+ if (typeof receiver == "bigint")
+ return J.JavaScriptBigInt.prototype;
+ return receiver;
+ }
+ if (receiver instanceof A.Object)
+ return receiver;
+ return J.getNativeInterceptor(receiver);
+ },
+ get$buffer$x(receiver) {
+ return J.getInterceptor$x(receiver).get$buffer(receiver);
+ },
+ get$hashCode$(receiver) {
+ return J.getInterceptor$(receiver).get$hashCode(receiver);
+ },
+ get$iterator$ax(receiver) {
+ return J.getInterceptor$ax(receiver).get$iterator(receiver);
+ },
+ get$length$asx(receiver) {
+ return J.getInterceptor$asx(receiver).get$length(receiver);
+ },
+ get$runtimeType$(receiver) {
+ return J.getInterceptor$(receiver).get$runtimeType(receiver);
+ },
+ $eq$(receiver, a0) {
+ if (receiver == null)
+ return a0 == null;
+ if (typeof receiver != "object")
+ return a0 != null && receiver === a0;
+ return J.getInterceptor$(receiver).$eq(receiver, a0);
+ },
+ $index$asx(receiver, a0) {
+ if (typeof a0 === "number")
+ if (Array.isArray(receiver) || typeof receiver == "string" || A.isJsIndexable(receiver, receiver[init.dispatchPropertyName]))
+ if (a0 >>> 0 === a0 && a0 < receiver.length)
+ return receiver[a0];
+ return J.getInterceptor$asx(receiver).$index(receiver, a0);
+ },
+ _setInt8$2$x(receiver, a0, a1) {
+ return J.getInterceptor$x(receiver)._setInt8$2(receiver, a0, a1);
+ },
+ add$1$ax(receiver, a0) {
+ return J.getInterceptor$ax(receiver).add$1(receiver, a0);
+ },
+ asUint8List$0$x(receiver) {
+ return J.getInterceptor$x(receiver).asUint8List$0(receiver);
+ },
+ asUint8List$2$x(receiver, a0, a1) {
+ return J.getInterceptor$x(receiver).asUint8List$2(receiver, a0, a1);
+ },
+ elementAt$1$ax(receiver, a0) {
+ return J.getInterceptor$ax(receiver).elementAt$1(receiver, a0);
+ },
+ map$1$1$ax(receiver, a0, $T1) {
+ return J.getInterceptor$ax(receiver).map$1$1(receiver, a0, $T1);
+ },
+ noSuchMethod$1$(receiver, a0) {
+ return J.getInterceptor$(receiver).noSuchMethod$1(receiver, a0);
+ },
+ toString$0$(receiver) {
+ return J.getInterceptor$(receiver).toString$0(receiver);
+ },
+ Interceptor: function Interceptor() {
+ },
+ JSBool: function JSBool() {
+ },
+ JSNull: function JSNull() {
},
- LateError$fieldNI(fieldName) {
- return new A.LateError("Field '" + fieldName + "' has not been initialized.");
+ JavaScriptObject: function JavaScriptObject() {
+ },
+ LegacyJavaScriptObject: function LegacyJavaScriptObject() {
+ },
+ PlainJavaScriptObject: function PlainJavaScriptObject() {
+ },
+ UnknownJavaScriptObject: function UnknownJavaScriptObject() {
+ },
+ JavaScriptFunction: function JavaScriptFunction() {
+ },
+ JavaScriptBigInt: function JavaScriptBigInt() {
+ },
+ JavaScriptSymbol: function JavaScriptSymbol() {
+ },
+ JSArray: function JSArray(t0) {
+ this.$ti = t0;
+ },
+ JSUnmodifiableArray: function JSUnmodifiableArray(t0) {
+ this.$ti = t0;
+ },
+ ArrayIterator: function ArrayIterator(t0, t1, t2) {
+ var _ = this;
+ _._iterable = t0;
+ _._length = t1;
+ _._index = 0;
+ _._current = null;
+ _.$ti = t2;
+ },
+ JSNumber: function JSNumber() {
+ },
+ JSInt: function JSInt() {
+ },
+ JSNumNotInt: function JSNumNotInt() {
+ },
+ JSString: function JSString() {
+ }
+ },
+ A = {JS_CONST: function JS_CONST() {
},
SystemHash_combine(hash, value) {
hash = hash + value & 536870911;
@@ -252,14 +479,12 @@
checkNotNullable(value, $name, $T) {
return value;
},
- SubListIterable$(_iterable, _start, _endOrLength, $E) {
- A.RangeError_checkNotNegative(_start, "start");
- if (_endOrLength != null) {
- A.RangeError_checkNotNegative(_endOrLength, "end");
- if (_start > _endOrLength)
- A.throwExpression(A.RangeError$range(_start, 0, _endOrLength, "start", null));
- }
- return new A.SubListIterable(_iterable, _start, _endOrLength, $E._eval$1("SubListIterable<0>"));
+ isToStringVisiting(object) {
+ var t1, i;
+ for (t1 = $.toStringVisiting.length, i = 0; i < t1; ++i)
+ if (object === $.toStringVisiting[i])
+ return true;
+ return false;
},
MappedIterable_MappedIterable(iterable, $function, $S, $T) {
if (type$.EfficientLengthIterable_dynamic._is(iterable))
@@ -273,22 +498,12 @@
LateError: function LateError(t0) {
this._message = t0;
},
- CodeUnits: function CodeUnits(t0) {
- this._string = t0;
- },
SentinelValue: function SentinelValue() {
},
EfficientLengthIterable: function EfficientLengthIterable() {
},
ListIterable: function ListIterable() {
},
- SubListIterable: function SubListIterable(t0, t1, t2, t3) {
- var _ = this;
- _.__internal$_iterable = t0;
- _._start = t1;
- _._endOrLength = t2;
- _.$ti = t3;
- },
ListIterator: function ListIterator(t0, t1, t2) {
var _ = this;
_.__internal$_iterable = t0;
@@ -331,10 +546,6 @@
},
FixedLengthListMixin: function FixedLengthListMixin() {
},
- UnmodifiableListMixin: function UnmodifiableListMixin() {
- },
- UnmodifiableListBase: function UnmodifiableListBase() {
- },
Symbol: function Symbol(t0) {
this.__internal$_name = t0;
},
@@ -402,6 +613,15 @@
}
return A._rtiToString(A.instanceType(object), null);
},
+ Primitives_safeToString(object) {
+ if (typeof object == "number" || A._isBool(object))
+ return J.toString$0$(object);
+ if (typeof object == "string")
+ return JSON.stringify(object);
+ if (object instanceof A.Closure)
+ return object.toString$0(0);
+ return "Instance of '" + A.Primitives_objectTypeName(object) + "'";
+ },
Primitives_stringFromNativeUint8List(charCodes, start, end) {
var i, result, i0, chunkEnd;
if (end <= 500 && start === 0 && end === charCodes.length)
@@ -419,32 +639,25 @@
return receiver.date;
},
Primitives_getYear(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCFullYear() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCFullYear() + 0 : A.Primitives_lazyAsJsDate(receiver).getFullYear() + 0;
},
Primitives_getMonth(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCMonth() + 1;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCMonth() + 1 : A.Primitives_lazyAsJsDate(receiver).getMonth() + 1;
},
Primitives_getDay(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCDate() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCDate() + 0 : A.Primitives_lazyAsJsDate(receiver).getDate() + 0;
},
Primitives_getHours(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCHours() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCHours() + 0 : A.Primitives_lazyAsJsDate(receiver).getHours() + 0;
},
Primitives_getMinutes(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCMinutes() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCMinutes() + 0 : A.Primitives_lazyAsJsDate(receiver).getMinutes() + 0;
},
Primitives_getSeconds(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCSeconds() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCSeconds() + 0 : A.Primitives_lazyAsJsDate(receiver).getSeconds() + 0;
},
Primitives_getMilliseconds(receiver) {
- var t1 = A.Primitives_lazyAsJsDate(receiver).getUTCMilliseconds() + 0;
- return t1;
+ return receiver.isUtc ? A.Primitives_lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : A.Primitives_lazyAsJsDate(receiver).getMilliseconds() + 0;
},
Primitives_functionNoSuchMethod($function, positionalArguments, namedArguments) {
var $arguments, namedArgumentList, t1 = {};
@@ -454,14 +667,14 @@
t1.argumentCount = positionalArguments.length;
B.JSArray_methods.addAll$1($arguments, positionalArguments);
t1.names = "";
- if (namedArguments != null && namedArguments._length !== 0)
+ if (namedArguments != null && namedArguments.__js_helper$_length !== 0)
namedArguments.forEach$1(0, new A.Primitives_functionNoSuchMethod_closure(t1, namedArgumentList, $arguments));
return J.noSuchMethod$1$($function, new A.JSInvocationMirror(B.Symbol_call, 0, $arguments, namedArgumentList, 0));
},
Primitives_applyFunction($function, positionalArguments, namedArguments) {
var t1, argumentCount, jsStub;
if (Array.isArray(positionalArguments))
- t1 = namedArguments == null || namedArguments._length === 0;
+ t1 = namedArguments == null || namedArguments.__js_helper$_length === 0;
else
t1 = false;
if (t1) {
@@ -505,14 +718,14 @@
if (typeof jsFunction == "string")
jsFunction = interceptor[jsFunction];
if (t1) {
- if (namedArguments != null && namedArguments._length !== 0)
+ if (namedArguments != null && namedArguments.__js_helper$_length !== 0)
return A.Primitives_functionNoSuchMethod($function, $arguments, namedArguments);
if (argumentCount === requiredParameterCount)
return jsFunction.apply($function, $arguments);
return A.Primitives_functionNoSuchMethod($function, $arguments, namedArguments);
}
if (Array.isArray(defaultValues)) {
- if (namedArguments != null && namedArguments._length !== 0)
+ if (namedArguments != null && namedArguments.__js_helper$_length !== 0)
return A.Primitives_functionNoSuchMethod($function, $arguments, namedArguments);
maxArguments = requiredParameterCount + defaultValues.length;
if (argumentCount > maxArguments)
@@ -540,7 +753,7 @@
else {
for (t1 = keys.length, used = 0, _i = 0; _i < keys.length; keys.length === t1 || (0, A.throwConcurrentModificationError)(keys), ++_i) {
key = A._asString(keys[_i]);
- if (namedArguments.containsKey$1(0, key)) {
+ if (namedArguments.containsKey$1(key)) {
++used;
B.JSArray_methods.add$1($arguments, namedArguments.$index(0, key));
} else {
@@ -550,12 +763,26 @@
B.JSArray_methods.add$1($arguments, defaultValue);
}
}
- if (used !== namedArguments._length)
+ if (used !== namedArguments.__js_helper$_length)
return A.Primitives_functionNoSuchMethod($function, $arguments, namedArguments);
}
return jsFunction.apply($function, $arguments);
}
},
+ Primitives_extractStackTrace(error) {
+ var jsError = error.$thrownJsError;
+ if (jsError == null)
+ return null;
+ return A.getTraceFromException(jsError);
+ },
+ Primitives_trySetStackTrace(error, stackTrace) {
+ var jsError;
+ if (error.$thrownJsError == null) {
+ jsError = A.wrapException(error);
+ error.$thrownJsError = jsError;
+ jsError.stack = stackTrace.toString$0(0);
+ }
+ },
iae(argument) {
throw A.wrapException(A.argumentErrorValue(argument));
},
@@ -585,10 +812,12 @@
return new A.ArgumentError(true, object, null, null);
},
wrapException(ex) {
- var wrapper, t1;
- if (ex == null)
- ex = new A.NullThrownError();
- wrapper = new Error();
+ return A.initializeExceptionWrapper(new Error(), ex);
+ },
+ initializeExceptionWrapper(wrapper, ex) {
+ var t1;
+ if (ex == null)
+ ex = new A.TypeError();
wrapper.dartException = ex;
t1 = A.toStringWrapper;
if ("defineProperty" in Object) {
@@ -604,6 +833,45 @@
throwExpression(ex) {
throw A.wrapException(ex);
},
+ throwExpressionWithWrapper(ex, wrapper) {
+ throw A.initializeExceptionWrapper(wrapper, ex);
+ },
+ throwUnsupportedOperation(o, operation, verb) {
+ var wrapper;
+ if (operation == null)
+ operation = 0;
+ if (verb == null)
+ verb = 0;
+ wrapper = Error();
+ A.throwExpressionWithWrapper(A._diagnoseUnsupportedOperation(o, operation, verb), wrapper);
+ },
+ _diagnoseUnsupportedOperation(o, encodedOperation, encodedVerb) {
+ var operation, table, tableLength, index, verb, object, flags, article, adjective;
+ if (typeof encodedOperation == "string")
+ operation = encodedOperation;
+ else {
+ table = "[]=;add;removeWhere;retainWhere;removeRange;setRange;setInt8;setInt16;setInt32;setUint8;setUint16;setUint32;setFloat32;setFloat64".split(";");
+ tableLength = table.length;
+ index = encodedOperation;
+ if (index > tableLength) {
+ encodedVerb = index / tableLength | 0;
+ index %= tableLength;
+ }
+ operation = table[index];
+ }
+ verb = typeof encodedVerb == "string" ? encodedVerb : "modify;remove from;add to".split(";")[encodedVerb];
+ object = type$.List_dynamic._is(o) ? "list" : "ByteData";
+ flags = o.$flags | 0;
+ article = "a ";
+ if ((flags & 4) !== 0)
+ adjective = "constant ";
+ else if ((flags & 2) !== 0) {
+ adjective = "unmodifiable ";
+ article = "an ";
+ } else
+ adjective = (flags & 1) !== 0 ? "fixed-length " : "";
+ return new A.UnsupportedError("'" + operation + "': Cannot " + verb + " " + article + adjective + object);
+ },
throwConcurrentModificationError(collection) {
throw A.wrapException(A.ConcurrentModificationError$(collection));
},
@@ -665,7 +933,7 @@
return error;
},
_unwrapNonDartException(ex) {
- var message, number, ieErrorCode, t1, nsme, notClosure, nullCall, nullLiteralCall, undefCall, undefLiteralCall, nullProperty, undefProperty, undefLiteralProperty, match, _null = null;
+ var message, number, ieErrorCode, nsme, notClosure, nullCall, nullLiteralCall, undefCall, undefLiteralCall, nullProperty, undefProperty, undefLiteralProperty, match;
if (!("message" in ex))
return ex;
message = ex.message;
@@ -675,11 +943,11 @@
if ((B.JSInt_methods._shrOtherPositive$1(number, 16) & 8191) === 10)
switch (ieErrorCode) {
case 438:
- return A.saveStackTrace(ex, A.JsNoSuchMethodError$(A.S(message) + " (Error " + ieErrorCode + ")", _null));
+ return A.saveStackTrace(ex, A.JsNoSuchMethodError$(A.S(message) + " (Error " + ieErrorCode + ")", null));
case 445:
case 5007:
- t1 = A.S(message);
- return A.saveStackTrace(ex, new A.NullError(t1 + " (Error " + ieErrorCode + ")", _null));
+ A.S(message);
+ return A.saveStackTrace(ex, new A.NullError());
}
}
if (ex instanceof TypeError) {
@@ -701,41 +969,9 @@
if (match != null) {
match.method = "call";
return A.saveStackTrace(ex, A.JsNoSuchMethodError$(A._asString(message), match));
- } else {
- match = nullCall.matchTypeError$1(message);
- if (match == null) {
- match = nullLiteralCall.matchTypeError$1(message);
- if (match == null) {
- match = undefCall.matchTypeError$1(message);
- if (match == null) {
- match = undefLiteralCall.matchTypeError$1(message);
- if (match == null) {
- match = nullProperty.matchTypeError$1(message);
- if (match == null) {
- match = nullLiteralCall.matchTypeError$1(message);
- if (match == null) {
- match = undefProperty.matchTypeError$1(message);
- if (match == null) {
- match = undefLiteralProperty.matchTypeError$1(message);
- t1 = match != null;
- } else
- t1 = true;
- } else
- t1 = true;
- } else
- t1 = true;
- } else
- t1 = true;
- } else
- t1 = true;
- } else
- t1 = true;
- } else
- t1 = true;
- if (t1) {
- A._asString(message);
- return A.saveStackTrace(ex, new A.NullError(message, match == null ? _null : match.method));
- }
+ } else if (nullCall.matchTypeError$1(message) != null || nullLiteralCall.matchTypeError$1(message) != null || undefCall.matchTypeError$1(message) != null || undefLiteralCall.matchTypeError$1(message) != null || nullProperty.matchTypeError$1(message) != null || nullLiteralCall.matchTypeError$1(message) != null || undefProperty.matchTypeError$1(message) != null || undefLiteralProperty.matchTypeError$1(message) != null) {
+ A._asString(message);
+ return A.saveStackTrace(ex, new A.NullError());
}
}
return A.saveStackTrace(ex, new A.UnknownJsTypeError(typeof message == "string" ? message : ""));
@@ -750,7 +986,7 @@
}
return null;
}(ex);
- return A.saveStackTrace(ex, new A.ArgumentError(false, _null, _null, typeof message == "string" ? message.replace(/^RangeError:\s*/, "") : message));
+ return A.saveStackTrace(ex, new A.ArgumentError(false, null, null, typeof message == "string" ? message.replace(/^RangeError:\s*/, "") : message));
}
if (typeof InternalError == "function" && ex instanceof InternalError)
if (typeof message == "string" && message === "too much recursion")
@@ -766,13 +1002,17 @@
trace = exception.$cachedTrace;
if (trace != null)
return trace;
- return exception.$cachedTrace = new A._StackTrace(exception);
+ trace = new A._StackTrace(exception);
+ if (typeof exception === "object")
+ exception.$cachedTrace = trace;
+ return trace;
},
objectHashCode(object) {
- if (object == null || typeof object != "object")
+ if (object == null)
return J.get$hashCode$(object);
- else
+ if (typeof object == "object")
return A.Primitives_objectHashCode(object);
+ return J.get$hashCode$(object);
},
fillLiteralMap(keyValuePairs, result) {
var index, index0, index1,
@@ -784,7 +1024,7 @@
}
return result;
},
- invokeClosure(closure, numberOfArguments, arg1, arg2, arg3, arg4) {
+ _invokeClosure(closure, numberOfArguments, arg1, arg2, arg3, arg4) {
type$.Function._as(closure);
switch (A._asInt(numberOfArguments)) {
case 0:
@@ -801,19 +1041,41 @@
throw A.wrapException(A.Exception_Exception("Unsupported number of arguments for wrapped closure"));
},
convertDartClosureToJS(closure, arity) {
- var $function;
- if (closure == null)
- return null;
- $function = closure.$identity;
+ var $function = closure.$identity;
if (!!$function)
return $function;
- $function = function(closure, arity, invoke) {
+ $function = A.convertDartClosureToJSUncached(closure, arity);
+ closure.$identity = $function;
+ return $function;
+ },
+ convertDartClosureToJSUncached(closure, arity) {
+ var entry;
+ switch (arity) {
+ case 0:
+ entry = closure.call$0;
+ break;
+ case 1:
+ entry = closure.call$1;
+ break;
+ case 2:
+ entry = closure.call$2;
+ break;
+ case 3:
+ entry = closure.call$3;
+ break;
+ case 4:
+ entry = closure.call$4;
+ break;
+ default:
+ entry = null;
+ }
+ if (entry != null)
+ return entry.bind(closure);
+ return function(closure, arity, invoke) {
return function(a1, a2, a3, a4) {
return invoke(closure, arity, a1, a2, a3, a4);
};
- }(closure, arity, A.invokeClosure);
- closure.$identity = $function;
- return $function;
+ }(closure, arity, A._invokeClosure);
},
Closure_fromTearOff(parameters) {
var $prototype, $constructor, t2, trampoline, applyTrampoline, i, stub, stub0, stubName, stubCallName,
@@ -831,14 +1093,11 @@
t1.toString;
$prototype = isStatic ? Object.create(new A.StaticClosure().constructor.prototype) : Object.create(new A.BoundClosure(null, null).constructor.prototype);
$prototype.$initialize = $prototype.constructor;
- if (isStatic)
- $constructor = function static_tear_off() {
- this.$initialize();
- };
- else
- $constructor = function tear_off(a, b) {
- this.$initialize(a, b);
- };
+ $constructor = isStatic ? function static_tear_off() {
+ this.$initialize();
+ } : function tear_off(a, b) {
+ this.$initialize(a, b);
+ };
$prototype.constructor = $constructor;
$constructor.prototype = $prototype;
$prototype.$_name = $name;
@@ -936,12 +1195,9 @@
}
},
Closure_forwardCallTo(stubName, $function, isIntercepted, needsDirectAccess) {
- var arity, t1;
if (isIntercepted)
return A.Closure_forwardInterceptedCallTo(stubName, $function, needsDirectAccess);
- arity = $function.length;
- t1 = A.Closure_cspForwardCall(arity, needsDirectAccess, stubName, $function);
- return t1;
+ return A.Closure_cspForwardCall($function.length, needsDirectAccess, stubName, $function);
},
Closure_cspForwardInterceptedCall(arity, needsDirectAccess, stubName, $function) {
var getReceiver = A.BoundClosure_receiverOf,
@@ -1018,9 +1274,11 @@
return closure._interceptor;
},
BoundClosure__computeFieldNamed(fieldName) {
- var t1, i, $name,
+ var names, i, $name,
template = new A.BoundClosure("receiver", "interceptor"),
- names = J.JSArray_markFixedList(Object.getOwnPropertyNames(template), type$.nullable_Object);
+ t1 = Object.getOwnPropertyNames(template);
+ t1.$flags = 1;
+ names = t1;
for (t1 = names.length, i = 0; i < t1; ++i) {
$name = names[i];
if (template[$name] === fieldName)
@@ -1037,7 +1295,7 @@
throw A.wrapException(new A._AssertionError(message));
},
throwCyclicInit(staticName) {
- throw A.wrapException(new A.CyclicInitializationError(staticName));
+ throw A.wrapException(new A._CyclicInitializationError(staticName));
},
getIsolateAffinityTag($name) {
return init.getIsolateTag($name);
@@ -1166,7 +1424,7 @@
transformers = dartNativeDispatchHooksTransformer;
if (typeof transformers == "function")
transformers = [transformers];
- if (transformers.constructor == Array)
+ if (Array.isArray(transformers))
for (i = 0; i < transformers.length; ++i) {
transformer = transformers[i];
if (typeof transformer == "function")
@@ -1183,6 +1441,17 @@
applyHooksTransformer(transformer, hooks) {
return transformer(hooks) || hooks;
},
+ createRecordTypePredicate(shape, fieldRtis) {
+ var $length = fieldRtis.length,
+ $function = init.rttc["" + $length + ";" + shape];
+ if ($function == null)
+ return null;
+ if ($length === 0)
+ return $function;
+ if ($length === $function.length)
+ return $function.apply(null, fieldRtis);
+ return $function(fieldRtis);
+ },
quoteStringForRegExp(string) {
if (/[[\]{}()*+?.\\^$|]/.test(string))
return string.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&");
@@ -1194,17 +1463,23 @@
},
ConstantMap: function ConstantMap() {
},
- ConstantStringMap: function ConstantStringMap(t0, t1, t2, t3) {
- var _ = this;
- _._length = t0;
- _._jsObject = t1;
- _.__js_helper$_keys = t2;
- _.$ti = t3;
+ ConstantStringMap: function ConstantStringMap(t0, t1, t2) {
+ this._jsIndex = t0;
+ this._values = t1;
+ this.$ti = t2;
},
- _ConstantMapKeyIterable: function _ConstantMapKeyIterable(t0, t1) {
- this._map = t0;
+ _KeysOrValues: function _KeysOrValues(t0, t1) {
+ this._elements = t0;
this.$ti = t1;
},
+ _KeysOrValuesOrElementsIterator: function _KeysOrValuesOrElementsIterator(t0, t1, t2) {
+ var _ = this;
+ _._elements = t0;
+ _.__js_helper$_length = t1;
+ _.__js_helper$_index = 0;
+ _.__js_helper$_current = null;
+ _.$ti = t2;
+ },
JSInvocationMirror: function JSInvocationMirror(t0, t1, t2, t3, t4) {
var _ = this;
_._memberName = t0;
@@ -1227,9 +1502,7 @@
_._method = t4;
_._receiver = t5;
},
- NullError: function NullError(t0, t1) {
- this.__js_helper$_message = t0;
- this._method = t1;
+ NullError: function NullError() {
},
JsNoSuchMethodError: function JsNoSuchMethodError(t0, t1, t2) {
this.__js_helper$_message = t0;
@@ -1264,6 +1537,9 @@
this._receiver = t0;
this._interceptor = t1;
},
+ _CyclicInitializationError: function _CyclicInitializationError(t0) {
+ this.variableName = t0;
+ },
RuntimeError: function RuntimeError(t0) {
this.message = t0;
},
@@ -1274,26 +1550,28 @@
},
JsLinkedHashMap: function JsLinkedHashMap(t0) {
var _ = this;
- _._length = 0;
+ _.__js_helper$_length = 0;
_._last = _._first = _.__js_helper$_rest = _._nums = _._strings = null;
_._modifications = 0;
_.$ti = t0;
},
LinkedHashMapCell: function LinkedHashMapCell(t0, t1) {
- this.hashMapCellKey = t0;
- this.hashMapCellValue = t1;
- this._next = null;
+ var _ = this;
+ _.hashMapCellKey = t0;
+ _.hashMapCellValue = t1;
+ _._previous = _._next = null;
},
- LinkedHashMapKeyIterable: function LinkedHashMapKeyIterable(t0, t1) {
+ LinkedHashMapKeysIterable: function LinkedHashMapKeysIterable(t0, t1) {
this._map = t0;
this.$ti = t1;
},
- LinkedHashMapKeyIterator: function LinkedHashMapKeyIterator(t0, t1, t2) {
+ LinkedHashMapKeyIterator: function LinkedHashMapKeyIterator(t0, t1, t2, t3) {
var _ = this;
_._map = t0;
_._modifications = t1;
- _.__js_helper$_current = _._cell = null;
- _.$ti = t2;
+ _._cell = t2;
+ _.__js_helper$_current = null;
+ _.$ti = t3;
},
initHooks_closure: function initHooks_closure(t0) {
this.getTag = t0;
@@ -1305,14 +1583,7 @@
this.prototypeForTag = t0;
},
_ensureNativeList(list) {
- var t1, result, i;
- if (type$.JSIndexable_dynamic._is(list))
- return list;
- t1 = J.getInterceptor$asx(list);
- result = A.List_List$filled(t1.get$length(list), null, false, type$.dynamic);
- for (i = 0; i < t1.get$length(list); ++i)
- B.JSArray_methods.$indexSet(result, i, t1.$index(list, i));
- return result;
+ return list;
},
NativeByteData_NativeByteData($length) {
return new DataView(new ArrayBuffer($length));
@@ -1320,9 +1591,6 @@
NativeUint8List_NativeUint8List($length) {
return new Uint8Array($length);
},
- NativeUint8List_NativeUint8List$fromList(elements) {
- return new Uint8Array(A._ensureNativeList(elements));
- },
NativeUint8List_NativeUint8List$view(buffer, offsetInBytes, $length) {
return $length == null ? new Uint8Array(buffer, offsetInBytes) : new Uint8Array(buffer, offsetInBytes, $length);
},
@@ -1349,6 +1617,9 @@
},
NativeTypedData: function NativeTypedData() {
},
+ _UnmodifiableNativeByteBufferView: function _UnmodifiableNativeByteBufferView(t0) {
+ this._data = t0;
+ },
NativeByteData: function NativeByteData() {
},
NativeTypedArray: function NativeTypedArray() {
@@ -1357,6 +1628,10 @@
},
NativeTypedArrayOfInt: function NativeTypedArrayOfInt() {
},
+ NativeFloat32List: function NativeFloat32List() {
+ },
+ NativeFloat64List: function NativeFloat64List() {
+ },
NativeInt16List: function NativeInt16List() {
},
NativeInt32List: function NativeInt32List() {
@@ -1400,7 +1675,7 @@
return A._Universe_eval(init.typeUniverse, recipe, false);
},
_substitute(universe, rti, typeArguments, depth) {
- var baseType, substitutedBaseType, interfaceTypeArguments, substitutedInterfaceTypeArguments, base, substitutedBase, $arguments, substitutedArguments, returnType, substitutedReturnType, functionParameters, substitutedFunctionParameters, bounds, substitutedBounds, index, argument,
+ var baseType, substitutedBaseType, interfaceTypeArguments, substitutedInterfaceTypeArguments, base, substitutedBase, $arguments, substitutedArguments, t1, fields, substitutedFields, returnType, substitutedReturnType, functionParameters, substitutedFunctionParameters, bounds, substitutedBounds, index, argument,
kind = rti._kind;
switch (kind) {
case 5:
@@ -1441,6 +1716,13 @@
if (substitutedBase === base && substitutedArguments === $arguments)
return rti;
return A._Universe__lookupBindingRti(universe, substitutedBase, substitutedArguments);
+ case 11:
+ t1 = rti._primary;
+ fields = rti._rest;
+ substitutedFields = A._substituteArray(universe, fields, typeArguments, depth);
+ if (substitutedFields === fields)
+ return rti;
+ return A._Universe__lookupRecordRti(universe, t1, substitutedFields);
case 12:
returnType = rti._primary;
substitutedReturnType = A._substitute(universe, returnType, typeArguments, depth);
@@ -1519,13 +1801,11 @@
return target;
},
closureFunctionType(closure) {
- var t1,
- signature = closure.$signature;
+ var signature = closure.$signature;
if (signature != null) {
if (typeof signature == "number")
return A.getTypeFromTypesTable(signature);
- t1 = closure.$signature();
- return t1;
+ return closure.$signature();
}
return null;
},
@@ -1540,11 +1820,8 @@
return A.instanceType(object);
},
instanceType(object) {
- var rti;
- if (object instanceof A.Object) {
- rti = object.$ti;
- return rti != null ? rti : A._instanceTypeFromConstructor(object);
- }
+ if (object instanceof A.Object)
+ return A._instanceType(object);
if (Array.isArray(object))
return A._arrayInstanceType(object);
return A._instanceTypeFromConstructor(J.getInterceptor$(object));
@@ -1570,7 +1847,7 @@
return A._instanceTypeFromConstructorMiss(instance, $constructor);
},
_instanceTypeFromConstructorMiss(instance, $constructor) {
- var effectiveConstructor = instance instanceof A.Closure ? instance.__proto__.__proto__.constructor : $constructor,
+ var effectiveConstructor = instance instanceof A.Closure ? Object.getPrototypeOf(Object.getPrototypeOf(instance)).constructor : $constructor,
rti = A._Universe_findErasedType(init.typeUniverse, effectiveConstructor.name);
$constructor.$ccache = rti;
return rti;
@@ -1586,37 +1863,55 @@
}
return type;
},
+ getRuntimeTypeOfDartObject(object) {
+ return A.createRuntimeType(A._instanceType(object));
+ },
+ _structuralTypeOf(object) {
+ var functionRti = object instanceof A.Closure ? A.closureFunctionType(object) : null;
+ if (functionRti != null)
+ return functionRti;
+ if (type$.TrustedGetRuntimeType._is(object))
+ return J.get$runtimeType$(object)._rti;
+ if (Array.isArray(object))
+ return A._arrayInstanceType(object);
+ return A.instanceType(object);
+ },
createRuntimeType(rti) {
- var s, starErasedRecipe, starErasedRti,
- type = rti._cachedRuntimeType;
- if (type != null)
- return type;
- s = rti._canonicalRecipe;
- starErasedRecipe = s.replace(/\*/g, "");
+ var t1 = rti._cachedRuntimeType;
+ return t1 == null ? rti._cachedRuntimeType = A._createRuntimeType(rti) : t1;
+ },
+ _createRuntimeType(rti) {
+ var starErasedRti, t1,
+ s = rti._canonicalRecipe,
+ starErasedRecipe = s.replace(/\*/g, "");
if (starErasedRecipe === s)
return rti._cachedRuntimeType = new A._Type(rti);
starErasedRti = A._Universe_eval(init.typeUniverse, starErasedRecipe, true);
- type = starErasedRti._cachedRuntimeType;
- return rti._cachedRuntimeType = type == null ? starErasedRti._cachedRuntimeType = new A._Type(starErasedRti) : type;
+ t1 = starErasedRti._cachedRuntimeType;
+ return t1 == null ? starErasedRti._cachedRuntimeType = A._createRuntimeType(starErasedRti) : t1;
},
typeLiteral(recipe) {
return A.createRuntimeType(A._Universe_eval(init.typeUniverse, recipe, false));
},
_installSpecializedIsTest(object) {
- var t1, unstarred, isFn, $name, testRti = this;
+ var t1, unstarred, unstarredKind, isFn, $name, predicate, testRti = this;
if (testRti === type$.Object)
return A._finishIsFn(testRti, object, A._isObject);
- if (!A.isStrongTopType(testRti))
- if (!(testRti === type$.legacy_Object))
- t1 = false;
- else
- t1 = true;
+ if (!A.isSoundTopType(testRti))
+ t1 = testRti === type$.legacy_Object;
else
t1 = true;
if (t1)
return A._finishIsFn(testRti, object, A._isTop);
t1 = testRti._kind;
+ if (t1 === 7)
+ return A._finishIsFn(testRti, object, A._generalNullableIsTestImplementation);
+ if (t1 === 1)
+ return A._finishIsFn(testRti, object, A._isNever);
unstarred = t1 === 6 ? testRti._primary : testRti;
+ unstarredKind = unstarred._kind;
+ if (unstarredKind === 8)
+ return A._finishIsFn(testRti, object, A._isFutureOr);
if (unstarred === type$.int)
isFn = A._isInt;
else if (unstarred === type$.double || unstarred === type$.num)
@@ -1627,16 +1922,18 @@
isFn = unstarred === type$.bool ? A._isBool : null;
if (isFn != null)
return A._finishIsFn(testRti, object, isFn);
- if (unstarred._kind === 9) {
+ if (unstarredKind === 9) {
$name = unstarred._primary;
- if (unstarred._rest.every(A.isTopType)) {
+ if (unstarred._rest.every(A.isDefinitelyTopType)) {
testRti._specializedTestResource = "$is" + $name;
if ($name === "List")
return A._finishIsFn(testRti, object, A._isListTestViaProperty);
return A._finishIsFn(testRti, object, A._isTestViaProperty);
}
- } else if (t1 === 7)
- return A._finishIsFn(testRti, object, A._generalNullableIsTestImplementation);
+ } else if (unstarredKind === 11) {
+ predicate = A.createRecordTypePredicate(unstarred._primary, unstarred._rest);
+ return A._finishIsFn(testRti, object, predicate == null ? A._isNever : predicate);
+ }
return A._finishIsFn(testRti, object, A._generalIsTestImplementation);
},
_finishIsFn(testRti, object, isFn) {
@@ -1646,11 +1943,8 @@
_installSpecializedAsCheck(object) {
var t1, testRti = this,
asFn = A._generalAsCheckImplementation;
- if (!A.isStrongTopType(testRti))
- if (!(testRti === type$.legacy_Object))
- t1 = false;
- else
- t1 = true;
+ if (!A.isSoundTopType(testRti))
+ t1 = testRti === type$.legacy_Object;
else
t1 = true;
if (t1)
@@ -1666,31 +1960,21 @@
return testRti._as(object);
},
_nullIs(testRti) {
- var t1,
- kind = testRti._kind;
- if (!A.isStrongTopType(testRti))
+ var kind = testRti._kind,
+ t1 = true;
+ if (!A.isSoundTopType(testRti))
if (!(testRti === type$.legacy_Object))
if (!(testRti === type$.legacy_Never))
if (kind !== 7)
if (!(kind === 6 && A._nullIs(testRti._primary)))
t1 = kind === 8 && A._nullIs(testRti._primary) || testRti === type$.Null || testRti === type$.JSNull;
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
return t1;
},
_generalIsTestImplementation(object) {
var testRti = this;
if (object == null)
return A._nullIs(testRti);
- return A._isSubtype(init.typeUniverse, A.instanceOrFunctionType(object, testRti), null, testRti, null);
+ return A.isSubtype(init.typeUniverse, A.instanceOrFunctionType(object, testRti), testRti);
},
_generalNullableIsTestImplementation(object) {
if (object == null)
@@ -1720,10 +2004,9 @@
return !!J.getInterceptor$(object)[tag];
},
_generalAsCheckImplementation(object) {
- var t1, testRti = this;
+ var testRti = this;
if (object == null) {
- t1 = A.isNullable(testRti);
- if (t1)
+ if (A.isNullable(testRti))
return object;
} else if (testRti._is(object))
return object;
@@ -1738,17 +2021,21 @@
A._failedAsCheck(object, testRti);
},
_failedAsCheck(object, testRti) {
- throw A.wrapException(A._TypeError$fromMessage(A._Error_compose(object, A.instanceOrFunctionType(object, testRti), A._rtiToString(testRti, null))));
+ throw A.wrapException(A._TypeError$fromMessage(A._Error_compose(object, A._rtiToString(testRti, null))));
},
- _Error_compose(object, objectRti, checkedTypeDescription) {
- var objectDescription = A.Error_safeToString(object);
- return objectDescription + ": type '" + A._rtiToString(objectRti == null ? A.instanceType(object) : objectRti, null) + "' is not a subtype of type '" + checkedTypeDescription + "'";
+ _Error_compose(object, checkedTypeDescription) {
+ return A.Error_safeToString(object) + ": type '" + A._rtiToString(A._structuralTypeOf(object), null) + "' is not a subtype of type '" + checkedTypeDescription + "'";
},
_TypeError$fromMessage(message) {
return new A._TypeError("TypeError: " + message);
},
_TypeError__TypeError$forType(object, type) {
- return new A._TypeError("TypeError: " + A._Error_compose(object, null, type));
+ return new A._TypeError("TypeError: " + A._Error_compose(object, type));
+ },
+ _isFutureOr(object) {
+ var testRti = this,
+ unstarred = testRti._kind === 6 ? testRti._primary : testRti;
+ return unstarred._primary._is(object) || A.Rti__getFutureFromFutureOr(init.typeUniverse, unstarred)._is(object);
},
_isObject(object) {
return object != null;
@@ -1764,6 +2051,9 @@
_asTop(object) {
return object;
},
+ _isNever(object) {
+ return false;
+ },
_isBool(object) {
return true === object || false === object;
},
@@ -1904,13 +2194,12 @@
return s + "})";
},
_functionRtiToString(functionType, genericContext, bounds) {
- var boundsLength, outerContextLength, offset, i, t1, t2, typeParametersText, typeSep, t3, t4, boundRti, kind, parameters, requiredPositional, requiredPositionalLength, optionalPositional, optionalPositionalLength, named, namedLength, returnTypeText, argumentsText, sep, _s2_ = ", ";
+ var boundsLength, offset, i, t1, t2, typeParametersText, typeSep, t3, t4, boundRti, kind, parameters, requiredPositional, requiredPositionalLength, optionalPositional, optionalPositionalLength, named, namedLength, returnTypeText, argumentsText, sep, _s2_ = ", ", outerContextLength = null;
if (bounds != null) {
boundsLength = bounds.length;
- if (genericContext == null) {
+ if (genericContext == null)
genericContext = A._setArrayType([], type$.JSArray_String);
- outerContextLength = null;
- } else
+ else
outerContextLength = genericContext.length;
offset = genericContext.length;
for (i = boundsLength; i > 0; --i)
@@ -1920,24 +2209,19 @@
t4 = t3 - 1 - i;
if (!(t4 >= 0))
return A.ioore(genericContext, t4);
- typeParametersText = B.JSString_methods.$add(typeParametersText + typeSep, genericContext[t4]);
+ typeParametersText = typeParametersText + typeSep + genericContext[t4];
boundRti = bounds[i];
kind = boundRti._kind;
if (!(kind === 2 || kind === 3 || kind === 4 || kind === 5 || boundRti === t1))
- if (!(boundRti === t2))
- t3 = false;
- else
- t3 = true;
+ t3 = boundRti === t2;
else
t3 = true;
if (!t3)
typeParametersText += " extends " + A._rtiToString(boundRti, genericContext);
}
typeParametersText += ">";
- } else {
+ } else
typeParametersText = "";
- outerContextLength = null;
- }
t1 = functionType._primary;
parameters = functionType._rest;
requiredPositional = parameters._requiredPositional;
@@ -1972,7 +2256,7 @@
return typeParametersText + "(" + argumentsText + ") => " + returnTypeText;
},
_rtiToString(rti, genericContext) {
- var s, questionArgument, argumentKind, $name, $arguments, t1, t2,
+ var questionArgument, s, argumentKind, $name, $arguments, t1, t2,
kind = rti._kind;
if (kind === 5)
return "erased";
@@ -1984,10 +2268,8 @@
return "Never";
if (kind === 4)
return "any";
- if (kind === 6) {
- s = A._rtiToString(rti._primary, genericContext);
- return s;
- }
+ if (kind === 6)
+ return A._rtiToString(rti._primary, genericContext);
if (kind === 7) {
questionArgument = rti._primary;
s = A._rtiToString(questionArgument, genericContext);
@@ -2119,7 +2401,7 @@
var baseKind, t1, rti;
if (normalize) {
baseKind = baseType._kind;
- if (!A.isStrongTopType(baseType))
+ if (!A.isSoundTopType(baseType))
t1 = baseType === type$.Null || baseType === type$.JSNull || baseKind === 7 || baseKind === 6;
else
t1 = true;
@@ -2146,16 +2428,11 @@
var baseKind, t1, starArgument, rti;
if (normalize) {
baseKind = baseType._kind;
- if (!A.isStrongTopType(baseType))
+ t1 = true;
+ if (!A.isSoundTopType(baseType))
if (!(baseType === type$.Null || baseType === type$.JSNull))
if (baseKind !== 7)
t1 = baseKind === 8 && A.isNullable(baseType._primary);
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
if (t1)
return baseType;
else if (baseKind === 1 || baseType === type$.legacy_Never)
@@ -2185,17 +2462,10 @@
return t1;
},
_Universe__createFutureOrRti(universe, baseType, key, normalize) {
- var t1, t2, rti;
+ var t1, rti;
if (normalize) {
t1 = baseType._kind;
- if (!A.isStrongTopType(baseType))
- if (!(baseType === type$.legacy_Object))
- t2 = false;
- else
- t2 = true;
- else
- t2 = true;
- if (t2 || baseType === type$.Object)
+ if (A.isSoundTopType(baseType) || baseType === type$.Object || baseType === type$.legacy_Object)
return baseType;
else if (t1 === 1)
return A._Universe__lookupInterfaceRti(universe, "Future", [baseType]);
@@ -2365,7 +2635,7 @@
return {u: universe, e: environment, r: recipe, s: [], p: 0, n: normalize};
},
_Parser_parse(parser) {
- var t2, i, ch, t3, array, head, base, end, item,
+ var t2, i, ch, t3, array, end, item,
source = parser.r,
t1 = parser.s;
for (t2 = source.length, i = 0; i < t2;) {
@@ -2407,24 +2677,7 @@
parser.p = t1.length;
break;
case 62:
- t3 = parser.u;
- array = t1.splice(parser.p);
- A._Parser_toTypes(parser.u, parser.e, array);
- parser.p = t1.pop();
- head = t1.pop();
- if (typeof head == "string")
- t1.push(A._Universe__lookupInterfaceRti(t3, head, array));
- else {
- base = A._Parser_toType(t3, parser.e, head);
- switch (base._kind) {
- case 12:
- t1.push(A._Universe__lookupGenericFunctionRti(t3, base, array, parser.n));
- break;
- default:
- t1.push(A._Universe__lookupBindingRti(t3, base, array));
- break;
- }
- }
+ A._Parser_handleTypeArguments(parser, t1);
break;
case 38:
A._Parser_handleExtendedOperations(parser, t1);
@@ -2531,31 +2784,44 @@
stack.push(string);
return i;
},
- _Parser_handleArguments(parser, stack) {
- var optionalPositional, named, requiredPositional, returnType, parameters, _null = null,
+ _Parser_handleTypeArguments(parser, stack) {
+ var base,
t1 = parser.u,
+ $arguments = A._Parser_collectArray(parser, stack),
head = stack.pop();
+ if (typeof head == "string")
+ stack.push(A._Universe__lookupInterfaceRti(t1, head, $arguments));
+ else {
+ base = A._Parser_toType(t1, parser.e, head);
+ switch (base._kind) {
+ case 12:
+ stack.push(A._Universe__lookupGenericFunctionRti(t1, base, $arguments, parser.n));
+ break;
+ default:
+ stack.push(A._Universe__lookupBindingRti(t1, base, $arguments));
+ break;
+ }
+ }
+ },
+ _Parser_handleArguments(parser, stack) {
+ var requiredPositional, returnType, parameters,
+ t1 = parser.u,
+ head = stack.pop(),
+ optionalPositional = null, named = null;
if (typeof head == "number")
switch (head) {
case -1:
optionalPositional = stack.pop();
- named = _null;
break;
case -2:
named = stack.pop();
- optionalPositional = _null;
break;
default:
stack.push(head);
- named = _null;
- optionalPositional = named;
break;
}
- else {
+ else
stack.push(head);
- named = _null;
- optionalPositional = named;
- }
requiredPositional = A._Parser_collectArray(parser, stack);
head = stack.pop();
switch (head) {
@@ -2640,15 +2906,28 @@
return typeArguments[index - 1];
throw A.wrapException(A.AssertionError$("Bad index " + index + " for " + environment.toString$0(0)));
},
- _isSubtype(universe, s, sEnv, t, tEnv) {
- var t1, sKind, leftTypeVariable, tKind, sBounds, tBounds, sLength, i, sBound, tBound;
+ isSubtype(universe, s, t) {
+ var result,
+ sCache = s._isSubtypeCache;
+ if (sCache == null)
+ sCache = s._isSubtypeCache = new Map();
+ result = sCache.get(t);
+ if (result == null) {
+ result = A._isSubtype(universe, s, null, t, null, false) ? 1 : 0;
+ sCache.set(t, result);
+ }
+ if (0 === result)
+ return false;
+ if (1 === result)
+ return true;
+ return true;
+ },
+ _isSubtype(universe, s, sEnv, t, tEnv, isLegacy) {
+ var t1, sKind, leftTypeVariable, tKind, t2, sBounds, tBounds, sLength, i, sBound, tBound;
if (s === t)
return true;
- if (!A.isStrongTopType(t))
- if (!(t === type$.legacy_Object))
- t1 = false;
- else
- t1 = true;
+ if (!A.isSoundTopType(t))
+ t1 = t === type$.legacy_Object;
else
t1 = true;
if (t1)
@@ -2656,61 +2935,61 @@
sKind = s._kind;
if (sKind === 4)
return true;
- if (A.isStrongTopType(s))
+ if (A.isSoundTopType(s))
return false;
- if (s._kind !== 1)
- t1 = false;
- else
- t1 = true;
- if (t1)
+ t1 = s._kind;
+ if (t1 === 1)
return true;
leftTypeVariable = sKind === 14;
if (leftTypeVariable)
- if (A._isSubtype(universe, sEnv[s._primary], sEnv, t, tEnv))
+ if (A._isSubtype(universe, sEnv[s._primary], sEnv, t, tEnv, false))
return true;
tKind = t._kind;
t1 = s === type$.Null || s === type$.JSNull;
if (t1) {
if (tKind === 8)
- return A._isSubtype(universe, s, sEnv, t._primary, tEnv);
+ return A._isSubtype(universe, s, sEnv, t._primary, tEnv, false);
return t === type$.Null || t === type$.JSNull || tKind === 7 || tKind === 6;
}
if (t === type$.Object) {
if (sKind === 8)
- return A._isSubtype(universe, s._primary, sEnv, t, tEnv);
+ return A._isSubtype(universe, s._primary, sEnv, t, tEnv, false);
if (sKind === 6)
- return A._isSubtype(universe, s._primary, sEnv, t, tEnv);
+ return A._isSubtype(universe, s._primary, sEnv, t, tEnv, false);
return sKind !== 7;
}
if (sKind === 6)
- return A._isSubtype(universe, s._primary, sEnv, t, tEnv);
+ return A._isSubtype(universe, s._primary, sEnv, t, tEnv, false);
if (tKind === 6) {
t1 = A.Rti__getQuestionFromStar(universe, t);
- return A._isSubtype(universe, s, sEnv, t1, tEnv);
+ return A._isSubtype(universe, s, sEnv, t1, tEnv, false);
}
if (sKind === 8) {
- if (!A._isSubtype(universe, s._primary, sEnv, t, tEnv))
+ if (!A._isSubtype(universe, s._primary, sEnv, t, tEnv, false))
return false;
- return A._isSubtype(universe, A.Rti__getFutureFromFutureOr(universe, s), sEnv, t, tEnv);
+ return A._isSubtype(universe, A.Rti__getFutureFromFutureOr(universe, s), sEnv, t, tEnv, false);
}
if (sKind === 7) {
- t1 = A._isSubtype(universe, type$.Null, sEnv, t, tEnv);
- return t1 && A._isSubtype(universe, s._primary, sEnv, t, tEnv);
+ t1 = A._isSubtype(universe, type$.Null, sEnv, t, tEnv, false);
+ return t1 && A._isSubtype(universe, s._primary, sEnv, t, tEnv, false);
}
if (tKind === 8) {
- if (A._isSubtype(universe, s, sEnv, t._primary, tEnv))
+ if (A._isSubtype(universe, s, sEnv, t._primary, tEnv, false))
return true;
- return A._isSubtype(universe, s, sEnv, A.Rti__getFutureFromFutureOr(universe, t), tEnv);
+ return A._isSubtype(universe, s, sEnv, A.Rti__getFutureFromFutureOr(universe, t), tEnv, false);
}
if (tKind === 7) {
- t1 = A._isSubtype(universe, s, sEnv, type$.Null, tEnv);
- return t1 || A._isSubtype(universe, s, sEnv, t._primary, tEnv);
+ t1 = A._isSubtype(universe, s, sEnv, type$.Null, tEnv, false);
+ return t1 || A._isSubtype(universe, s, sEnv, t._primary, tEnv, false);
}
if (leftTypeVariable)
return false;
t1 = sKind !== 12;
if ((!t1 || sKind === 13) && t === type$.Function)
return true;
+ t2 = sKind === 11;
+ if (t2 && t === type$.Record)
+ return true;
if (tKind === 13) {
if (s === type$.JavaScriptFunction)
return true;
@@ -2726,33 +3005,30 @@
for (i = 0; i < sLength; ++i) {
sBound = sBounds[i];
tBound = tBounds[i];
- if (!A._isSubtype(universe, sBound, sEnv, tBound, tEnv) || !A._isSubtype(universe, tBound, tEnv, sBound, sEnv))
+ if (!A._isSubtype(universe, sBound, sEnv, tBound, tEnv, false) || !A._isSubtype(universe, tBound, tEnv, sBound, sEnv, false))
return false;
}
- return A._isFunctionSubtype(universe, s._primary, sEnv, t._primary, tEnv);
+ return A._isFunctionSubtype(universe, s._primary, sEnv, t._primary, tEnv, false);
}
if (tKind === 12) {
if (s === type$.JavaScriptFunction)
return true;
if (t1)
return false;
- return A._isFunctionSubtype(universe, s, sEnv, t, tEnv);
+ return A._isFunctionSubtype(universe, s, sEnv, t, tEnv, false);
}
if (sKind === 9) {
if (tKind !== 9)
return false;
- return A._isInterfaceSubtype(universe, s, sEnv, t, tEnv);
+ return A._isInterfaceSubtype(universe, s, sEnv, t, tEnv, false);
}
- t1 = sKind === 11;
- if (t1 && t === type$.Record)
- return true;
- if (t1 && tKind === 11)
- return A._isRecordSubtype(universe, s, sEnv, t, tEnv);
+ if (t2 && tKind === 11)
+ return A._isRecordSubtype(universe, s, sEnv, t, tEnv, false);
return false;
},
- _isFunctionSubtype(universe, s, sEnv, t, tEnv) {
+ _isFunctionSubtype(universe, s, sEnv, t, tEnv, isLegacy) {
var sParameters, tParameters, sRequiredPositional, tRequiredPositional, sRequiredPositionalLength, tRequiredPositionalLength, requiredPositionalDelta, sOptionalPositional, tOptionalPositional, sOptionalPositionalLength, tOptionalPositionalLength, i, t1, sNamed, tNamed, sNamedLength, tNamedLength, sIndex, tIndex, tName, sName, sIsRequired;
- if (!A._isSubtype(universe, s._primary, sEnv, t._primary, tEnv))
+ if (!A._isSubtype(universe, s._primary, sEnv, t._primary, tEnv, false))
return false;
sParameters = s._rest;
tParameters = t._rest;
@@ -2771,17 +3047,17 @@
return false;
for (i = 0; i < sRequiredPositionalLength; ++i) {
t1 = sRequiredPositional[i];
- if (!A._isSubtype(universe, tRequiredPositional[i], tEnv, t1, sEnv))
+ if (!A._isSubtype(universe, tRequiredPositional[i], tEnv, t1, sEnv, false))
return false;
}
for (i = 0; i < requiredPositionalDelta; ++i) {
t1 = sOptionalPositional[i];
- if (!A._isSubtype(universe, tRequiredPositional[sRequiredPositionalLength + i], tEnv, t1, sEnv))
+ if (!A._isSubtype(universe, tRequiredPositional[sRequiredPositionalLength + i], tEnv, t1, sEnv, false))
return false;
}
for (i = 0; i < tOptionalPositionalLength; ++i) {
t1 = sOptionalPositional[requiredPositionalDelta + i];
- if (!A._isSubtype(universe, tOptionalPositional[i], tEnv, t1, sEnv))
+ if (!A._isSubtype(universe, tOptionalPositional[i], tEnv, t1, sEnv, false))
return false;
}
sNamed = sParameters._named;
@@ -2807,7 +3083,7 @@
if (sIsRequired && !t1)
return false;
t1 = sNamed[sIndex - 1];
- if (!A._isSubtype(universe, tNamed[tIndex + 2], tEnv, t1, sEnv))
+ if (!A._isSubtype(universe, tNamed[tIndex + 2], tEnv, t1, sEnv, false))
return false;
break;
}
@@ -2819,8 +3095,8 @@
}
return true;
},
- _isInterfaceSubtype(universe, s, sEnv, t, tEnv) {
- var rule, recipes, $length, supertypeArgs, i, t1, t2,
+ _isInterfaceSubtype(universe, s, sEnv, t, tEnv, isLegacy) {
+ var rule, recipes, $length, supertypeArgs, i,
sName = s._primary,
tName = t._primary;
for (; sName !== tName;) {
@@ -2838,24 +3114,19 @@
supertypeArgs = $length > 0 ? new Array($length) : init.typeUniverse.sEA;
for (i = 0; i < $length; ++i)
supertypeArgs[i] = A._Universe_evalInEnvironment(universe, s, recipes[i]);
- return A._areArgumentsSubtypes(universe, supertypeArgs, null, sEnv, t._rest, tEnv);
+ return A._areArgumentsSubtypes(universe, supertypeArgs, null, sEnv, t._rest, tEnv, false);
}
- t1 = s._rest;
- t2 = t._rest;
- return A._areArgumentsSubtypes(universe, t1, null, sEnv, t2, tEnv);
+ return A._areArgumentsSubtypes(universe, s._rest, null, sEnv, t._rest, tEnv, false);
},
- _areArgumentsSubtypes(universe, sArgs, sVariances, sEnv, tArgs, tEnv) {
- var i, t1, t2,
+ _areArgumentsSubtypes(universe, sArgs, sVariances, sEnv, tArgs, tEnv, isLegacy) {
+ var i,
$length = sArgs.length;
- for (i = 0; i < $length; ++i) {
- t1 = sArgs[i];
- t2 = tArgs[i];
- if (!A._isSubtype(universe, t1, sEnv, t2, tEnv))
+ for (i = 0; i < $length; ++i)
+ if (!A._isSubtype(universe, sArgs[i], sEnv, tArgs[i], tEnv, false))
return false;
- }
return true;
},
- _isRecordSubtype(universe, s, sEnv, t, tEnv) {
+ _isRecordSubtype(universe, s, sEnv, t, tEnv, isLegacy) {
var i,
sFields = s._rest,
tFields = t._rest,
@@ -2865,40 +3136,29 @@
if (s._primary !== t._primary)
return false;
for (i = 0; i < sCount; ++i)
- if (!A._isSubtype(universe, sFields[i], sEnv, tFields[i], tEnv))
+ if (!A._isSubtype(universe, sFields[i], sEnv, tFields[i], tEnv, false))
return false;
return true;
},
isNullable(t) {
- var t1,
- kind = t._kind;
+ var kind = t._kind,
+ t1 = true;
if (!(t === type$.Null || t === type$.JSNull))
- if (!A.isStrongTopType(t))
+ if (!A.isSoundTopType(t))
if (kind !== 7)
if (!(kind === 6 && A.isNullable(t._primary)))
t1 = kind === 8 && A.isNullable(t._primary);
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
- else
- t1 = true;
return t1;
},
- isTopType(t) {
+ isDefinitelyTopType(t) {
var t1;
- if (!A.isStrongTopType(t))
- if (!(t === type$.legacy_Object))
- t1 = false;
- else
- t1 = true;
+ if (!A.isSoundTopType(t))
+ t1 = t === type$.legacy_Object;
else
t1 = true;
return t1;
},
- isStrongTopType(t) {
+ isSoundTopType(t) {
var kind = t._kind;
return kind === 2 || kind === 3 || kind === 4 || kind === 5 || t === type$.nullable_Object;
},
@@ -2918,7 +3178,7 @@
var _ = this;
_._as = t0;
_._is = t1;
- _._cachedRuntimeType = _._specializedTestResource = _._precomputed1 = null;
+ _._cachedRuntimeType = _._specializedTestResource = _._isSubtypeCache = _._precomputed1 = null;
_._kind = 0;
_._canonicalRecipe = _._bindCache = _._evalCache = _._rest = _._primary = null;
},
@@ -2934,10 +3194,11 @@
this.__rti$_message = t0;
},
_AsyncRun__initializeScheduleImmediate() {
- var div, span, t1 = {};
+ var t1, div, span;
if (self.scheduleImmediate != null)
return A.async__AsyncRun__scheduleImmediateJsOverride$closure();
if (self.MutationObserver != null && self.document != null) {
+ t1 = {};
div = self.document.createElement("div");
span = self.document.createElement("span");
t1.storedCallback = null;
@@ -2974,7 +3235,7 @@
A._awaitOnObject(object, bodyFunction);
},
_asyncReturn(object, completer) {
- completer.complete$1(0, object);
+ completer.complete$1(object);
},
_asyncRethrow(object, completer) {
completer.completeError$2(A.unwrapException(object), A.getTraceFromException(object));
@@ -2987,7 +3248,7 @@
object._thenAwait$1$2(thenCallback, errorCallback, type$.dynamic);
else {
t1 = type$.dynamic;
- if (type$.Future_dynamic._is(object))
+ if (object instanceof A._Future)
object.then$1$2$onError(thenCallback, errorCallback, t1);
else {
future = new A._Future($.Zone__current, type$._Future_dynamic);
@@ -3000,7 +3261,7 @@
_wrapJsFunctionForAsync($function) {
var $protected = function(fn, ERROR) {
return function(errorCode, result) {
- while (true)
+ while (true) {
try {
fn(errorCode, result);
break;
@@ -3008,14 +3269,11 @@
result = error;
errorCode = ERROR;
}
+ }
};
}($function, 1);
return $.Zone__current.registerBinaryCallback$3$1(new A._wrapJsFunctionForAsync_closure($protected), type$.void, type$.int, type$.dynamic);
},
- AsyncError$(error, stackTrace) {
- var t1 = A.checkNotNullable(error, "error", type$.Object);
- return new A.AsyncError(t1, stackTrace == null ? A.AsyncError_defaultStackTrace(error) : stackTrace);
- },
AsyncError_defaultStackTrace(error) {
var stackTrace;
if (type$.Error._is(error)) {
@@ -3025,20 +3283,62 @@
}
return B.C__StringStackTrace;
},
- _Future__chainCoreFuture(source, target) {
- var t1, t2, listeners;
- for (t1 = type$._Future_dynamic; t2 = source._state, (t2 & 4) !== 0;)
- source = t1._as(source._resultOrListeners);
- if ((t2 & 24) !== 0) {
- listeners = target._removeListeners$0();
- target._cloneResult$1(source);
- A._Future__propagateToListeners(target, listeners);
- } else {
+ _interceptError(error, stackTrace) {
+ if ($.Zone__current === B.C__RootZone)
+ return null;
+ return null;
+ },
+ _interceptUserError(error, stackTrace) {
+ if ($.Zone__current !== B.C__RootZone)
+ A._interceptError(error, stackTrace);
+ if (stackTrace == null)
+ if (type$.Error._is(error)) {
+ stackTrace = error.get$stackTrace();
+ if (stackTrace == null) {
+ A.Primitives_trySetStackTrace(error, B.C__StringStackTrace);
+ stackTrace = B.C__StringStackTrace;
+ }
+ } else
+ stackTrace = B.C__StringStackTrace;
+ else if (type$.Error._is(error))
+ A.Primitives_trySetStackTrace(error, stackTrace);
+ return new A.AsyncError(error, stackTrace);
+ },
+ _Future__chainCoreFuture(source, target, sync) {
+ var t2, t3, ignoreError, listeners, _box_0 = {},
+ t1 = _box_0.source = source;
+ for (t2 = type$._Future_dynamic; t3 = t1._state, (t3 & 4) !== 0; t1 = source) {
+ source = t2._as(t1._resultOrListeners);
+ _box_0.source = source;
+ }
+ if (t1 === target) {
+ target._asyncCompleteError$2(new A.ArgumentError(true, t1, null, "Cannot complete a future with itself"), A.StackTrace_current());
+ return;
+ }
+ ignoreError = target._state & 1;
+ t2 = t1._state = t3 | ignoreError;
+ if ((t2 & 24) === 0) {
listeners = type$.nullable__FutureListener_dynamic_dynamic._as(target._resultOrListeners);
target._state = target._state & 1 | 4;
- target._resultOrListeners = source;
- source._prependListeners$1(listeners);
+ target._resultOrListeners = t1;
+ t1._prependListeners$1(listeners);
+ return;
+ }
+ if (!sync)
+ if (target._resultOrListeners == null)
+ t1 = (t2 & 16) === 0 || ignoreError !== 0;
+ else
+ t1 = false;
+ else
+ t1 = true;
+ if (t1) {
+ listeners = target._removeListeners$0();
+ target._cloneResult$1(_box_0.source);
+ A._Future__propagateToListeners(target, listeners);
+ return;
}
+ target._state ^= 2;
+ A._rootScheduleMicrotask(null, null, target._zone, type$.void_Function._as(new A._Future__chainCoreFuture_closure(_box_0, target)));
},
_Future__propagateToListeners(source, listeners) {
var t2, t3, t4, _box_0, t5, t6, hasError, asyncError, nextListener, nextListener0, sourceResult, t7, zone, oldZone, result, current, _box_1 = {},
@@ -3100,7 +3400,7 @@
if (oldZone != null)
$.Zone__current = oldZone;
t1 = _box_0.listenerValueOrError;
- if (t4._is(t1)) {
+ if (t1 instanceof A._Future) {
t5 = _box_0.listener.$ti;
t5 = t5._eval$1("Future<2>")._is(t1) || !t5._rest[1]._is(t1);
} else
@@ -3117,7 +3417,7 @@
_box_1.source = t1;
continue;
} else
- A._Future__chainCoreFuture(t1, result);
+ A._Future__chainCoreFuture(t1, result, true);
return;
}
}
@@ -3203,23 +3503,35 @@
}
},
scheduleMicrotask(callback) {
- var t1, _null = null,
+ var _null = null,
currentZone = $.Zone__current;
if (B.C__RootZone === currentZone) {
A._rootScheduleMicrotask(_null, _null, B.C__RootZone, callback);
return;
}
- t1 = false;
- if (t1) {
- A._rootScheduleMicrotask(_null, _null, currentZone, type$.void_Function._as(callback));
- return;
- }
A._rootScheduleMicrotask(_null, _null, currentZone, type$.void_Function._as(currentZone.bindCallbackGuarded$1(callback)));
},
StreamIterator_StreamIterator(stream, $T) {
A.checkNotNullable(stream, "stream", type$.Object);
return new A._StreamIterator($T._eval$1("_StreamIterator<0>"));
},
+ _runGuarded(notificationHandler) {
+ return;
+ },
+ _BufferingStreamSubscription__registerErrorHandler(zone, handleError) {
+ if (handleError == null)
+ handleError = A.async___nullErrorHandler$closure();
+ if (type$.void_Function_Object_StackTrace._is(handleError))
+ return zone.registerBinaryCallback$3$1(handleError, type$.dynamic, type$.Object, type$.StackTrace);
+ if (type$.void_Function_Object._is(handleError))
+ return type$.dynamic_Function_Object._as(handleError);
+ throw A.wrapException(A.ArgumentError$("handleError callback must take either an Object (the error), or both an Object (the error) and a StackTrace.", null));
+ },
+ _nullErrorHandler(error, stackTrace) {
+ A._rootHandleError(error, stackTrace);
+ },
+ _nullDoneHandler() {
+ },
_rootHandleError(error, stackTrace) {
A._schedulePriorityAsyncCallback(new A._rootHandleError_closure(error, stackTrace));
},
@@ -3309,6 +3621,35 @@
this.error = t0;
this.stackTrace = t1;
},
+ _BroadcastStream: function _BroadcastStream(t0, t1) {
+ this._async$_controller = t0;
+ this.$ti = t1;
+ },
+ _BroadcastSubscription: function _BroadcastSubscription(t0, t1, t2, t3, t4) {
+ var _ = this;
+ _._eventState = 0;
+ _._async$_previous = _._async$_next = null;
+ _._async$_controller = t0;
+ _._onData = t1;
+ _._zone = t2;
+ _._state = t3;
+ _._pending = null;
+ _.$ti = t4;
+ },
+ _BroadcastStreamController: function _BroadcastStreamController() {
+ },
+ _SyncBroadcastStreamController: function _SyncBroadcastStreamController(t0, t1, t2) {
+ var _ = this;
+ _.onListen = t0;
+ _.onCancel = t1;
+ _._state = 0;
+ _._lastSubscription = _._firstSubscription = null;
+ _.$ti = t2;
+ },
+ _SyncBroadcastStreamController__sendData_closure: function _SyncBroadcastStreamController__sendData_closure(t0, t1) {
+ this.$this = t0;
+ this.data = t1;
+ },
_Completer: function _Completer() {
},
_AsyncCompleter: function _AsyncCompleter(t0, t1) {
@@ -3350,11 +3691,11 @@
this.e = t1;
this.s = t2;
},
- _Future__asyncCompleteWithValue_closure: function _Future__asyncCompleteWithValue_closure(t0, t1) {
- this.$this = t0;
- this.value = t1;
+ _Future__chainCoreFuture_closure: function _Future__chainCoreFuture_closure(t0, t1) {
+ this._box_0 = t0;
+ this.target = t1;
},
- _Future__chainFuture_closure: function _Future__chainFuture_closure(t0, t1) {
+ _Future__asyncCompleteWithValue_closure: function _Future__asyncCompleteWithValue_closure(t0, t1) {
this.$this = t0;
this.value = t1;
},
@@ -3368,8 +3709,12 @@
this._box_1 = t1;
this.hasError = t2;
},
- _Future__propagateToListeners_handleWhenCompleteCallback_closure: function _Future__propagateToListeners_handleWhenCompleteCallback_closure(t0) {
- this.originalSource = t0;
+ _Future__propagateToListeners_handleWhenCompleteCallback_closure: function _Future__propagateToListeners_handleWhenCompleteCallback_closure(t0, t1) {
+ this.joinedResult = t0;
+ this.originalSource = t1;
+ },
+ _Future__propagateToListeners_handleWhenCompleteCallback_closure0: function _Future__propagateToListeners_handleWhenCompleteCallback_closure0(t0) {
+ this.joinedResult = t0;
},
_Future__propagateToListeners_handleValueCallback: function _Future__propagateToListeners_handleValueCallback(t0, t1) {
this._box_0 = t0;
@@ -3393,9 +3738,37 @@
this._box_0 = t0;
this.future = t1;
},
- StreamSubscription: function StreamSubscription() {
+ _ControllerStream: function _ControllerStream() {
+ },
+ _ControllerSubscription: function _ControllerSubscription() {
+ },
+ _BufferingStreamSubscription: function _BufferingStreamSubscription() {
},
- StreamTransformerBase: function StreamTransformerBase() {
+ _StreamImpl: function _StreamImpl() {
+ },
+ _DelayedEvent: function _DelayedEvent() {
+ },
+ _DelayedData: function _DelayedData(t0, t1) {
+ this.value = t0;
+ this.next = null;
+ this.$ti = t1;
+ },
+ _PendingEvents: function _PendingEvents(t0) {
+ var _ = this;
+ _._state = 0;
+ _.lastPendingEvent = _.firstPendingEvent = null;
+ _.$ti = t0;
+ },
+ _PendingEvents_schedule_closure: function _PendingEvents_schedule_closure(t0, t1) {
+ this.$this = t0;
+ this.dispatch = t1;
+ },
+ _DoneStreamSubscription: function _DoneStreamSubscription(t0, t1) {
+ var _ = this;
+ _._state = 1;
+ _._zone = t0;
+ _._onDone = null;
+ _.$ti = t1;
},
_StreamIterator: function _StreamIterator(t0) {
this.$ti = t0;
@@ -3412,11 +3785,6 @@
this.$this = t0;
this.f = t1;
},
- _RootZone_bindUnaryCallbackGuarded_closure: function _RootZone_bindUnaryCallbackGuarded_closure(t0, t1, t2) {
- this.$this = t0;
- this.f = t1;
- this.T = t2;
- },
_HashMap__getTableEntry(table, key) {
var entry = table[key];
return entry === table ? null : entry;
@@ -3439,148 +3807,24 @@
LinkedHashMap_LinkedHashMap$_empty($K, $V) {
return new A.JsLinkedHashMap($K._eval$1("@<0>")._bind$1($V)._eval$1("JsLinkedHashMap<1,2>"));
},
- IterableBase_iterableToShortString(iterable, leftDelimiter, rightDelimiter) {
- var parts, t1;
- if (A._isToStringVisiting(iterable)) {
- if (leftDelimiter === "(" && rightDelimiter === ")")
- return "(...)";
- return leftDelimiter + "..." + rightDelimiter;
- }
- parts = A._setArrayType([], type$.JSArray_String);
- B.JSArray_methods.add$1($._toStringVisiting, iterable);
+ MapBase_mapToString(m) {
+ var result, t1;
+ if (A.isToStringVisiting(m))
+ return "{...}";
+ result = new A.StringBuffer("");
try {
- A._iterablePartsToStrings(iterable, parts);
+ t1 = {};
+ B.JSArray_methods.add$1($.toStringVisiting, m);
+ result._contents += "{";
+ t1.first = true;
+ m.forEach$1(0, new A.MapBase_mapToString_closure(t1, result));
+ result._contents += "}";
} finally {
- if (0 >= $._toStringVisiting.length)
- return A.ioore($._toStringVisiting, -1);
- $._toStringVisiting.pop();
+ if (0 >= $.toStringVisiting.length)
+ return A.ioore($.toStringVisiting, -1);
+ $.toStringVisiting.pop();
}
- t1 = A.StringBuffer__writeAll(leftDelimiter, type$.Iterable_dynamic._as(parts), ", ") + rightDelimiter;
- return t1.charCodeAt(0) == 0 ? t1 : t1;
- },
- IterableBase_iterableToFullString(iterable, leftDelimiter, rightDelimiter) {
- var buffer, t1;
- if (A._isToStringVisiting(iterable))
- return leftDelimiter + "..." + rightDelimiter;
- buffer = new A.StringBuffer(leftDelimiter);
- B.JSArray_methods.add$1($._toStringVisiting, iterable);
- try {
- t1 = buffer;
- t1._contents = A.StringBuffer__writeAll(t1._contents, iterable, ", ");
- } finally {
- if (0 >= $._toStringVisiting.length)
- return A.ioore($._toStringVisiting, -1);
- $._toStringVisiting.pop();
- }
- buffer._contents += rightDelimiter;
- t1 = buffer._contents;
- return t1.charCodeAt(0) == 0 ? t1 : t1;
- },
- _isToStringVisiting(o) {
- var t1, i;
- for (t1 = $._toStringVisiting.length, i = 0; i < t1; ++i)
- if (o === $._toStringVisiting[i])
- return true;
- return false;
- },
- _iterablePartsToStrings(iterable, parts) {
- var next, ultimateString, penultimateString, penultimate, ultimate, ultimate0, elision,
- it = iterable.get$iterator(iterable),
- $length = 0, count = 0;
- while (true) {
- if (!($length < 80 || count < 3))
- break;
- if (!it.moveNext$0())
- return;
- next = A.S(it.get$current(it));
- B.JSArray_methods.add$1(parts, next);
- $length += next.length + 2;
- ++count;
- }
- if (!it.moveNext$0()) {
- if (count <= 5)
- return;
- if (0 >= parts.length)
- return A.ioore(parts, -1);
- ultimateString = parts.pop();
- if (0 >= parts.length)
- return A.ioore(parts, -1);
- penultimateString = parts.pop();
- } else {
- penultimate = it.get$current(it);
- ++count;
- if (!it.moveNext$0()) {
- if (count <= 4) {
- B.JSArray_methods.add$1(parts, A.S(penultimate));
- return;
- }
- ultimateString = A.S(penultimate);
- if (0 >= parts.length)
- return A.ioore(parts, -1);
- penultimateString = parts.pop();
- $length += ultimateString.length + 2;
- } else {
- ultimate = it.get$current(it);
- ++count;
- for (; it.moveNext$0(); penultimate = ultimate, ultimate = ultimate0) {
- ultimate0 = it.get$current(it);
- ++count;
- if (count > 100) {
- while (true) {
- if (!($length > 75 && count > 3))
- break;
- if (0 >= parts.length)
- return A.ioore(parts, -1);
- $length -= parts.pop().length + 2;
- --count;
- }
- B.JSArray_methods.add$1(parts, "...");
- return;
- }
- }
- penultimateString = A.S(penultimate);
- ultimateString = A.S(ultimate);
- $length += ultimateString.length + penultimateString.length + 4;
- }
- }
- if (count > parts.length + 2) {
- $length += 5;
- elision = "...";
- } else
- elision = null;
- while (true) {
- if (!($length > 80 && parts.length > 3))
- break;
- if (0 >= parts.length)
- return A.ioore(parts, -1);
- $length -= parts.pop().length + 2;
- if (elision == null) {
- $length += 5;
- elision = "...";
- }
- }
- if (elision != null)
- B.JSArray_methods.add$1(parts, elision);
- B.JSArray_methods.add$1(parts, penultimateString);
- B.JSArray_methods.add$1(parts, ultimateString);
- },
- MapBase_mapToString(m) {
- var result, t1 = {};
- if (A._isToStringVisiting(m))
- return "{...}";
- result = new A.StringBuffer("");
- try {
- B.JSArray_methods.add$1($._toStringVisiting, m);
- result._contents += "{";
- t1.first = true;
- J.forEach$1$x(m, new A.MapBase_mapToString_closure(t1, result));
- result._contents += "}";
- } finally {
- if (0 >= $._toStringVisiting.length)
- return A.ioore($._toStringVisiting, -1);
- $._toStringVisiting.pop();
- }
- t1 = result._contents;
+ t1 = result._contents;
return t1.charCodeAt(0) == 0 ? t1 : t1;
},
_HashMap: function _HashMap() {
@@ -3588,7 +3832,7 @@
_IdentityHashMap: function _IdentityHashMap(t0) {
var _ = this;
_._collection$_length = 0;
- _._keys = _._collection$_rest = _._collection$_nums = _._collection$_strings = null;
+ _._collection$_keys = _._collection$_rest = _._collection$_nums = _._collection$_strings = null;
_.$ti = t0;
},
_HashMapKeyIterable: function _HashMapKeyIterable(t0, t1) {
@@ -3598,38 +3842,32 @@
_HashMapKeyIterator: function _HashMapKeyIterator(t0, t1, t2) {
var _ = this;
_._collection$_map = t0;
- _._keys = t1;
+ _._collection$_keys = t1;
_._offset = 0;
_._collection$_current = null;
_.$ti = t2;
},
ListBase: function ListBase() {
},
- ListMixin: function ListMixin() {
- },
MapBase: function MapBase() {
},
MapBase_mapToString_closure: function MapBase_mapToString_closure(t0, t1) {
this._box_0 = t0;
this.result = t1;
},
- MapMixin: function MapMixin() {
- },
_UnmodifiableMapMixin: function _UnmodifiableMapMixin() {
},
MapView: function MapView() {
},
UnmodifiableMapView: function UnmodifiableMapView() {
},
- _ListBase_Object_ListMixin: function _ListBase_Object_ListMixin() {
- },
_UnmodifiableMapView_MapView__UnmodifiableMapMixin: function _UnmodifiableMapView_MapView__UnmodifiableMapMixin() {
},
_Base64Encoder_encodeChunk(alphabet, bytes, start, end, isLast, output, outputIndex, state) {
- var t1, t2, i, byteOr, byte, outputIndex0, t3, outputIndex1,
+ var t1, t2, t3, i, byteOr, byte, outputIndex0, t4, t5, outputIndex1,
bits = state >>> 2,
expectedChars = 3 - (state & 3);
- for (t1 = bytes.length, t2 = output.length, i = start, byteOr = 0; i < end; ++i) {
+ for (t1 = bytes.length, t2 = alphabet.length, t3 = output.$flags | 0, i = start, byteOr = 0; i < end; ++i) {
if (!(i < t1))
return A.ioore(bytes, i);
byte = bytes[i];
@@ -3638,25 +3876,35 @@
--expectedChars;
if (expectedChars === 0) {
outputIndex0 = outputIndex + 1;
- t3 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 18 & 63);
- if (!(outputIndex < t2))
+ t4 = bits >>> 18 & 63;
+ if (!(t4 < t2))
+ return A.ioore(alphabet, t4);
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ t5 = output.length;
+ if (!(outputIndex < t5))
return A.ioore(output, outputIndex);
- output[outputIndex] = t3;
+ output[outputIndex] = alphabet.charCodeAt(t4);
outputIndex = outputIndex0 + 1;
- t3 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 12 & 63);
- if (!(outputIndex0 < t2))
+ t4 = bits >>> 12 & 63;
+ if (!(t4 < t2))
+ return A.ioore(alphabet, t4);
+ if (!(outputIndex0 < t5))
return A.ioore(output, outputIndex0);
- output[outputIndex0] = t3;
+ output[outputIndex0] = alphabet.charCodeAt(t4);
outputIndex0 = outputIndex + 1;
- t3 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 6 & 63);
- if (!(outputIndex < t2))
+ t4 = bits >>> 6 & 63;
+ if (!(t4 < t2))
+ return A.ioore(alphabet, t4);
+ if (!(outputIndex < t5))
return A.ioore(output, outputIndex);
- output[outputIndex] = t3;
+ output[outputIndex] = alphabet.charCodeAt(t4);
outputIndex = outputIndex0 + 1;
- t3 = B.JSString_methods._codeUnitAt$1(alphabet, bits & 63);
- if (!(outputIndex0 < t2))
+ t4 = bits & 63;
+ if (!(t4 < t2))
+ return A.ioore(alphabet, t4);
+ if (!(outputIndex0 < t5))
return A.ioore(output, outputIndex0);
- output[outputIndex0] = t3;
+ output[outputIndex0] = alphabet.charCodeAt(t4);
bits = 0;
expectedChars = 3;
}
@@ -3666,36 +3914,50 @@
outputIndex0 = outputIndex + 1;
outputIndex1 = outputIndex0 + 1;
if (3 - expectedChars === 1) {
- t1 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 2 & 63);
- if (!(outputIndex < t2))
+ t1 = bits >>> 2 & 63;
+ if (!(t1 < t2))
+ return A.ioore(alphabet, t1);
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ t3 = output.length;
+ if (!(outputIndex < t3))
return A.ioore(output, outputIndex);
- output[outputIndex] = t1;
- t1 = B.JSString_methods._codeUnitAt$1(alphabet, bits << 4 & 63);
- if (!(outputIndex0 < t2))
+ output[outputIndex] = alphabet.charCodeAt(t1);
+ t1 = bits << 4 & 63;
+ if (!(t1 < t2))
+ return A.ioore(alphabet, t1);
+ if (!(outputIndex0 < t3))
return A.ioore(output, outputIndex0);
- output[outputIndex0] = t1;
+ output[outputIndex0] = alphabet.charCodeAt(t1);
outputIndex = outputIndex1 + 1;
- if (!(outputIndex1 < t2))
+ if (!(outputIndex1 < t3))
return A.ioore(output, outputIndex1);
output[outputIndex1] = 61;
- if (!(outputIndex < t2))
+ if (!(outputIndex < t3))
return A.ioore(output, outputIndex);
output[outputIndex] = 61;
} else {
- t1 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 10 & 63);
- if (!(outputIndex < t2))
+ t1 = bits >>> 10 & 63;
+ if (!(t1 < t2))
+ return A.ioore(alphabet, t1);
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ t3 = output.length;
+ if (!(outputIndex < t3))
return A.ioore(output, outputIndex);
- output[outputIndex] = t1;
- t1 = B.JSString_methods._codeUnitAt$1(alphabet, bits >>> 4 & 63);
- if (!(outputIndex0 < t2))
+ output[outputIndex] = alphabet.charCodeAt(t1);
+ t1 = bits >>> 4 & 63;
+ if (!(t1 < t2))
+ return A.ioore(alphabet, t1);
+ if (!(outputIndex0 < t3))
return A.ioore(output, outputIndex0);
- output[outputIndex0] = t1;
+ output[outputIndex0] = alphabet.charCodeAt(t1);
outputIndex = outputIndex1 + 1;
- t1 = B.JSString_methods._codeUnitAt$1(alphabet, bits << 2 & 63);
- if (!(outputIndex1 < t2))
+ t1 = bits << 2 & 63;
+ if (!(t1 < t2))
+ return A.ioore(alphabet, t1);
+ if (!(outputIndex1 < t3))
return A.ioore(output, outputIndex1);
- output[outputIndex1] = t1;
- if (!(outputIndex < t2))
+ output[outputIndex1] = alphabet.charCodeAt(t1);
+ if (!(outputIndex < t3))
return A.ioore(output, outputIndex);
output[outputIndex] = 61;
}
@@ -3716,33 +3978,37 @@
throw A.wrapException(A.ArgumentError$value(bytes, "Not a byte value at index " + i + ": 0x" + B.JSInt_methods.toRadixString$1(bytes[i], 16), null));
},
_Base64Decoder_decodeChunk(input, start, end, output, outIndex, state) {
- var t1, t2, i, charOr, char, t3, code, outIndex0, expectedPadding,
+ var t1, t2, t3, i, charOr, char, t4, code, outIndex0, expectedPadding,
_s31_ = "Invalid encoding before padding",
_s17_ = "Invalid character",
bits = B.JSInt_methods._shrOtherPositive$1(state, 2),
count = state & 3,
inverseAlphabet = $.$get$_Base64Decoder__inverseAlphabet();
- for (t1 = inverseAlphabet.length, t2 = output.length, i = start, charOr = 0; i < end; ++i) {
- char = B.JSString_methods._codeUnitAt$1(input, i);
+ for (t1 = input.length, t2 = inverseAlphabet.length, t3 = output.$flags | 0, i = start, charOr = 0; i < end; ++i) {
+ if (!(i < t1))
+ return A.ioore(input, i);
+ char = input.charCodeAt(i);
charOr |= char;
- t3 = char & 127;
- if (!(t3 < t1))
- return A.ioore(inverseAlphabet, t3);
- code = inverseAlphabet[t3];
+ t4 = char & 127;
+ if (!(t4 < t2))
+ return A.ioore(inverseAlphabet, t4);
+ code = inverseAlphabet[t4];
if (code >= 0) {
bits = (bits << 6 | code) & 16777215;
count = count + 1 & 3;
if (count === 0) {
outIndex0 = outIndex + 1;
- if (!(outIndex < t2))
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ t4 = output.length;
+ if (!(outIndex < t4))
return A.ioore(output, outIndex);
output[outIndex] = bits >>> 16 & 255;
outIndex = outIndex0 + 1;
- if (!(outIndex0 < t2))
+ if (!(outIndex0 < t4))
return A.ioore(output, outIndex0);
output[outIndex0] = bits >>> 8 & 255;
outIndex0 = outIndex + 1;
- if (!(outIndex < t2))
+ if (!(outIndex < t4))
return A.ioore(output, outIndex);
output[outIndex] = bits & 255;
outIndex = outIndex0;
@@ -3756,16 +4022,19 @@
if ((bits & 3) !== 0)
throw A.wrapException(A.FormatException$(_s31_, input, i));
outIndex0 = outIndex + 1;
- if (!(outIndex < t2))
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ t1 = output.length;
+ if (!(outIndex < t1))
return A.ioore(output, outIndex);
output[outIndex] = bits >>> 10;
- if (!(outIndex0 < t2))
+ if (!(outIndex0 < t1))
return A.ioore(output, outIndex0);
output[outIndex0] = bits >>> 2;
} else {
if ((bits & 15) !== 0)
throw A.wrapException(A.FormatException$(_s31_, input, i));
- if (!(outIndex < t2))
+ t3 & 2 && A.throwUnsupportedOperation(output);
+ if (!(outIndex < output.length))
return A.ioore(output, outIndex);
output[outIndex] = bits >>> 4;
}
@@ -3779,8 +4048,9 @@
if (charOr >= 0 && charOr <= 127)
return (bits << 2 | count) >>> 0;
for (i = start; i < end; ++i) {
- char = B.JSString_methods._codeUnitAt$1(input, i);
- if (char > 127)
+ if (!(i < t1))
+ return A.ioore(input, i);
+ if (input.charCodeAt(i) > 127)
break;
}
throw A.wrapException(A.FormatException$(_s17_, input, i));
@@ -3798,6 +4068,7 @@
},
_Base64Decoder__trimPaddingChars(input, start, end) {
var char,
+ t1 = input.length,
newEnd = end,
index = newEnd,
padding = 0;
@@ -3806,7 +4077,9 @@
break;
c$0: {
--index;
- char = B.JSString_methods.codeUnitAt$1(input, index);
+ if (!(index >= 0 && index < t1))
+ return A.ioore(input, index);
+ char = input.charCodeAt(index);
if (char === 61) {
++padding;
newEnd = index;
@@ -3816,13 +4089,17 @@
if (index === start)
break;
--index;
- char = B.JSString_methods.codeUnitAt$1(input, index);
+ if (!(index >= 0 && index < t1))
+ return A.ioore(input, index);
+ char = input.charCodeAt(index);
}
if (char === 51) {
if (index === start)
break;
--index;
- char = B.JSString_methods.codeUnitAt$1(input, index);
+ if (!(index >= 0 && index < t1))
+ return A.ioore(input, index);
+ char = input.charCodeAt(index);
}
if (char === 37) {
++padding;
@@ -3835,12 +4112,14 @@
return newEnd;
},
_Base64Decoder__checkPadding(input, start, end, state) {
- var expectedPadding, char;
+ var expectedPadding, t1, char;
if (start === end)
return state;
expectedPadding = -state - 1;
- for (; expectedPadding > 0;) {
- char = B.JSString_methods._codeUnitAt$1(input, start);
+ for (t1 = input.length; expectedPadding > 0;) {
+ if (!(start < t1))
+ return A.ioore(input, start);
+ char = input.charCodeAt(start);
if (expectedPadding === 3) {
if (char === 61) {
expectedPadding -= 3;
@@ -3852,7 +4131,9 @@
++start;
if (start === end)
break;
- char = B.JSString_methods._codeUnitAt$1(input, start);
+ if (!(start < t1))
+ return A.ioore(input, start);
+ char = input.charCodeAt(start);
} else
break;
}
@@ -3863,7 +4144,9 @@
--expectedPadding;
if (start === end)
break;
- char = B.JSString_methods._codeUnitAt$1(input, start);
+ if (!(start < t1))
+ return A.ioore(input, start);
+ char = input.charCodeAt(start);
}
if ((char | 32) !== 100)
break;
@@ -3893,11 +4176,6 @@
},
Converter: function Converter() {
},
- Error__objectToString(object) {
- if (object instanceof A.Closure)
- return object.toString$0(0);
- return "Instance of '" + A.Primitives_objectTypeName(object) + "'";
- },
Error__throw(error, stackTrace) {
error = A.wrapException(error);
if (error == null)
@@ -3924,30 +4202,41 @@
return A._setArrayType(elements.slice(0), $E._eval$1("JSArray<0>"));
list = A._setArrayType([], $E._eval$1("JSArray<0>"));
for (t1 = J.get$iterator$ax(elements); t1.moveNext$0();)
- B.JSArray_methods.add$1(list, t1.get$current(t1));
+ B.JSArray_methods.add$1(list, t1.get$current());
return list;
},
String_String$fromCharCodes(charCodes) {
- var t1 = A.Primitives_stringFromNativeUint8List(charCodes, 0, A.RangeError_checkValidRange(0, null, charCodes.length));
+ var t1;
+ A.RangeError_checkNotNegative(0, "start");
+ t1 = A.String__stringFromUint8List(charCodes, 0, null);
return t1;
},
+ String__stringFromUint8List(charCodes, start, endOrNull) {
+ var len = charCodes.length;
+ if (start >= len)
+ return "";
+ return A.Primitives_stringFromNativeUint8List(charCodes, start, len);
+ },
StringBuffer__writeAll(string, objects, separator) {
var iterator = J.get$iterator$ax(objects);
if (!iterator.moveNext$0())
return string;
if (separator.length === 0) {
do
- string += A.S(iterator.get$current(iterator));
+ string += A.S(iterator.get$current());
while (iterator.moveNext$0());
} else {
- string += A.S(iterator.get$current(iterator));
+ string += A.S(iterator.get$current());
for (; iterator.moveNext$0();)
- string = string + separator + A.S(iterator.get$current(iterator));
+ string = string + separator + A.S(iterator.get$current());
}
return string;
},
- NoSuchMethodError$_(receiver, memberName, positionalArguments, namedArguments, existingArgumentNames) {
- return new A.NoSuchMethodError(receiver, memberName, positionalArguments, namedArguments, existingArgumentNames);
+ NoSuchMethodError_NoSuchMethodError$withInvocation(receiver, invocation) {
+ return new A.NoSuchMethodError(receiver, invocation.get$memberName(), invocation.get$positionalArguments(), invocation.get$namedArguments());
+ },
+ StackTrace_current() {
+ return A.getTraceFromException(new Error());
},
DateTime__fourDigits(n) {
var absN = Math.abs(n),
@@ -3977,7 +4266,12 @@
return J.toString$0$(object);
if (typeof object == "string")
return JSON.stringify(object);
- return A.Error__objectToString(object);
+ return A.Primitives_safeToString(object);
+ },
+ Error_throwWithStackTrace(error, stackTrace) {
+ A.checkNotNullable(error, "error", type$.Object);
+ A.checkNotNullable(stackTrace, "stackTrace", type$.StackTrace);
+ A.Error__throw(error, stackTrace);
},
AssertionError$(message) {
return new A.AssertionError(message);
@@ -4030,25 +4324,138 @@
FormatException$(message, source, offset) {
return new A.FormatException(message, source, offset);
},
- Object_hash(object1, object2, object3, object4) {
- var t2,
- t1 = B.JSNumber_methods.get$hashCode(object1);
- object2 = B.JSNumber_methods.get$hashCode(object2);
- object3 = B.JSNumber_methods.get$hashCode(object3);
- object4 = B.JSNumber_methods.get$hashCode(object4);
- t2 = $.$get$_hashSeed();
- return A.SystemHash_finish(A.SystemHash_combine(A.SystemHash_combine(A.SystemHash_combine(A.SystemHash_combine(t2, t1), object2), object3), object4));
+ Iterable_iterableToShortString(iterable, leftDelimiter, rightDelimiter) {
+ var parts, t1;
+ if (A.isToStringVisiting(iterable)) {
+ if (leftDelimiter === "(" && rightDelimiter === ")")
+ return "(...)";
+ return leftDelimiter + "..." + rightDelimiter;
+ }
+ parts = A._setArrayType([], type$.JSArray_String);
+ B.JSArray_methods.add$1($.toStringVisiting, iterable);
+ try {
+ A._iterablePartsToStrings(iterable, parts);
+ } finally {
+ if (0 >= $.toStringVisiting.length)
+ return A.ioore($.toStringVisiting, -1);
+ $.toStringVisiting.pop();
+ }
+ t1 = A.StringBuffer__writeAll(leftDelimiter, type$.Iterable_dynamic._as(parts), ", ") + rightDelimiter;
+ return t1.charCodeAt(0) == 0 ? t1 : t1;
+ },
+ Iterable_iterableToFullString(iterable, leftDelimiter, rightDelimiter) {
+ var buffer, t1;
+ if (A.isToStringVisiting(iterable))
+ return leftDelimiter + "..." + rightDelimiter;
+ buffer = new A.StringBuffer(leftDelimiter);
+ B.JSArray_methods.add$1($.toStringVisiting, iterable);
+ try {
+ t1 = buffer;
+ t1._contents = A.StringBuffer__writeAll(t1._contents, iterable, ", ");
+ } finally {
+ if (0 >= $.toStringVisiting.length)
+ return A.ioore($.toStringVisiting, -1);
+ $.toStringVisiting.pop();
+ }
+ buffer._contents += rightDelimiter;
+ t1 = buffer._contents;
+ return t1.charCodeAt(0) == 0 ? t1 : t1;
+ },
+ _iterablePartsToStrings(iterable, parts) {
+ var next, ultimateString, penultimateString, penultimate, ultimate, ultimate0, elision,
+ it = iterable.get$iterator(iterable),
+ $length = 0, count = 0;
+ while (true) {
+ if (!($length < 80 || count < 3))
+ break;
+ if (!it.moveNext$0())
+ return;
+ next = A.S(it.get$current());
+ B.JSArray_methods.add$1(parts, next);
+ $length += next.length + 2;
+ ++count;
+ }
+ if (!it.moveNext$0()) {
+ if (count <= 5)
+ return;
+ if (0 >= parts.length)
+ return A.ioore(parts, -1);
+ ultimateString = parts.pop();
+ if (0 >= parts.length)
+ return A.ioore(parts, -1);
+ penultimateString = parts.pop();
+ } else {
+ penultimate = it.get$current();
+ ++count;
+ if (!it.moveNext$0()) {
+ if (count <= 4) {
+ B.JSArray_methods.add$1(parts, A.S(penultimate));
+ return;
+ }
+ ultimateString = A.S(penultimate);
+ if (0 >= parts.length)
+ return A.ioore(parts, -1);
+ penultimateString = parts.pop();
+ $length += ultimateString.length + 2;
+ } else {
+ ultimate = it.get$current();
+ ++count;
+ for (; it.moveNext$0(); penultimate = ultimate, ultimate = ultimate0) {
+ ultimate0 = it.get$current();
+ ++count;
+ if (count > 100) {
+ while (true) {
+ if (!($length > 75 && count > 3))
+ break;
+ if (0 >= parts.length)
+ return A.ioore(parts, -1);
+ $length -= parts.pop().length + 2;
+ --count;
+ }
+ B.JSArray_methods.add$1(parts, "...");
+ return;
+ }
+ }
+ penultimateString = A.S(penultimate);
+ ultimateString = A.S(ultimate);
+ $length += ultimateString.length + penultimateString.length + 4;
+ }
+ }
+ if (count > parts.length + 2) {
+ $length += 5;
+ elision = "...";
+ } else
+ elision = null;
+ while (true) {
+ if (!($length > 80 && parts.length > 3))
+ break;
+ if (0 >= parts.length)
+ return A.ioore(parts, -1);
+ $length -= parts.pop().length + 2;
+ if (elision == null) {
+ $length += 5;
+ elision = "...";
+ }
+ }
+ if (elision != null)
+ B.JSArray_methods.add$1(parts, elision);
+ B.JSArray_methods.add$1(parts, penultimateString);
+ B.JSArray_methods.add$1(parts, ultimateString);
},
- print(object) {
- A.printString(object);
+ Object_hash(object1, object2) {
+ var t1 = B.JSInt_methods.get$hashCode(object1);
+ object2 = B.JSInt_methods.get$hashCode(object2);
+ object2 = A.SystemHash_finish(A.SystemHash_combine(A.SystemHash_combine($.$get$_hashSeed(), t1), object2));
+ return object2;
},
NoSuchMethodError_toString_closure: function NoSuchMethodError_toString_closure(t0, t1) {
this._box_0 = t0;
this.sb = t1;
},
- DateTime: function DateTime(t0, t1) {
+ DateTime: function DateTime(t0, t1, t2) {
this._value = t0;
- this.isUtc = t1;
+ this._microsecond = t1;
+ this.isUtc = t2;
},
_Enum: function _Enum() {
},
@@ -4059,8 +4466,6 @@
},
TypeError: function TypeError() {
},
- NullThrownError: function NullThrownError() {
- },
ArgumentError: function ArgumentError(t0, t1, t2, t3) {
var _ = this;
_._hasValue = t0;
@@ -4085,13 +4490,12 @@
_.name = t3;
_.message = t4;
},
- NoSuchMethodError: function NoSuchMethodError(t0, t1, t2, t3, t4) {
+ NoSuchMethodError: function NoSuchMethodError(t0, t1, t2, t3) {
var _ = this;
_._core$_receiver = t0;
_._core$_memberName = t1;
_._core$_arguments = t2;
_._namedArguments = t3;
- _._existingArgumentNames = t4;
},
UnsupportedError: function UnsupportedError(t0) {
this.message = t0;
@@ -4109,9 +4513,6 @@
},
StackOverflowError: function StackOverflowError() {
},
- CyclicInitializationError: function CyclicInitializationError(t0) {
- this.variableName = t0;
- },
_Exception: function _Exception(t0) {
this.message = t0;
},
@@ -4122,8 +4523,6 @@
},
Iterable: function Iterable() {
},
- Iterator: function Iterator() {
- },
Null: function Null() {
},
Object: function Object() {
@@ -4133,357 +4532,59 @@
StringBuffer: function StringBuffer(t0) {
this._contents = t0;
},
- _EventStreamSubscription$(_target, _eventType, onData, _useCapture, $T) {
- var t1 = A._wrapZone(new A._EventStreamSubscription_closure(onData), type$.Event);
- if (t1 != null && true)
- B.DedicatedWorkerGlobalScope_methods.addEventListener$3(_target, _eventType, t1, false);
- return new A._EventStreamSubscription(_target, _eventType, t1, false, $T._eval$1("_EventStreamSubscription<0>"));
- },
- _wrapZone(callback, $T) {
- var t1 = $.Zone__current;
- if (t1 === B.C__RootZone)
- return callback;
- return t1.bindUnaryCallbackGuarded$1$1(callback, $T);
+ _convertDartFunctionFast(f) {
+ var ret,
+ existing = f.$dart_jsFunction;
+ if (existing != null)
+ return existing;
+ ret = function(_call, f) {
+ return function() {
+ return _call(f, Array.prototype.slice.apply(arguments));
+ };
+ }(A._callDartFunctionFast, f);
+ ret[$.$get$DART_CLOSURE_PROPERTY_NAME()] = f;
+ f.$dart_jsFunction = ret;
+ return ret;
},
- HtmlElement: function HtmlElement() {
+ _callDartFunctionFast(callback, $arguments) {
+ type$.List_dynamic._as($arguments);
+ type$.Function._as(callback);
+ return A.Primitives_applyFunction(callback, $arguments, null);
},
- AccessibleNodeList: function AccessibleNodeList() {
+ allowInterop(f, $F) {
+ if (typeof f == "function")
+ return f;
+ else
+ return $F._as(A._convertDartFunctionFast(f));
},
- AnchorElement: function AnchorElement() {
+ _functionToJS1(f) {
+ var result;
+ if (typeof f == "function")
+ throw A.wrapException(A.ArgumentError$("Attempting to rewrap a JS function.", null));
+ result = function(_call, f) {
+ return function(arg1) {
+ return _call(f, arg1, arguments.length);
+ };
+ }(A._callDartFunctionFast1, f);
+ result[$.$get$DART_CLOSURE_PROPERTY_NAME()] = f;
+ return result;
},
- AreaElement: function AreaElement() {
+ _callDartFunctionFast1(callback, arg1, $length) {
+ type$.Function._as(callback);
+ if (A._asInt($length) >= 1)
+ return callback.call$1(arg1);
+ return callback.call$0();
},
- Blob: function Blob() {
+ _noJsifyRequired(o) {
+ return o == null || A._isBool(o) || typeof o == "number" || typeof o == "string" || type$.Int8List._is(o) || type$.Uint8List._is(o) || type$.Uint8ClampedList._is(o) || type$.Int16List._is(o) || type$.Uint16List._is(o) || type$.Int32List._is(o) || type$.Uint32List._is(o) || type$.Float32List._is(o) || type$.Float64List._is(o) || type$.ByteBuffer._is(o) || type$.ByteData._is(o);
},
- CharacterData: function CharacterData() {
+ jsify(object) {
+ if (A._noJsifyRequired(object))
+ return object;
+ return new A.jsify__convert(new A._IdentityHashMap(type$._IdentityHashMap_of_nullable_Object_and_nullable_Object)).call$1(object);
},
- CryptoKey: function CryptoKey() {
- },
- CssPerspective: function CssPerspective() {
- },
- CssRule: function CssRule() {
- },
- CssStyleDeclaration: function CssStyleDeclaration() {
- },
- CssStyleDeclarationBase: function CssStyleDeclarationBase() {
- },
- CssStyleValue: function CssStyleValue() {
- },
- CssTransformComponent: function CssTransformComponent() {
- },
- CssTransformValue: function CssTransformValue() {
- },
- CssUnparsedValue: function CssUnparsedValue() {
- },
- DataTransferItem: function DataTransferItem() {
- },
- DataTransferItemList: function DataTransferItemList() {
- },
- DedicatedWorkerGlobalScope: function DedicatedWorkerGlobalScope() {
- },
- DomException: function DomException() {
- },
- DomRectList: function DomRectList() {
- },
- DomRectReadOnly: function DomRectReadOnly() {
- },
- DomStringList: function DomStringList() {
- },
- DomTokenList: function DomTokenList() {
- },
- Element: function Element() {
- },
- Event: function Event() {
- },
- EventTarget: function EventTarget() {
- },
- File: function File() {
- },
- FileList: function FileList() {
- },
- FileWriter: function FileWriter() {
- },
- FormElement: function FormElement() {
- },
- Gamepad: function Gamepad() {
- },
- History: function History() {
- },
- HtmlCollection: function HtmlCollection() {
- },
- ImageData: function ImageData() {
- },
- Location: function Location() {
- },
- MediaDeviceInfo: function MediaDeviceInfo() {
- },
- MediaList: function MediaList() {
- },
- MediaStreamTrack: function MediaStreamTrack() {
- },
- MessageEvent: function MessageEvent() {
- },
- MessagePort: function MessagePort() {
- },
- MidiInputMap: function MidiInputMap() {
- },
- MidiInputMap_keys_closure: function MidiInputMap_keys_closure(t0) {
- this.keys = t0;
- },
- MidiOutputMap: function MidiOutputMap() {
- },
- MidiOutputMap_keys_closure: function MidiOutputMap_keys_closure(t0) {
- this.keys = t0;
- },
- MimeType: function MimeType() {
- },
- MimeTypeArray: function MimeTypeArray() {
- },
- Node: function Node() {
- },
- NodeList: function NodeList() {
- },
- Plugin: function Plugin() {
- },
- PluginArray: function PluginArray() {
- },
- RtcStatsReport: function RtcStatsReport() {
- },
- RtcStatsReport_keys_closure: function RtcStatsReport_keys_closure(t0) {
- this.keys = t0;
- },
- SelectElement: function SelectElement() {
- },
- SharedArrayBuffer: function SharedArrayBuffer() {
- },
- SourceBuffer: function SourceBuffer() {
- },
- SourceBufferList: function SourceBufferList() {
- },
- SpeechGrammar: function SpeechGrammar() {
- },
- SpeechGrammarList: function SpeechGrammarList() {
- },
- SpeechRecognitionResult: function SpeechRecognitionResult() {
- },
- Storage: function Storage() {
- },
- Storage_keys_closure: function Storage_keys_closure(t0) {
- this.keys = t0;
- },
- StyleSheet: function StyleSheet() {
- },
- TextTrack: function TextTrack() {
- },
- TextTrackCue: function TextTrackCue() {
- },
- TextTrackCueList: function TextTrackCueList() {
- },
- TextTrackList: function TextTrackList() {
- },
- TimeRanges: function TimeRanges() {
- },
- Touch: function Touch() {
- },
- TouchList: function TouchList() {
- },
- TrackDefaultList: function TrackDefaultList() {
- },
- TrackElement: function TrackElement() {
- },
- Url: function Url() {
- },
- VideoTrack: function VideoTrack() {
- },
- VideoTrackList: function VideoTrackList() {
- },
- WorkerGlobalScope: function WorkerGlobalScope() {
- },
- _CssRuleList: function _CssRuleList() {
- },
- _DomRect: function _DomRect() {
- },
- _GamepadList: function _GamepadList() {
- },
- _NamedNodeMap: function _NamedNodeMap() {
- },
- _SpeechRecognitionResultList: function _SpeechRecognitionResultList() {
- },
- _StyleSheetList: function _StyleSheetList() {
- },
- EventStreamProvider: function EventStreamProvider(t0) {
- this.$ti = t0;
- },
- _EventStream: function _EventStream(t0, t1, t2, t3) {
- var _ = this;
- _._target = t0;
- _._eventType = t1;
- _._useCapture = t2;
- _.$ti = t3;
- },
- _EventStreamSubscription: function _EventStreamSubscription(t0, t1, t2, t3, t4) {
- var _ = this;
- _._target = t0;
- _._eventType = t1;
- _._onData = t2;
- _._useCapture = t3;
- _.$ti = t4;
- },
- _EventStreamSubscription_closure: function _EventStreamSubscription_closure(t0) {
- this.onData = t0;
- },
- ImmutableListMixin: function ImmutableListMixin() {
- },
- FixedSizeListIterator: function FixedSizeListIterator(t0, t1, t2) {
- var _ = this;
- _._array = t0;
- _._html$_length = t1;
- _._position = -1;
- _._html$_current = null;
- _.$ti = t2;
- },
- _CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase: function _CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase() {
- },
- _DomRectList_JavaScriptObject_ListMixin: function _DomRectList_JavaScriptObject_ListMixin() {
- },
- _DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin: function _DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _DomStringList_JavaScriptObject_ListMixin: function _DomStringList_JavaScriptObject_ListMixin() {
- },
- _DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin: function _DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _FileList_JavaScriptObject_ListMixin: function _FileList_JavaScriptObject_ListMixin() {
- },
- _FileList_JavaScriptObject_ListMixin_ImmutableListMixin: function _FileList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _HtmlCollection_JavaScriptObject_ListMixin: function _HtmlCollection_JavaScriptObject_ListMixin() {
- },
- _HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin: function _HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _MidiInputMap_JavaScriptObject_MapMixin: function _MidiInputMap_JavaScriptObject_MapMixin() {
- },
- _MidiOutputMap_JavaScriptObject_MapMixin: function _MidiOutputMap_JavaScriptObject_MapMixin() {
- },
- _MimeTypeArray_JavaScriptObject_ListMixin: function _MimeTypeArray_JavaScriptObject_ListMixin() {
- },
- _MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin: function _MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _NodeList_JavaScriptObject_ListMixin: function _NodeList_JavaScriptObject_ListMixin() {
- },
- _NodeList_JavaScriptObject_ListMixin_ImmutableListMixin: function _NodeList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _PluginArray_JavaScriptObject_ListMixin: function _PluginArray_JavaScriptObject_ListMixin() {
- },
- _PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin: function _PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _RtcStatsReport_JavaScriptObject_MapMixin: function _RtcStatsReport_JavaScriptObject_MapMixin() {
- },
- _SourceBufferList_EventTarget_ListMixin: function _SourceBufferList_EventTarget_ListMixin() {
- },
- _SourceBufferList_EventTarget_ListMixin_ImmutableListMixin: function _SourceBufferList_EventTarget_ListMixin_ImmutableListMixin() {
- },
- _SpeechGrammarList_JavaScriptObject_ListMixin: function _SpeechGrammarList_JavaScriptObject_ListMixin() {
- },
- _SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin: function _SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _Storage_JavaScriptObject_MapMixin: function _Storage_JavaScriptObject_MapMixin() {
- },
- _TextTrackCueList_JavaScriptObject_ListMixin: function _TextTrackCueList_JavaScriptObject_ListMixin() {
- },
- _TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin: function _TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _TextTrackList_EventTarget_ListMixin: function _TextTrackList_EventTarget_ListMixin() {
- },
- _TextTrackList_EventTarget_ListMixin_ImmutableListMixin: function _TextTrackList_EventTarget_ListMixin_ImmutableListMixin() {
- },
- _TouchList_JavaScriptObject_ListMixin: function _TouchList_JavaScriptObject_ListMixin() {
- },
- _TouchList_JavaScriptObject_ListMixin_ImmutableListMixin: function _TouchList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- __CssRuleList_JavaScriptObject_ListMixin: function __CssRuleList_JavaScriptObject_ListMixin() {
- },
- __CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin: function __CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- __GamepadList_JavaScriptObject_ListMixin: function __GamepadList_JavaScriptObject_ListMixin() {
- },
- __GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin: function __GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- __NamedNodeMap_JavaScriptObject_ListMixin: function __NamedNodeMap_JavaScriptObject_ListMixin() {
- },
- __NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin: function __NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- __SpeechRecognitionResultList_JavaScriptObject_ListMixin: function __SpeechRecognitionResultList_JavaScriptObject_ListMixin() {
- },
- __SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin: function __SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- __StyleSheetList_JavaScriptObject_ListMixin: function __StyleSheetList_JavaScriptObject_ListMixin() {
- },
- __StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin: function __StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _convertNativeToDart_Value(value) {
- var values, i;
- if (value == null)
- return value;
- if (typeof value == "string" || typeof value == "number" || A._isBool(value))
- return value;
- if (A.isJavaScriptSimpleObject(value))
- return A.convertNativeToDart_Dictionary(value);
- if (Array.isArray(value)) {
- values = [];
- for (i = 0; i < value.length; ++i)
- values.push(A._convertNativeToDart_Value(value[i]));
- return values;
- }
- return value;
- },
- convertNativeToDart_Dictionary(object) {
- var dict, keys, t1, _i, key;
- if (object == null)
- return null;
- dict = A.LinkedHashMap_LinkedHashMap$_empty(type$.String, type$.dynamic);
- keys = Object.getOwnPropertyNames(object);
- for (t1 = keys.length, _i = 0; _i < keys.length; keys.length === t1 || (0, A.throwConcurrentModificationError)(keys), ++_i) {
- key = keys[_i];
- dict.$indexSet(0, key, A._convertNativeToDart_Value(object[key]));
- }
- return dict;
- },
- isJavaScriptSimpleObject(value) {
- var proto = Object.getPrototypeOf(value);
- return proto === Object.prototype || proto === null;
- },
- _StructuredClone: function _StructuredClone() {
- },
- _StructuredClone_walk_closure: function _StructuredClone_walk_closure(t0, t1) {
- this._box_0 = t0;
- this.$this = t1;
- },
- _StructuredClone_walk_closure0: function _StructuredClone_walk_closure0(t0, t1) {
- this._box_0 = t0;
- this.$this = t1;
- },
- _AcceptStructuredClone: function _AcceptStructuredClone() {
- },
- _AcceptStructuredClone_walk_closure: function _AcceptStructuredClone_walk_closure(t0, t1) {
- this.$this = t0;
- this.map = t1;
- },
- _StructuredCloneDart2Js: function _StructuredCloneDart2Js(t0, t1) {
- this.values = t0;
- this.copies = t1;
- },
- _AcceptStructuredCloneDart2Js: function _AcceptStructuredCloneDart2Js(t0, t1) {
- this.values = t0;
- this.copies = t1;
- this.mustCopy = false;
- },
- jsify(object) {
- return A._convertDataTree(object);
- },
- _convertDataTree(data) {
- var t1 = new A._convertDataTree__convert(new A._IdentityHashMap(type$._IdentityHashMap_dynamic_dynamic)).call$1(data);
- t1.toString;
- return t1;
+ callMethod(o, method, args, $T) {
+ return $T._as(o[method].apply(o, args));
},
promiseToFuture(jsPromise, $T) {
var t1 = new A._Future($.Zone__current, $T._eval$1("_Future<0>")),
@@ -4491,7 +4592,15 @@
jsPromise.then(A.convertDartClosureToJS(new A.promiseToFuture_closure(completer, $T), 1), A.convertDartClosureToJS(new A.promiseToFuture_closure0(completer), 1));
return t1;
},
- _convertDataTree__convert: function _convertDataTree__convert(t0) {
+ _noDartifyRequired(o) {
+ return o == null || typeof o === "boolean" || typeof o === "number" || typeof o === "string" || o instanceof Int8Array || o instanceof Uint8Array || o instanceof Uint8ClampedArray || o instanceof Int16Array || o instanceof Uint16Array || o instanceof Int32Array || o instanceof Uint32Array || o instanceof Float32Array || o instanceof Float64Array || o instanceof ArrayBuffer || o instanceof DataView;
+ },
+ dartify(o) {
+ if (A._noDartifyRequired(o))
+ return o;
+ return new A.dartify_convert(new A._IdentityHashMap(type$._IdentityHashMap_of_nullable_Object_and_nullable_Object)).call$1(o);
+ },
+ jsify__convert: function jsify__convert(t0) {
this._convertedObjects = t0;
},
promiseToFuture_closure: function promiseToFuture_closure(t0, t1) {
@@ -4501,126 +4610,15 @@
promiseToFuture_closure0: function promiseToFuture_closure0(t0) {
this.completer = t0;
},
+ dartify_convert: function dartify_convert(t0) {
+ this._convertedObjects = t0;
+ },
NullRejectionException: function NullRejectionException(t0) {
this.isUndefined = t0;
},
_JSSecureRandom: function _JSSecureRandom(t0) {
this._math$_buffer = t0;
},
- Length: function Length() {
- },
- LengthList: function LengthList() {
- },
- Number: function Number() {
- },
- NumberList: function NumberList() {
- },
- PointList: function PointList() {
- },
- StringList: function StringList() {
- },
- Transform: function Transform() {
- },
- TransformList: function TransformList() {
- },
- _LengthList_JavaScriptObject_ListMixin: function _LengthList_JavaScriptObject_ListMixin() {
- },
- _LengthList_JavaScriptObject_ListMixin_ImmutableListMixin: function _LengthList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _NumberList_JavaScriptObject_ListMixin: function _NumberList_JavaScriptObject_ListMixin() {
- },
- _NumberList_JavaScriptObject_ListMixin_ImmutableListMixin: function _NumberList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _StringList_JavaScriptObject_ListMixin: function _StringList_JavaScriptObject_ListMixin() {
- },
- _StringList_JavaScriptObject_ListMixin_ImmutableListMixin: function _StringList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- _TransformList_JavaScriptObject_ListMixin: function _TransformList_JavaScriptObject_ListMixin() {
- },
- _TransformList_JavaScriptObject_ListMixin_ImmutableListMixin: function _TransformList_JavaScriptObject_ListMixin_ImmutableListMixin() {
- },
- AudioBuffer: function AudioBuffer() {
- },
- AudioParamMap: function AudioParamMap() {
- },
- AudioParamMap_keys_closure: function AudioParamMap_keys_closure(t0) {
- this.keys = t0;
- },
- AudioTrack: function AudioTrack() {
- },
- AudioTrackList: function AudioTrackList() {
- },
- BaseAudioContext: function BaseAudioContext() {
- },
- OfflineAudioContext: function OfflineAudioContext() {
- },
- _AudioParamMap_JavaScriptObject_MapMixin: function _AudioParamMap_JavaScriptObject_MapMixin() {
- },
- WritableStream: function WritableStream() {
- },
- ReadableStream: function ReadableStream() {
- },
- TransformStream: function TransformStream() {
- },
- TransformStreamDefaultController: function TransformStreamDefaultController() {
- },
- EncodedStreams: function EncodedStreams() {
- },
- RTCEncodedFrame: function RTCEncodedFrame() {
- },
- RTCEncodedAudioFrame: function RTCEncodedAudioFrame() {
- },
- RTCEncodedVideoFrame: function RTCEncodedVideoFrame() {
- },
- RTCEncodedFrameMetadata: function RTCEncodedFrameMetadata() {
- },
- RTCEncodedAudioFrameMetadata: function RTCEncodedAudioFrameMetadata() {
- },
- RTCEncodedVideoFrameMetadata: function RTCEncodedVideoFrameMetadata() {
- },
- RTCTransformEvent: function RTCTransformEvent() {
- },
- RTCRtpScriptTransformer: function RTCRtpScriptTransformer() {
- },
- RTCRtpScriptTransform: function RTCRtpScriptTransform() {
- },
- jsArrayBufferFrom(data) {
- if (type$.Uint8List._is(data) && data.byteOffset === 0 && data.byteLength === data.buffer.byteLength)
- return data.buffer;
- return new Uint8Array(A._ensureNativeList(data)).buffer;
- },
- impportKeyFromRawData(secretKeyData, keyUsages, webCryptoAlgorithm) {
- var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.CryptoKey),
- $async$returnValue, t1;
- var $async$impportKeyFromRawData = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
- if ($async$errorCode === 1)
- return A._asyncRethrow($async$result, $async$completer);
- while (true)
- switch ($async$goto) {
- case 0:
- // Function start
- t1 = type$.String;
- $async$returnValue = A.promiseToFuture(self.crypto.subtle.importKey("raw", A.jsArrayBufferFrom(secretKeyData), A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", webCryptoAlgorithm], t1, t1)), false, keyUsages), type$.CryptoKey);
- // goto return
- $async$goto = 1;
- break;
- case 1:
- // return
- return A._asyncReturn($async$returnValue, $async$completer);
- }
- });
- return A._asyncStartSync($async$impportKeyFromRawData, $async$completer);
- },
- Promise: function Promise() {
- },
- Algorithm: function Algorithm() {
- },
- AesGcmParams: function AesGcmParams() {
- },
- KeyOptions$(ratchetSalt, ratchetWindowSize, sharedKey) {
- return new A.KeyOptions(sharedKey, ratchetSalt, ratchetWindowSize);
- },
findNALUIndices(stream) {
var start, pos0, t1, end,
result = A._setArrayType([], type$.JSArray_int),
@@ -4662,52 +4660,123 @@
}
return result;
},
- Cryptor$(keyOptions, participantId, trackId, worker) {
- var t1 = type$.int;
- return new A.Cryptor(A.LinkedHashMap_LinkedHashMap$_empty(t1, t1), participantId, trackId, keyOptions, B.CryptorError_0, worker, A.List_List$filled(16, null, false, type$.nullable_KeySet));
- },
- KeyOptions: function KeyOptions(t0, t1, t2) {
- this.sharedKey = t0;
- this.ratchetSalt = t1;
- this.ratchetWindowSize = t2;
- },
CryptorError: function CryptorError(t0) {
this._name = t0;
},
- KeySet: function KeySet(t0, t1) {
- this.material = t0;
- this.encryptionKey = t1;
+ FrameInfo: function FrameInfo(t0, t1, t2, t3) {
+ var _ = this;
+ _.frameType = t0;
+ _.ssrc = t1;
+ _.timestamp = t2;
+ _.buffer = t3;
},
- Cryptor: function Cryptor(t0, t1, t2, t3, t4, t5, t6) {
+ FrameCryptor: function FrameCryptor(t0, t1, t2, t3, t4, t5, t6) {
var _ = this;
_.sendCounts = t0;
- _.participantId = t1;
+ _.participantIdentity = t1;
_.trackId = t2;
_.codec = null;
- _.keyOptions = t3;
- _.__Cryptor_kind_A = $;
- _.enabled = false;
+ _.keyHandler = t3;
+ _.__FrameCryptor_kind_A = $;
+ _._enabled = false;
_.lastError = t4;
- _.worker = t5;
_.currentKeyIndex = 0;
- _._ratchetCompleter = null;
- _.cryptoKeyRing = t6;
+ _.worker = t5;
+ _.sifGuard = t6;
},
- Cryptor_ratchetKey_closure: function Cryptor_ratchetKey_closure(t0, t1) {
- this.$this = t0;
- this.keyIndex = t1;
+ FrameCryptor_decodeFunction_decryptFrameInternal: function FrameCryptor_decodeFunction_decryptFrameInternal(t0, t1, t2, t3, t4, t5, t6) {
+ var _ = this;
+ _._box_1 = t0;
+ _._box_0 = t1;
+ _.$this = t2;
+ _.iv = t3;
+ _.srcFrame = t4;
+ _.headerLength = t5;
+ _.ivLength = t6;
+ },
+ FrameCryptor_decodeFunction_ratchedKeyInternal: function FrameCryptor_decodeFunction_ratchedKeyInternal(t0, t1, t2, t3) {
+ var _ = this;
+ _._box_1 = t0;
+ _._box_0 = t1;
+ _.$this = t2;
+ _.decryptFrameInternal = t3;
+ },
+ ParticipantKeyHandler$(keyOptions, participantIdentity, worker) {
+ var t1 = new A.ParticipantKeyHandler(keyOptions, worker, participantIdentity),
+ t2 = keyOptions.keyRingSze;
+ if (t2 <= 0 || t2 > 255)
+ A.throwExpression(A.Exception_Exception("Invalid key ring size"));
+ t1.set$__ParticipantKeyHandler_cryptoKeyRing_A(type$.List_nullable_KeySet._as(A.List_List$filled(t2, null, false, type$.nullable_KeySet)));
+ return t1;
},
- Cryptor_ratchetKey__closure: function Cryptor_ratchetKey__closure(t0, t1) {
- this.$this = t0;
- this.keyIndex = t1;
+ KeyOptions: function KeyOptions(t0, t1, t2, t3, t4, t5, t6) {
+ var _ = this;
+ _.sharedKey = t0;
+ _.ratchetSalt = t1;
+ _.ratchetWindowSize = t2;
+ _.failureTolerance = t3;
+ _.uncryptedMagicBytes = t4;
+ _.keyRingSze = t5;
+ _.discardFrameWhenCryptorNotReady = t6;
+ },
+ KeyProvider: function KeyProvider(t0, t1, t2, t3) {
+ var _ = this;
+ _.worker = t0;
+ _.keyProviderOptions = t1;
+ _.participantKeys = t2;
+ _.sharedKeyHandler = null;
+ _.sharedKey = t3;
},
- Cryptor_ratchetKey___closure: function Cryptor_ratchetKey___closure(t0) {
- this.$this = t0;
+ KeySet: function KeySet(t0, t1) {
+ this.material = t0;
+ this.encryptionKey = t1;
+ },
+ ParticipantKeyHandler: function ParticipantKeyHandler(t0, t1, t2) {
+ var _ = this;
+ _.currentKeyIndex = 0;
+ _.__ParticipantKeyHandler_cryptoKeyRing_A = $;
+ _._hasValidKey = false;
+ _.keyOptions = t0;
+ _.worker = t1;
+ _.participantIdentity = t2;
+ _._decryptionFailureCount = 0;
+ },
+ SifGuard: function SifGuard() {
+ var _ = this;
+ _.consecutiveSifCount = 0;
+ _.sifSequenceStartedAt = null;
+ _.userFramesSinceSif = _.lastSifReceivedAt = 0;
+ },
+ getTrackCryptor(participantIdentity, trackId, keyProvider) {
+ var t1, t2, _null = null,
+ cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.getTrackCryptor_closure(trackId), type$.FrameCryptor);
+ if (cryptor == null) {
+ $.$get$logger().log$4(B.Level_INFO_800, "creating new cryptor for " + participantIdentity + ", trackId " + trackId, _null, _null);
+ t1 = type$.JSObject._as(self.self);
+ t2 = type$.int;
+ cryptor = new A.FrameCryptor(A.LinkedHashMap_LinkedHashMap$_empty(t2, t2), participantIdentity, trackId, keyProvider.getParticipantKeyHandler$1(participantIdentity), B.CryptorError_0, t1, new A.SifGuard());
+ B.JSArray_methods.add$1($.participantCryptors, cryptor);
+ } else if (participantIdentity !== cryptor.participantIdentity) {
+ t1 = keyProvider.getParticipantKeyHandler$1(participantIdentity);
+ if (cryptor.lastError !== B.CryptorError_1) {
+ $.$get$logger().log$4(B.Level_INFO_800, "setParticipantId: lastError != CryptorError.kOk, reset state to kNew", _null, _null);
+ cryptor.lastError = B.CryptorError_0;
+ }
+ cryptor.participantIdentity = participantIdentity;
+ cryptor.keyHandler = t1;
+ cryptor.sifGuard.reset$0();
+ }
+ return cryptor;
+ },
+ unsetCryptorParticipant(trackId) {
+ var t1 = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.unsetCryptorParticipant_closure(trackId), type$.FrameCryptor);
+ if (t1 != null)
+ t1.participantIdentity = null;
},
main() {
var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.dynamic),
- t1, t2;
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ t2, t3, t1;
var $async$main = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
@@ -4715,36 +4784,41 @@
switch ($async$goto) {
case 0:
// Function start
- A.print("E2EE Worker created");
- if (self.self.RTCTransformEvent != null) {
- A.print("setup transform event handler");
- self.self.onrtctransform = A.allowInterop(new A.main_closure(), type$.dynamic_Function_dynamic);
+ t1 = $.$get$Logger_root();
+ if (t1.parent != null)
+ A.throwExpression(A.UnsupportedError$('Please set "hierarchicalLoggingEnabled" to true if you want to change the level on a non-root logger.'));
+ J.$eq$(t1._level, B.Level_WARNING_900);
+ t1._level = B.Level_WARNING_900;
+ t1._getStream$0().listen$1(new A.main_closure());
+ t1 = $.$get$logger();
+ t1.log$4(B.Level_INFO_800, "Worker created", null, null);
+ t2 = self;
+ t3 = type$.JSObject;
+ if ("RTCTransformEvent" in t3._as(t2.self)) {
+ t1.log$4(B.Level_INFO_800, "setup RTCTransformEvent event handler", null, null);
+ t3._as(t2.self).onrtctransform = A._functionToJS1(new A.main_closure0());
}
- t1 = type$.nullable_EventTarget._as(self.self);
- t2 = type$.nullable_void_Function_MessageEvent._as(new A.main_closure0());
- type$.nullable_void_Function._as(null);
- A._EventStreamSubscription$(t1, "message", t2, false, type$.MessageEvent);
+ t3._as(t2.self).onmessage = A._functionToJS1(new A.main_closure1(new A.main_closure2()));
// implicit return
return A._asyncReturn(null, $async$completer);
}
});
return A._asyncStartSync($async$main, $async$completer);
},
- TransformMessage: function TransformMessage() {
- },
- EnableTransformMessage: function EnableTransformMessage() {
+ getTrackCryptor_closure: function getTrackCryptor_closure(t0) {
+ this.trackId = t0;
},
- RemoveTransformMessage: function RemoveTransformMessage() {
+ unsetCryptorParticipant_closure: function unsetCryptorParticipant_closure(t0) {
+ this.trackId = t0;
},
main_closure: function main_closure() {
},
- main__closure8: function main__closure8(t0) {
- this.trackId = t0;
- },
main_closure0: function main_closure0() {
},
- main__closure: function main__closure(t0) {
- this.participantId = t0;
+ main_closure2: function main_closure2() {
+ },
+ main__closure: function main__closure(t0) {
+ this.trackId = t0;
},
main__closure0: function main__closure0(t0) {
this.trackId = t0;
@@ -4753,24 +4827,33 @@
this.trackId = t0;
},
main__closure2: function main__closure2(t0) {
- this.participantId = t0;
+ this.trackId = t0;
},
- main__closure3: function main__closure3(t0) {
- this.participantId = t0;
+ main_closure1: function main_closure1(t0) {
+ this.handleMessage = t0;
},
- main__closure4: function main__closure4(t0, t1, t2) {
- this.c = t0;
- this.keySet = t1;
- this.participantId = t2;
+ Level: function Level(t0, t1) {
+ this.name = t0;
+ this.value = t1;
},
- main__closure5: function main__closure5(t0) {
- this.participantId = t0;
+ LogRecord: function LogRecord(t0, t1, t2) {
+ this.level = t0;
+ this.message = t1;
+ this.loggerName = t2;
},
- main__closure6: function main__closure6(t0) {
- this.trackId = t0;
+ Logger_Logger($name) {
+ return $.Logger__loggers.putIfAbsent$2($name, new A.Logger_Logger_closure($name));
},
- main__closure7: function main__closure7(t0) {
- this.trackId = t0;
+ Logger: function Logger(t0, t1, t2) {
+ var _ = this;
+ _.name = t0;
+ _.parent = t1;
+ _._level = null;
+ _._children = t2;
+ _._controller = null;
+ },
+ Logger_Logger_closure: function Logger_Logger_closure(t0) {
+ this.name = t0;
},
printString(string) {
if (typeof dartPrint == "function") {
@@ -4781,8 +4864,6 @@
console.log(string);
return;
}
- if (typeof window == "object")
- return;
if (typeof print == "function") {
print(string);
return;
@@ -4790,35 +4871,10 @@
throw "Unable to print message: " + String(string);
},
throwLateFieldNI(fieldName) {
- return A.throwExpression(A.LateError$fieldNI(fieldName));
+ A.throwExpressionWithWrapper(new A.LateError("Field '" + fieldName + "' has not been initialized."), new Error());
},
throwLateFieldADI(fieldName) {
- return A.throwExpression(new A.LateError("Field '" + fieldName + "' has been assigned during initialization."));
- },
- _convertDartFunctionFast(f) {
- var ret,
- existing = f.$dart_jsFunction;
- if (existing != null)
- return existing;
- ret = function(_call, f) {
- return function() {
- return _call(f, Array.prototype.slice.apply(arguments));
- };
- }(A._callDartFunctionFast, f);
- ret[$.$get$DART_CLOSURE_PROPERTY_NAME()] = f;
- f.$dart_jsFunction = ret;
- return ret;
- },
- _callDartFunctionFast(callback, $arguments) {
- type$.List_dynamic._as($arguments);
- type$.Function._as(callback);
- return A.Primitives_applyFunction(callback, $arguments, null);
- },
- allowInterop(f, $F) {
- if (typeof f == "function")
- return f;
- else
- return $F._as(A._convertDartFunctionFast(f));
+ A.throwExpressionWithWrapper(new A.LateError("Field '" + fieldName + "' has been assigned during initialization."), new Error());
},
IterableExtension_firstWhereOrNull(_this, test, $T) {
var t1, _i, element;
@@ -4830,265 +4886,16 @@
return null;
},
getAlgoOptions(algorithmName, salt) {
- var t1;
switch (algorithmName) {
case "HKDF":
- t1 = A.jsArrayBufferFrom(salt);
- return A.LinkedHashMap_LinkedHashMap$_literal(["name", "HKDF", "salt", t1, "hash", "SHA-256", "info", A.jsArrayBufferFrom(new Uint8Array(128))], type$.String, type$.Object);
+ return A.LinkedHashMap_LinkedHashMap$_literal(["name", "HKDF", "salt", salt, "hash", "SHA-256", "info", new Uint8Array(128)], type$.String, type$.dynamic);
case "PBKDF2":
- return A.LinkedHashMap_LinkedHashMap$_literal(["name", "PBKDF2", "salt", A.jsArrayBufferFrom(salt), "hash", "SHA-256", "iterations", 100000], type$.String, type$.Object);
+ return A.LinkedHashMap_LinkedHashMap$_literal(["name", "PBKDF2", "salt", salt, "hash", "SHA-256", "iterations", 100000], type$.String, type$.dynamic);
default:
throw A.wrapException(A.Exception_Exception("algorithm " + algorithmName + " is currently unsupported"));
}
}
},
- J = {
- makeDispatchRecord(interceptor, proto, extension, indexability) {
- return {i: interceptor, p: proto, e: extension, x: indexability};
- },
- getNativeInterceptor(object) {
- var proto, objectProto, $constructor, interceptor, t1,
- record = object[init.dispatchPropertyName];
- if (record == null)
- if ($.initNativeDispatchFlag == null) {
- A.initNativeDispatch();
- record = object[init.dispatchPropertyName];
- }
- if (record != null) {
- proto = record.p;
- if (false === proto)
- return record.i;
- if (true === proto)
- return object;
- objectProto = Object.getPrototypeOf(object);
- if (proto === objectProto)
- return record.i;
- if (record.e === objectProto)
- throw A.wrapException(A.UnimplementedError$("Return interceptor for " + A.S(proto(object, record))));
- }
- $constructor = object.constructor;
- if ($constructor == null)
- interceptor = null;
- else {
- t1 = $._JS_INTEROP_INTERCEPTOR_TAG;
- if (t1 == null)
- t1 = $._JS_INTEROP_INTERCEPTOR_TAG = init.getIsolateTag("_$dart_js");
- interceptor = $constructor[t1];
- }
- if (interceptor != null)
- return interceptor;
- interceptor = A.lookupAndCacheInterceptor(object);
- if (interceptor != null)
- return interceptor;
- if (typeof object == "function")
- return B.JavaScriptFunction_methods;
- proto = Object.getPrototypeOf(object);
- if (proto == null)
- return B.PlainJavaScriptObject_methods;
- if (proto === Object.prototype)
- return B.PlainJavaScriptObject_methods;
- if (typeof $constructor == "function") {
- t1 = $._JS_INTEROP_INTERCEPTOR_TAG;
- if (t1 == null)
- t1 = $._JS_INTEROP_INTERCEPTOR_TAG = init.getIsolateTag("_$dart_js");
- Object.defineProperty($constructor, t1, {value: B.UnknownJavaScriptObject_methods, enumerable: false, writable: true, configurable: true});
- return B.UnknownJavaScriptObject_methods;
- }
- return B.UnknownJavaScriptObject_methods;
- },
- JSArray_JSArray$fixed($length, $E) {
- if ($length < 0 || $length > 4294967295)
- throw A.wrapException(A.RangeError$range($length, 0, 4294967295, "length", null));
- return J.JSArray_JSArray$markFixed(new Array($length), $E);
- },
- JSArray_JSArray$markFixed(allocation, $E) {
- return J.JSArray_markFixedList(A._setArrayType(allocation, $E._eval$1("JSArray<0>")), $E);
- },
- JSArray_markFixedList(list, $T) {
- list.fixed$length = Array;
- return list;
- },
- getInterceptor$(receiver) {
- if (typeof receiver == "number") {
- if (Math.floor(receiver) == receiver)
- return J.JSInt.prototype;
- return J.JSNumNotInt.prototype;
- }
- if (typeof receiver == "string")
- return J.JSString.prototype;
- if (receiver == null)
- return J.JSNull.prototype;
- if (typeof receiver == "boolean")
- return J.JSBool.prototype;
- if (receiver.constructor == Array)
- return J.JSArray.prototype;
- if (typeof receiver != "object") {
- if (typeof receiver == "function")
- return J.JavaScriptFunction.prototype;
- return receiver;
- }
- if (receiver instanceof A.Object)
- return receiver;
- return J.getNativeInterceptor(receiver);
- },
- getInterceptor$asx(receiver) {
- if (typeof receiver == "string")
- return J.JSString.prototype;
- if (receiver == null)
- return receiver;
- if (receiver.constructor == Array)
- return J.JSArray.prototype;
- if (typeof receiver != "object") {
- if (typeof receiver == "function")
- return J.JavaScriptFunction.prototype;
- return receiver;
- }
- if (receiver instanceof A.Object)
- return receiver;
- return J.getNativeInterceptor(receiver);
- },
- getInterceptor$ax(receiver) {
- if (receiver == null)
- return receiver;
- if (receiver.constructor == Array)
- return J.JSArray.prototype;
- if (typeof receiver != "object") {
- if (typeof receiver == "function")
- return J.JavaScriptFunction.prototype;
- return receiver;
- }
- if (receiver instanceof A.Object)
- return receiver;
- return J.getNativeInterceptor(receiver);
- },
- getInterceptor$x(receiver) {
- if (receiver == null)
- return receiver;
- if (typeof receiver != "object") {
- if (typeof receiver == "function")
- return J.JavaScriptFunction.prototype;
- return receiver;
- }
- if (receiver instanceof A.Object)
- return receiver;
- return J.getNativeInterceptor(receiver);
- },
- get$data$x(receiver) {
- return J.getInterceptor$x(receiver).get$data(receiver);
- },
- get$hashCode$(receiver) {
- return J.getInterceptor$(receiver).get$hashCode(receiver);
- },
- get$iterator$ax(receiver) {
- return J.getInterceptor$ax(receiver).get$iterator(receiver);
- },
- get$length$asx(receiver) {
- return J.getInterceptor$asx(receiver).get$length(receiver);
- },
- get$name$x(receiver) {
- return J.getInterceptor$x(receiver).get$name(receiver);
- },
- get$synchronizationSource$x(receiver) {
- return J.getInterceptor$x(receiver).get$synchronizationSource(receiver);
- },
- get$type$x(receiver) {
- return J.getInterceptor$x(receiver).get$type(receiver);
- },
- $eq$(receiver, a0) {
- if (receiver == null)
- return a0 == null;
- if (typeof receiver != "object")
- return a0 != null && receiver === a0;
- return J.getInterceptor$(receiver).$eq(receiver, a0);
- },
- $index$asx(receiver, a0) {
- if (typeof a0 === "number")
- if (receiver.constructor == Array || typeof receiver == "string" || A.isJsIndexable(receiver, receiver[init.dispatchPropertyName]))
- if (a0 >>> 0 === a0 && a0 < receiver.length)
- return receiver[a0];
- return J.getInterceptor$asx(receiver).$index(receiver, a0);
- },
- add$1$ax(receiver, a0) {
- return J.getInterceptor$ax(receiver).add$1(receiver, a0);
- },
- elementAt$1$ax(receiver, a0) {
- return J.getInterceptor$ax(receiver).elementAt$1(receiver, a0);
- },
- enqueue$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).enqueue$1(receiver, a0);
- },
- forEach$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).forEach$1(receiver, a0);
- },
- map$1$1$ax(receiver, a0, $T1) {
- return J.getInterceptor$ax(receiver).map$1$1(receiver, a0, $T1);
- },
- noSuchMethod$1$(receiver, a0) {
- return J.getInterceptor$(receiver).noSuchMethod$1(receiver, a0);
- },
- pipeThrough$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).pipeThrough$1(receiver, a0);
- },
- pipeTo$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).pipeTo$1(receiver, a0);
- },
- postMessage$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).postMessage$1(receiver, a0);
- },
- setInt8$2$x(receiver, a0, a1) {
- return J.getInterceptor$x(receiver).setInt8$2(receiver, a0, a1);
- },
- skip$1$ax(receiver, a0) {
- return J.getInterceptor$ax(receiver).skip$1(receiver, a0);
- },
- sublist$1$x(receiver, a0) {
- return J.getInterceptor$x(receiver).sublist$1(receiver, a0);
- },
- sublist$2$x(receiver, a0, a1) {
- return J.getInterceptor$x(receiver).sublist$2(receiver, a0, a1);
- },
- toString$0$(receiver) {
- return J.getInterceptor$(receiver).toString$0(receiver);
- },
- Interceptor: function Interceptor() {
- },
- JSBool: function JSBool() {
- },
- JSNull: function JSNull() {
- },
- JavaScriptObject: function JavaScriptObject() {
- },
- LegacyJavaScriptObject: function LegacyJavaScriptObject() {
- },
- PlainJavaScriptObject: function PlainJavaScriptObject() {
- },
- UnknownJavaScriptObject: function UnknownJavaScriptObject() {
- },
- JavaScriptFunction: function JavaScriptFunction() {
- },
- JSArray: function JSArray(t0) {
- this.$ti = t0;
- },
- JSUnmodifiableArray: function JSUnmodifiableArray(t0) {
- this.$ti = t0;
- },
- ArrayIterator: function ArrayIterator(t0, t1, t2) {
- var _ = this;
- _._iterable = t0;
- _.__interceptors$_length = t1;
- _._index = 0;
- _._current = null;
- _.$ti = t2;
- },
- JSNumber: function JSNumber() {
- },
- JSInt: function JSInt() {
- },
- JSNumNotInt: function JSNumNotInt() {
- },
- JSString: function JSString() {
- }
- },
B = {};
var holders = [A, J, B];
var $ = {};
@@ -5104,8 +4911,10 @@
return "Instance of '" + A.Primitives_objectTypeName(receiver) + "'";
},
noSuchMethod$1(receiver, invocation) {
- type$.Invocation._as(invocation);
- throw A.wrapException(new A.NoSuchMethodError(receiver, invocation.get$memberName(), invocation.get$positionalArguments(), invocation.get$namedArguments(), null));
+ throw A.wrapException(A.NoSuchMethodError_NoSuchMethodError$withInvocation(receiver, type$.Invocation._as(invocation)));
+ },
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(A._instanceTypeFromConstructor(this));
}
};
J.JSBool.prototype = {
@@ -5115,6 +4924,10 @@
get$hashCode(receiver) {
return receiver ? 519018 : 218159;
},
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(type$.bool);
+ },
+ $isTrustedGetRuntimeType: 1,
$isbool: 1
};
J.JSNull.prototype = {
@@ -5127,67 +4940,19 @@
get$hashCode(receiver) {
return 0;
},
+ $isTrustedGetRuntimeType: 1,
$isNull: 1
};
- J.JavaScriptObject.prototype = {};
+ J.JavaScriptObject.prototype = {$isJSObject: 1};
J.LegacyJavaScriptObject.prototype = {
get$hashCode(receiver) {
return 0;
},
+ get$runtimeType(receiver) {
+ return B.Type_JSObject_ttY;
+ },
toString$0(receiver) {
return String(receiver);
- },
- $isJSObject: 1,
- $isWritableStream: 1,
- $isReadableStream: 1,
- $isTransformStreamDefaultController: 1,
- $isRTCEncodedFrame: 1,
- $isRTCTransformEvent: 1,
- $isAlgorithm: 1,
- pipeThrough$1(receiver, p0) {
- return receiver.pipeThrough(p0);
- },
- pipeTo$1(receiver, p0) {
- return receiver.pipeTo(p0);
- },
- enqueue$1(receiver, p0) {
- return receiver.enqueue(p0);
- },
- get$timestamp(obj) {
- return obj.timestamp;
- },
- get$data(obj) {
- return obj.data;
- },
- set$data(obj, v) {
- return obj.data = v;
- },
- getMetadata$0(receiver) {
- return receiver.getMetadata();
- },
- get$type(obj) {
- return obj.type;
- },
- get$synchronizationSource(obj) {
- return obj.synchronizationSource;
- },
- get$name(obj) {
- return obj.name;
- },
- get$msgType(obj) {
- return obj.msgType;
- },
- get$kind(obj) {
- return obj.kind;
- },
- get$participantId(obj) {
- return obj.participantId;
- },
- get$trackId(obj) {
- return obj.trackId;
- },
- get$codec(obj) {
- return obj.codec;
}
};
J.PlainJavaScriptObject.prototype = {};
@@ -5201,43 +4966,38 @@
},
$isFunction: 1
};
+ J.JavaScriptBigInt.prototype = {
+ get$hashCode(receiver) {
+ return 0;
+ },
+ toString$0(receiver) {
+ return String(receiver);
+ }
+ };
+ J.JavaScriptSymbol.prototype = {
+ get$hashCode(receiver) {
+ return 0;
+ },
+ toString$0(receiver) {
+ return String(receiver);
+ }
+ };
J.JSArray.prototype = {
add$1(receiver, value) {
A._arrayInstanceType(receiver)._precomputed1._as(value);
- if (!!receiver.fixed$length)
- A.throwExpression(A.UnsupportedError$("add"));
+ receiver.$flags & 1 && A.throwUnsupportedOperation(receiver, 29);
receiver.push(value);
},
- _removeWhere$2(receiver, test, removeMatching) {
- var retained, end, i, element, t1;
- A._arrayInstanceType(receiver)._eval$1("bool(1)")._as(test);
- retained = [];
- end = receiver.length;
- for (i = 0; i < end; ++i) {
- element = receiver[i];
- if (!A.boolConversionCheck(test.call$1(element)))
- retained.push(element);
- if (receiver.length !== end)
- throw A.wrapException(A.ConcurrentModificationError$(receiver));
- }
- t1 = retained.length;
- if (t1 === end)
- return;
- this.set$length(receiver, t1);
- for (i = 0; i < retained.length; ++i)
- receiver[i] = retained[i];
- },
addAll$1(receiver, collection) {
var t1;
A._arrayInstanceType(receiver)._eval$1("Iterable<1>")._as(collection);
- if (!!receiver.fixed$length)
- A.throwExpression(A.UnsupportedError$("addAll"));
+ receiver.$flags & 1 && A.throwUnsupportedOperation(receiver, "addAll", 2);
if (Array.isArray(collection)) {
this._addAllFromArray$1(receiver, collection);
return;
}
for (t1 = J.get$iterator$ax(collection); t1.moveNext$0();)
- receiver.push(t1.get$current(t1));
+ receiver.push(t1.get$current());
},
_addAllFromArray$1(receiver, array) {
var len, i;
@@ -5254,16 +5014,13 @@
var t1 = A._arrayInstanceType(receiver);
return new A.MappedListIterable(receiver, t1._bind$1($T)._eval$1("1(2)")._as(f), t1._eval$1("@<1>")._bind$1($T)._eval$1("MappedListIterable<1,2>"));
},
- skip$1(receiver, n) {
- return A.SubListIterable$(receiver, n, null, A._arrayInstanceType(receiver)._precomputed1);
- },
elementAt$1(receiver, index) {
if (!(index >= 0 && index < receiver.length))
return A.ioore(receiver, index);
return receiver[index];
},
toString$0(receiver) {
- return A.IterableBase_iterableToFullString(receiver, "[", "]");
+ return A.Iterable_iterableToFullString(receiver, "[", "]");
},
get$iterator(receiver) {
return new J.ArrayIterator(receiver, receiver.length, A._arrayInstanceType(receiver)._eval$1("ArrayIterator<1>"));
@@ -5274,13 +5031,6 @@
get$length(receiver) {
return receiver.length;
},
- set$length(receiver, newLength) {
- if (!!receiver.fixed$length)
- A.throwExpression(A.UnsupportedError$("set length"));
- if (newLength > receiver.length)
- A._arrayInstanceType(receiver)._precomputed1._as(null);
- receiver.length = newLength;
- },
$index(receiver, index) {
A._asInt(index);
if (!(index >= 0 && index < receiver.length))
@@ -5289,20 +5039,21 @@
},
$indexSet(receiver, index, value) {
A._arrayInstanceType(receiver)._precomputed1._as(value);
- if (!!receiver.immutable$list)
- A.throwExpression(A.UnsupportedError$("indexed set"));
+ receiver.$flags & 2 && A.throwUnsupportedOperation(receiver);
if (!(index >= 0 && index < receiver.length))
throw A.wrapException(A.diagnoseIndexError(receiver, index));
receiver[index] = value;
},
- $isJSIndexable: 1,
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(A._arrayInstanceType(receiver));
+ },
$isEfficientLengthIterable: 1,
$isIterable: 1,
$isList: 1
};
J.JSUnmodifiableArray.prototype = {};
J.ArrayIterator.prototype = {
- get$current(_) {
+ get$current() {
var t1 = this._current;
return t1 == null ? this.$ti._precomputed1._as(t1) : t1;
},
@@ -5310,8 +5061,10 @@
var t2, _this = this,
t1 = _this._iterable,
$length = t1.length;
- if (_this.__interceptors$_length !== $length)
- throw A.wrapException(A.throwConcurrentModificationError(t1));
+ if (_this._length !== $length) {
+ t1 = A.throwConcurrentModificationError(t1);
+ throw A.wrapException(t1);
+ }
t2 = _this._index;
if (t2 >= $length) {
_this.set$_current(null);
@@ -5327,12 +5080,26 @@
$isIterator: 1
};
J.JSNumber.prototype = {
+ toInt$0(receiver) {
+ var t1;
+ if (receiver >= -2147483648 && receiver <= 2147483647)
+ return receiver | 0;
+ if (isFinite(receiver)) {
+ t1 = receiver < 0 ? Math.ceil(receiver) : Math.floor(receiver);
+ return t1 + 0;
+ }
+ throw A.wrapException(A.UnsupportedError$("" + receiver + ".toInt()"));
+ },
toRadixString$1(receiver, radix) {
- var result, match, t1, exponent;
+ var result, t1, t2, match, exponent;
if (radix < 2 || radix > 36)
throw A.wrapException(A.RangeError$range(radix, 2, 36, "radix", null));
result = receiver.toString(radix);
- if (B.JSString_methods.codeUnitAt$1(result, result.length - 1) !== 41)
+ t1 = result.length;
+ t2 = t1 - 1;
+ if (!(t2 >= 0))
+ return A.ioore(result, t2);
+ if (result.charCodeAt(t2) !== 41)
return result;
match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result);
if (match == null)
@@ -5403,30 +5170,45 @@
_shrBothPositive$1(receiver, other) {
return other > 31 ? 0 : receiver >>> other;
},
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(type$.num);
+ },
$isdouble: 1,
$isnum: 1
};
- J.JSInt.prototype = {$isint: 1};
- J.JSNumNotInt.prototype = {};
- J.JSString.prototype = {
- codeUnitAt$1(receiver, index) {
- if (index < 0)
- throw A.wrapException(A.diagnoseIndexError(receiver, index));
- if (index >= receiver.length)
- A.throwExpression(A.diagnoseIndexError(receiver, index));
- return receiver.charCodeAt(index);
+ J.JSInt.prototype = {
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(type$.int);
},
- _codeUnitAt$1(receiver, index) {
- if (index >= receiver.length)
- throw A.wrapException(A.diagnoseIndexError(receiver, index));
- return receiver.charCodeAt(index);
+ $isTrustedGetRuntimeType: 1,
+ $isint: 1
+ };
+ J.JSNumNotInt.prototype = {
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(type$.double);
+ },
+ $isTrustedGetRuntimeType: 1
+ };
+ J.JSString.prototype = {
+ endsWith$1(receiver, other) {
+ var otherLength = other.length,
+ t1 = receiver.length;
+ if (otherLength > t1)
+ return false;
+ return other === this.substring$1(receiver, t1 - otherLength);
},
- $add(receiver, other) {
- return receiver + other;
+ startsWith$1(receiver, pattern) {
+ var otherLength = pattern.length;
+ if (otherLength > receiver.length)
+ return false;
+ return pattern === receiver.substring(0, otherLength);
},
substring$2(receiver, start, end) {
return receiver.substring(start, A.RangeError_checkValidRange(start, end, receiver.length));
},
+ substring$1(receiver, start) {
+ return this.substring$2(receiver, start, null);
+ },
$mul(receiver, times) {
var s, result;
if (0 >= times)
@@ -5445,6 +5227,13 @@
}
return result;
},
+ lastIndexOf$1(receiver, pattern) {
+ var start = receiver.length,
+ t1 = pattern.length;
+ if (start + t1 > start)
+ start -= t1;
+ return receiver.lastIndexOf(pattern, start);
+ },
toString$0(receiver) {
return receiver;
},
@@ -5459,6 +5248,9 @@
hash ^= hash >> 11;
return hash + ((hash & 16383) << 15) & 536870911;
},
+ get$runtimeType(receiver) {
+ return A.createRuntimeType(type$.String);
+ },
get$length(receiver) {
return receiver.length;
},
@@ -5468,7 +5260,8 @@
throw A.wrapException(A.diagnoseIndexError(receiver, index));
return receiver[index];
},
- $isJSIndexable: 1,
+ $isTrustedGetRuntimeType: 1,
+ $isPattern: 1,
$isString: 1
};
A._CopyingBytesBuilder.prototype = {
@@ -5502,30 +5295,21 @@
_this.__internal$_length = required;
},
toBytes$0() {
- var t2,
- t1 = this.__internal$_length;
- if (t1 === 0)
+ var _this = this;
+ if (_this.__internal$_length === 0)
return $.$get$_CopyingBytesBuilder__emptyList();
- t2 = this._buffer;
- return new Uint8Array(A._ensureNativeList(A.NativeUint8List_NativeUint8List$view(t2.buffer, t2.byteOffset, t1)));
+ return new Uint8Array(A._ensureNativeList(J.asUint8List$2$x(B.NativeUint8List_methods.get$buffer(_this._buffer), _this._buffer.byteOffset, _this.__internal$_length)));
},
get$length(_) {
return this.__internal$_length;
- }
+ },
+ $isBytesBuilder: 1
};
A.LateError.prototype = {
toString$0(_) {
return "LateInitializationError: " + this._message;
}
};
- A.CodeUnits.prototype = {
- get$length(_) {
- return this._string.length;
- },
- $index(_, i) {
- return B.JSString_methods.codeUnitAt$1(this._string, A._asInt(i));
- }
- };
A.SentinelValue.prototype = {};
A.EfficientLengthIterable.prototype = {};
A.ListIterable.prototype = {
@@ -5538,66 +5322,8 @@
return new A.MappedListIterable(this, t1._bind$1($T)._eval$1("1(ListIterable.E)")._as(toElement), t1._eval$1("@")._bind$1($T)._eval$1("MappedListIterable<1,2>"));
}
};
- A.SubListIterable.prototype = {
- get$_endIndex() {
- var $length = J.get$length$asx(this.__internal$_iterable),
- endOrLength = this._endOrLength;
- if (endOrLength == null || endOrLength > $length)
- return $length;
- return endOrLength;
- },
- get$_startIndex() {
- var $length = J.get$length$asx(this.__internal$_iterable),
- t1 = this._start;
- if (t1 > $length)
- return $length;
- return t1;
- },
- get$length(_) {
- var endOrLength,
- $length = J.get$length$asx(this.__internal$_iterable),
- t1 = this._start;
- if (t1 >= $length)
- return 0;
- endOrLength = this._endOrLength;
- if (endOrLength == null || endOrLength >= $length)
- return $length - t1;
- if (typeof endOrLength !== "number")
- return endOrLength.$sub();
- return endOrLength - t1;
- },
- elementAt$1(_, index) {
- var _this = this,
- realIndex = _this.get$_startIndex() + index;
- if (index < 0 || realIndex >= _this.get$_endIndex())
- throw A.wrapException(A.IndexError$withLength(index, _this.get$length(_this), _this, "index"));
- return J.elementAt$1$ax(_this.__internal$_iterable, realIndex);
- },
- toList$1$growable(_, growable) {
- var $length, result, i, _this = this,
- start = _this._start,
- t1 = _this.__internal$_iterable,
- t2 = J.getInterceptor$asx(t1),
- end = t2.get$length(t1),
- endOrLength = _this._endOrLength;
- if (endOrLength != null && endOrLength < end)
- end = endOrLength;
- $length = end - start;
- if ($length <= 0) {
- t1 = J.JSArray_JSArray$fixed(0, _this.$ti._precomputed1);
- return t1;
- }
- result = A.List_List$filled($length, t2.elementAt$1(t1, start), false, _this.$ti._precomputed1);
- for (i = 1; i < $length; ++i) {
- B.JSArray_methods.$indexSet(result, i, t2.elementAt$1(t1, start + i));
- if (t2.get$length(t1) < end)
- throw A.wrapException(A.ConcurrentModificationError$(_this));
- }
- return result;
- }
- };
A.ListIterator.prototype = {
- get$current(_) {
+ get$current() {
var t1 = this.__internal$_current;
return t1 == null ? this.$ti._precomputed1._as(t1) : t1;
},
@@ -5624,9 +5350,8 @@
};
A.MappedIterable.prototype = {
get$iterator(_) {
- var t1 = this.__internal$_iterable,
- t2 = A._instanceType(this);
- return new A.MappedIterator(t1.get$iterator(t1), this._f, t2._eval$1("@<1>")._bind$1(t2._rest[1])._eval$1("MappedIterator<1,2>"));
+ var t1 = this.__internal$_iterable;
+ return new A.MappedIterator(t1.get$iterator(t1), this._f, A._instanceType(this)._eval$1("MappedIterator<1,2>"));
},
get$length(_) {
var t1 = this.__internal$_iterable;
@@ -5639,19 +5364,20 @@
var _this = this,
t1 = _this._iterator;
if (t1.moveNext$0()) {
- _this.set$__internal$_current(_this._f.call$1(t1.get$current(t1)));
+ _this.set$__internal$_current(_this._f.call$1(t1.get$current()));
return true;
}
_this.set$__internal$_current(null);
return false;
},
- get$current(_) {
+ get$current() {
var t1 = this.__internal$_current;
return t1 == null ? this.$ti._rest[1]._as(t1) : t1;
},
set$__internal$_current(_current) {
this.__internal$_current = this.$ti._eval$1("2?")._as(_current);
- }
+ },
+ $isIterator: 1
};
A.MappedListIterable.prototype = {
get$length(_) {
@@ -5674,39 +5400,32 @@
moveNext$0() {
var t1, t2;
for (t1 = this._iterator, t2 = this._f; t1.moveNext$0();)
- if (A.boolConversionCheck(t2.call$1(t1.get$current(t1))))
+ if (A.boolConversionCheck(t2.call$1(t1.get$current())))
return true;
return false;
},
- get$current(_) {
- var t1 = this._iterator;
- return t1.get$current(t1);
- }
+ get$current() {
+ return this._iterator.get$current();
+ },
+ $isIterator: 1
};
A.FixedLengthListMixin.prototype = {};
- A.UnmodifiableListMixin.prototype = {
- $indexSet(_, index, value) {
- A._instanceType(this)._eval$1("UnmodifiableListMixin.E")._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot modify an unmodifiable list"));
- }
- };
- A.UnmodifiableListBase.prototype = {};
A.Symbol.prototype = {
get$hashCode(_) {
var hash = this._hashCode;
if (hash != null)
return hash;
- hash = 664597 * J.get$hashCode$(this.__internal$_name) & 536870911;
+ hash = 664597 * B.JSString_methods.get$hashCode(this.__internal$_name) & 536870911;
this._hashCode = hash;
return hash;
},
toString$0(_) {
- return 'Symbol("' + A.S(this.__internal$_name) + '")';
+ return 'Symbol("' + this.__internal$_name + '")';
},
$eq(_, other) {
if (other == null)
return false;
- return other instanceof A.Symbol && this.__internal$_name == other.__internal$_name;
+ return other instanceof A.Symbol && this.__internal$_name === other.__internal$_name;
},
$isSymbol0: 1
};
@@ -5719,86 +5438,107 @@
};
A.ConstantStringMap.prototype = {
get$length(_) {
- return this._length;
+ return this._values.length;
},
- containsKey$1(_, key) {
+ get$_keys() {
+ var keys = this.$keys;
+ if (keys == null) {
+ keys = Object.keys(this._jsIndex);
+ this.$keys = keys;
+ }
+ return keys;
+ },
+ containsKey$1(key) {
if (typeof key != "string")
return false;
if ("__proto__" === key)
return false;
- return this._jsObject.hasOwnProperty(key);
+ return this._jsIndex.hasOwnProperty(key);
},
$index(_, key) {
- if (!this.containsKey$1(0, key))
+ if (!this.containsKey$1(key))
return null;
- return this._jsObject[A._asString(key)];
+ return this._values[this._jsIndex[key]];
},
forEach$1(_, f) {
- var keys, t2, t3, i, t4,
- t1 = this.$ti;
- t1._eval$1("~(1,2)")._as(f);
- keys = this.__js_helper$_keys;
- for (t2 = keys.length, t3 = this._jsObject, t1 = t1._rest[1], i = 0; i < t2; ++i) {
- t4 = A._asString(keys[i]);
- f.call$2(t4, t1._as(t3[t4]));
- }
+ var keys, values, t1, i;
+ this.$ti._eval$1("~(1,2)")._as(f);
+ keys = this.get$_keys();
+ values = this._values;
+ for (t1 = keys.length, i = 0; i < t1; ++i)
+ f.call$2(keys[i], values[i]);
},
- get$keys(_) {
- return new A._ConstantMapKeyIterable(this, this.$ti._eval$1("_ConstantMapKeyIterable<1>"));
+ get$keys() {
+ return new A._KeysOrValues(this.get$_keys(), this.$ti._eval$1("_KeysOrValues<1>"));
}
};
- A._ConstantMapKeyIterable.prototype = {
- get$iterator(_) {
- var t1 = this._map.__js_helper$_keys;
- return new J.ArrayIterator(t1, t1.length, A._arrayInstanceType(t1)._eval$1("ArrayIterator<1>"));
- },
+ A._KeysOrValues.prototype = {
get$length(_) {
- return this._map.__js_helper$_keys.length;
+ return this._elements.length;
+ },
+ get$iterator(_) {
+ var t1 = this._elements;
+ return new A._KeysOrValuesOrElementsIterator(t1, t1.length, this.$ti._eval$1("_KeysOrValuesOrElementsIterator<1>"));
}
};
+ A._KeysOrValuesOrElementsIterator.prototype = {
+ get$current() {
+ var t1 = this.__js_helper$_current;
+ return t1 == null ? this.$ti._precomputed1._as(t1) : t1;
+ },
+ moveNext$0() {
+ var _this = this,
+ t1 = _this.__js_helper$_index;
+ if (t1 >= _this.__js_helper$_length) {
+ _this.set$__js_helper$_current(null);
+ return false;
+ }
+ _this.set$__js_helper$_current(_this._elements[t1]);
+ ++_this.__js_helper$_index;
+ return true;
+ },
+ set$__js_helper$_current(_current) {
+ this.__js_helper$_current = this.$ti._eval$1("1?")._as(_current);
+ },
+ $isIterator: 1
+ };
A.JSInvocationMirror.prototype = {
get$memberName() {
var t1 = this._memberName;
- return t1;
+ if (t1 instanceof A.Symbol)
+ return t1;
+ return this._memberName = new A.Symbol(A._asString(t1));
},
get$positionalArguments() {
- var t1, argumentCount, list, index, _this = this;
+ var t1, t2, argumentCount, list, index, _this = this;
if (_this.__js_helper$_kind === 1)
return B.List_empty;
t1 = _this._arguments;
- argumentCount = t1.length - _this._namedArgumentNames.length - _this._typeArgumentCount;
+ t2 = J.getInterceptor$asx(t1);
+ argumentCount = t2.get$length(t1) - J.get$length$asx(_this._namedArgumentNames) - _this._typeArgumentCount;
if (argumentCount === 0)
return B.List_empty;
list = [];
- for (index = 0; index < argumentCount; ++index) {
- if (!(index < t1.length))
- return A.ioore(t1, index);
- list.push(t1[index]);
- }
- list.fixed$length = Array;
- list.immutable$list = Array;
+ for (index = 0; index < argumentCount; ++index)
+ list.push(t2.$index(t1, index));
+ list.$flags = 3;
return list;
},
get$namedArguments() {
- var t1, namedArgumentCount, t2, namedArgumentsStartIndex, map, i, t3, t4, _this = this;
+ var t1, t2, namedArgumentCount, t3, t4, namedArgumentsStartIndex, map, i, _this = this;
if (_this.__js_helper$_kind !== 0)
return B.Map_empty;
t1 = _this._namedArgumentNames;
- namedArgumentCount = t1.length;
- t2 = _this._arguments;
- namedArgumentsStartIndex = t2.length - namedArgumentCount - _this._typeArgumentCount;
+ t2 = J.getInterceptor$asx(t1);
+ namedArgumentCount = t2.get$length(t1);
+ t3 = _this._arguments;
+ t4 = J.getInterceptor$asx(t3);
+ namedArgumentsStartIndex = t4.get$length(t3) - namedArgumentCount - _this._typeArgumentCount;
if (namedArgumentCount === 0)
return B.Map_empty;
map = new A.JsLinkedHashMap(type$.JsLinkedHashMap_Symbol_dynamic);
- for (i = 0; i < namedArgumentCount; ++i) {
- if (!(i < t1.length))
- return A.ioore(t1, i);
- t3 = t1[i];
- t4 = namedArgumentsStartIndex + i;
- if (!(t4 >= 0 && t4 < t2.length))
- return A.ioore(t2, t4);
- map.$indexSet(0, new A.Symbol(t3), t2[t4]);
- }
+ for (i = 0; i < namedArgumentCount; ++i)
+ map.$indexSet(0, new A.Symbol(A._asString(t2.$index(t1, i))), t4.$index(t3, namedArgumentsStartIndex + i));
return new A.ConstantMapView(map, type$.ConstantMapView_Symbol_dynamic);
},
$isInvocation: 1
@@ -5813,7 +5553,7 @@
B.JSArray_methods.add$1(this.$arguments, argument);
++t1.argumentCount;
},
- $signature: 2
+ $signature: 12
};
A.TypeErrorDecoder.prototype = {
matchTypeError$1(message) {
@@ -5842,10 +5582,7 @@
};
A.NullError.prototype = {
toString$0(_) {
- var t1 = this._method;
- if (t1 == null)
- return "NoSuchMethodError: " + this.__js_helper$_message;
- return "NoSuchMethodError: method not found: '" + t1 + "' on null";
+ return "Null check operator used on a null value";
}
};
A.JsNoSuchMethodError.prototype = {
@@ -5927,6 +5664,11 @@
return "Closure '" + this.$_name + "' of " + ("Instance of '" + A.Primitives_objectTypeName(this._receiver) + "'");
}
};
+ A._CyclicInitializationError.prototype = {
+ toString$0(_) {
+ return "Reading static variable '" + this.variableName + "' during its initialization";
+ }
+ };
A.RuntimeError.prototype = {
toString$0(_) {
return "RuntimeError: " + this.message;
@@ -5940,12 +5682,12 @@
A._Required.prototype = {};
A.JsLinkedHashMap.prototype = {
get$length(_) {
- return this._length;
+ return this.__js_helper$_length;
},
- get$keys(_) {
- return new A.LinkedHashMapKeyIterable(this, A._instanceType(this)._eval$1("LinkedHashMapKeyIterable<1>"));
+ get$keys() {
+ return new A.LinkedHashMapKeysIterable(this, A._instanceType(this)._eval$1("LinkedHashMapKeysIterable<1>"));
},
- containsKey$1(_, key) {
+ containsKey$1(key) {
var strings = this._strings;
if (strings == null)
return false;
@@ -5982,38 +5724,49 @@
return bucket[index].hashMapCellValue;
},
$indexSet(_, key, value) {
- var strings, nums, _this = this,
+ var strings, nums, rest, hash, bucket, index, _this = this,
t1 = A._instanceType(_this);
t1._precomputed1._as(key);
t1._rest[1]._as(value);
if (typeof key == "string") {
strings = _this._strings;
- _this._addHashTableEntry$3(strings == null ? _this._strings = _this._newHashTable$0() : strings, key, value);
+ _this.__js_helper$_addHashTableEntry$3(strings == null ? _this._strings = _this._newHashTable$0() : strings, key, value);
} else if (typeof key == "number" && (key & 0x3fffffff) === key) {
nums = _this._nums;
- _this._addHashTableEntry$3(nums == null ? _this._nums = _this._newHashTable$0() : nums, key, value);
- } else
- _this.internalSet$2(key, value);
+ _this.__js_helper$_addHashTableEntry$3(nums == null ? _this._nums = _this._newHashTable$0() : nums, key, value);
+ } else {
+ rest = _this.__js_helper$_rest;
+ if (rest == null)
+ rest = _this.__js_helper$_rest = _this._newHashTable$0();
+ hash = _this.internalComputeHashCode$1(key);
+ bucket = rest[hash];
+ if (bucket == null)
+ rest[hash] = [_this._newLinkedCell$2(key, value)];
+ else {
+ index = _this.internalFindBucketIndex$2(bucket, key);
+ if (index >= 0)
+ bucket[index].hashMapCellValue = value;
+ else
+ bucket.push(_this._newLinkedCell$2(key, value));
+ }
+ }
},
- internalSet$2(key, value) {
- var rest, hash, bucket, index, _this = this,
+ putIfAbsent$2(key, ifAbsent) {
+ var t2, value, _this = this,
t1 = A._instanceType(_this);
t1._precomputed1._as(key);
- t1._rest[1]._as(value);
- rest = _this.__js_helper$_rest;
- if (rest == null)
- rest = _this.__js_helper$_rest = _this._newHashTable$0();
- hash = _this.internalComputeHashCode$1(key);
- bucket = rest[hash];
- if (bucket == null)
- rest[hash] = [_this._newLinkedCell$2(key, value)];
- else {
- index = _this.internalFindBucketIndex$2(bucket, key);
- if (index >= 0)
- bucket[index].hashMapCellValue = value;
- else
- bucket.push(_this._newLinkedCell$2(key, value));
+ t1._eval$1("2()")._as(ifAbsent);
+ if (_this.containsKey$1(key)) {
+ t2 = _this.$index(0, key);
+ return t2 == null ? t1._rest[1]._as(t2) : t2;
}
+ value = ifAbsent.call$0();
+ _this.$indexSet(0, key, value);
+ return value;
+ },
+ remove$1(_, key) {
+ var t1 = this._removeHashTableEntry$2(this._strings, key);
+ return t1;
},
forEach$1(_, action) {
var cell, modifications, _this = this;
@@ -6027,7 +5780,7 @@
cell = cell._next;
}
},
- _addHashTableEntry$3(table, key, value) {
+ __js_helper$_addHashTableEntry$3(table, key, value) {
var cell,
t1 = A._instanceType(this);
t1._precomputed1._as(key);
@@ -6038,20 +5791,53 @@
else
cell.hashMapCellValue = value;
},
+ _removeHashTableEntry$2(table, key) {
+ var cell;
+ if (table == null)
+ return null;
+ cell = table[key];
+ if (cell == null)
+ return null;
+ this._unlinkCell$1(cell);
+ delete table[key];
+ return cell.hashMapCellValue;
+ },
+ _modified$0() {
+ this._modifications = this._modifications + 1 & 1073741823;
+ },
_newLinkedCell$2(key, value) {
var _this = this,
t1 = A._instanceType(_this),
cell = new A.LinkedHashMapCell(t1._precomputed1._as(key), t1._rest[1]._as(value));
if (_this._first == null)
_this._first = _this._last = cell;
- else
- _this._last = _this._last._next = cell;
- ++_this._length;
- _this._modifications = _this._modifications + 1 & 1073741823;
+ else {
+ t1 = _this._last;
+ t1.toString;
+ cell._previous = t1;
+ _this._last = t1._next = cell;
+ }
+ ++_this.__js_helper$_length;
+ _this._modified$0();
return cell;
},
+ _unlinkCell$1(cell) {
+ var _this = this,
+ previous = cell._previous,
+ next = cell._next;
+ if (previous == null)
+ _this._first = next;
+ else
+ previous._next = next;
+ if (next == null)
+ _this._last = previous;
+ else
+ next._previous = previous;
+ --_this.__js_helper$_length;
+ _this._modified$0();
+ },
internalComputeHashCode$1(key) {
- return J.get$hashCode$(key) & 0x3fffffff;
+ return J.get$hashCode$(key) & 1073741823;
},
internalFindBucketIndex$2(bucket, key) {
var $length, i;
@@ -6075,19 +5861,17 @@
$isLinkedHashMap: 1
};
A.LinkedHashMapCell.prototype = {};
- A.LinkedHashMapKeyIterable.prototype = {
+ A.LinkedHashMapKeysIterable.prototype = {
get$length(_) {
- return this._map._length;
+ return this._map.__js_helper$_length;
},
get$iterator(_) {
- var t1 = this._map,
- t2 = new A.LinkedHashMapKeyIterator(t1, t1._modifications, this.$ti._eval$1("LinkedHashMapKeyIterator<1>"));
- t2._cell = t1._first;
- return t2;
+ var t1 = this._map;
+ return new A.LinkedHashMapKeyIterator(t1, t1._modifications, t1._first, this.$ti._eval$1("LinkedHashMapKeyIterator<1>"));
}
};
A.LinkedHashMapKeyIterator.prototype = {
- get$current(_) {
+ get$current() {
return this.__js_helper$_current;
},
moveNext$0() {
@@ -6114,22 +5898,41 @@
call$1(o) {
return this.getTag(o);
},
- $signature: 8
+ $signature: 13
};
A.initHooks_closure0.prototype = {
call$2(o, tag) {
return this.getUnknownTag(o, tag);
},
- $signature: 9
+ $signature: 14
};
A.initHooks_closure1.prototype = {
call$1(tag) {
return this.prototypeForTag(A._asString(tag));
},
- $signature: 10
+ $signature: 15
+ };
+ A.NativeByteBuffer.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_ByteBuffer_rqD;
+ },
+ asUint8List$2(receiver, offsetInBytes, $length) {
+ return $length == null ? new Uint8Array(receiver, offsetInBytes) : new Uint8Array(receiver, offsetInBytes, $length);
+ },
+ asUint8List$0(receiver) {
+ return this.asUint8List$2(receiver, 0, null);
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isNativeByteBuffer: 1,
+ $isByteBuffer: 1
};
- A.NativeByteBuffer.prototype = {$isNativeByteBuffer: 1, $isByteBuffer: 1};
A.NativeTypedData.prototype = {
+ get$buffer(receiver) {
+ if (((receiver.$flags | 0) & 2) !== 0)
+ return new A._UnmodifiableNativeByteBufferView(receiver.buffer);
+ else
+ return receiver.buffer;
+ },
_invalidPosition$3(receiver, position, $length, $name) {
var t1 = A.RangeError$range(position, 0, $length, $name, null);
throw A.wrapException(t1);
@@ -6137,41 +5940,33 @@
_checkPosition$3(receiver, position, $length, $name) {
if (position >>> 0 !== position || position > $length)
this._invalidPosition$3(receiver, position, $length, $name);
+ }
+ };
+ A._UnmodifiableNativeByteBufferView.prototype = {
+ asUint8List$2(_, offsetInBytes, $length) {
+ var result = A.NativeUint8List_NativeUint8List$view(this._data, offsetInBytes, $length);
+ result.$flags = 3;
+ return result;
+ },
+ asUint8List$0(_) {
+ return this.asUint8List$2(0, 0, null);
},
- $isNativeTypedData: 1
+ $isByteBuffer: 1
};
A.NativeByteData.prototype = {
- _getUint32$2(receiver, byteOffset, littleEndian) {
- return receiver.getUint32(byteOffset, littleEndian);
+ get$runtimeType(receiver) {
+ return B.Type_ByteData_9dB;
},
- setInt8$2(receiver, byteOffset, value) {
+ _setInt8$2(receiver, byteOffset, value) {
return receiver.setInt8(byteOffset, value);
},
- _setUint32$3(receiver, byteOffset, value, littleEndian) {
- return receiver.setUint32(byteOffset, value, littleEndian);
- },
+ $isTrustedGetRuntimeType: 1,
$isByteData: 1
};
A.NativeTypedArray.prototype = {
get$length(receiver) {
return receiver.length;
},
- _setRangeFast$4(receiver, start, end, source, skipCount) {
- var count, sourceLength,
- targetLength = receiver.length;
- this._checkPosition$3(receiver, start, targetLength, "start");
- this._checkPosition$3(receiver, end, targetLength, "end");
- if (start > end)
- throw A.wrapException(A.RangeError$range(start, 0, end, null, null));
- count = end - start;
- sourceLength = source.length;
- if (sourceLength - skipCount < count)
- throw A.wrapException(A.StateError$("Not enough elements"));
- if (skipCount !== 0 || sourceLength !== count)
- source = source.subarray(skipCount, skipCount + count);
- receiver.set(source, start);
- },
- $isJSIndexable: 1,
$isJavaScriptIndexingBehavior: 1
};
A.NativeTypedArrayOfDouble.prototype = {
@@ -6180,69 +5975,110 @@
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
},
- $indexSet(receiver, index, value) {
- A._asDouble(value);
- A._checkValidIndex(index, receiver, receiver.length);
- receiver[index] = value;
- },
$isEfficientLengthIterable: 1,
$isIterable: 1,
$isList: 1
};
A.NativeTypedArrayOfInt.prototype = {
- $indexSet(receiver, index, value) {
- A._asInt(value);
- A._checkValidIndex(index, receiver, receiver.length);
- receiver[index] = value;
- },
setRange$3(receiver, start, end, iterable) {
+ var targetLength, count, sourceLength, source;
type$.Iterable_int._as(iterable);
- if (type$.NativeTypedArrayOfInt._is(iterable)) {
- this._setRangeFast$4(receiver, start, end, iterable, 0);
- return;
- }
- this.super$ListMixin$setRange(receiver, start, end, iterable, 0);
+ receiver.$flags & 2 && A.throwUnsupportedOperation(receiver, 5);
+ targetLength = receiver.length;
+ this._checkPosition$3(receiver, start, targetLength, "start");
+ this._checkPosition$3(receiver, end, targetLength, "end");
+ if (start > end)
+ A.throwExpression(A.RangeError$range(start, 0, end, null, null));
+ count = end - start;
+ sourceLength = iterable.length;
+ if (sourceLength < count)
+ A.throwExpression(A.StateError$("Not enough elements"));
+ source = sourceLength !== count ? iterable.subarray(0, count) : iterable;
+ receiver.set(source, start);
+ return;
},
$isEfficientLengthIterable: 1,
$isIterable: 1,
$isList: 1
};
+ A.NativeFloat32List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Float32List_9Kz;
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isFloat32List: 1
+ };
+ A.NativeFloat64List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Float64List_9Kz;
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isFloat64List: 1
+ };
A.NativeInt16List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Int16List_s5h;
+ },
$index(receiver, index) {
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isInt16List: 1
};
A.NativeInt32List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Int32List_O8Z;
+ },
$index(receiver, index) {
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isInt32List: 1
};
A.NativeInt8List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Int8List_rFV;
+ },
$index(receiver, index) {
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isInt8List: 1
};
A.NativeUint16List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Uint16List_kmP;
+ },
$index(receiver, index) {
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isUint16List: 1
};
A.NativeUint32List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Uint32List_kmP;
+ },
$index(receiver, index) {
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isUint32List: 1
};
A.NativeUint8ClampedList.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Uint8ClampedList_04U;
+ },
get$length(receiver) {
return receiver.length;
},
@@ -6250,9 +6086,14 @@
A._asInt(index);
A._checkValidIndex(index, receiver, receiver.length);
return receiver[index];
- }
+ },
+ $isTrustedGetRuntimeType: 1,
+ $isUint8ClampedList: 1
};
A.NativeUint8List.prototype = {
+ get$runtimeType(receiver) {
+ return B.Type_Uint8List_8Eb;
+ },
get$length(receiver) {
return receiver.length;
},
@@ -6264,9 +6105,10 @@
sublist$2(receiver, start, end) {
return new Uint8Array(receiver.subarray(start, A._checkValidRange(start, end, receiver.length)));
},
- sublist$1($receiver, start) {
- return this.sublist$2($receiver, start, null);
+ sublist$1(receiver, start) {
+ return this.sublist$2(receiver, start, null);
},
+ $isTrustedGetRuntimeType: 1,
$isUint8List: 1
};
A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin.prototype = {};
@@ -6294,13 +6136,13 @@
};
A._TypeError.prototype = {$isTypeError: 1};
A._AsyncRun__initializeScheduleImmediate_internalCallback.prototype = {
- call$1(_) {
+ call$1(__wc0_formal) {
var t1 = this._box_0,
f = t1.storedCallback;
t1.storedCallback = null;
f.call$0();
},
- $signature: 3
+ $signature: 2
};
A._AsyncRun__initializeScheduleImmediate_closure.prototype = {
call$1(callback) {
@@ -6310,19 +6152,19 @@
t2 = this.span;
t1.firstChild ? t1.removeChild(t2) : t1.appendChild(t2);
},
- $signature: 11
+ $signature: 16
};
A._AsyncRun__scheduleImmediateJsOverride_internalCallback.prototype = {
call$0() {
this.callback.call$0();
},
- $signature: 6
+ $signature: 5
};
A._AsyncRun__scheduleImmediateWithSetImmediate_internalCallback.prototype = {
call$0() {
this.callback.call$0();
},
- $signature: 6
+ $signature: 5
};
A._TimerImpl.prototype = {
_TimerImpl$2(milliseconds, callback) {
@@ -6339,12 +6181,12 @@
$signature: 0
};
A._AsyncAwaitCompleter.prototype = {
- complete$1(_, value) {
+ complete$1(value) {
var t2, _this = this,
t1 = _this.$ti;
t1._eval$1("1/?")._as(value);
if (value == null)
- t1._precomputed1._as(value);
+ value = t1._precomputed1._as(value);
if (!_this.isSync)
_this._future._asyncComplete$1(value);
else {
@@ -6352,7 +6194,7 @@
if (t1._eval$1("Future<1>")._is(value))
t2._chainFuture$1(value);
else
- t2._completeWithValue$1(t1._precomputed1._as(value));
+ t2._completeWithValue$1(value);
}
},
completeError$2(e, st) {
@@ -6361,26 +6203,25 @@
t1._completeError$2(e, st);
else
t1._asyncCompleteError$2(e, st);
- },
- $isCompleter: 1
+ }
};
A._awaitOnObject_closure.prototype = {
call$1(result) {
return this.bodyFunction.call$2(0, result);
},
- $signature: 4
+ $signature: 3
};
A._awaitOnObject_closure0.prototype = {
call$2(error, stackTrace) {
this.bodyFunction.call$2(1, new A.ExceptionAndStackTrace(error, type$.StackTrace._as(stackTrace)));
},
- $signature: 12
+ $signature: 17
};
A._wrapJsFunctionForAsync_closure.prototype = {
call$2(errorCode, result) {
this.$protected(A._asInt(errorCode), result);
},
- $signature: 13
+ $signature: 18
};
A.AsyncError.prototype = {
toString$0(_) {
@@ -6391,54 +6232,199 @@
return this.stackTrace;
}
};
- A._Completer.prototype = {
- completeError$2(error, stackTrace) {
- var t1;
- A.checkNotNullable(error, "error", type$.Object);
- t1 = this.future;
- if ((t1._state & 30) !== 0)
- throw A.wrapException(A.StateError$("Future already completed"));
- if (stackTrace == null)
- stackTrace = A.AsyncError_defaultStackTrace(error);
- t1._asyncCompleteError$2(error, stackTrace);
+ A._BroadcastStream.prototype = {};
+ A._BroadcastSubscription.prototype = {
+ _onPause$0() {
},
- completeError$1(error) {
- return this.completeError$2(error, null);
+ _onResume$0() {
},
- $isCompleter: 1
- };
- A._AsyncCompleter.prototype = {
- complete$1(_, value) {
- var t2,
- t1 = this.$ti;
- t1._eval$1("1/?")._as(value);
- t2 = this.future;
- if ((t2._state & 30) !== 0)
- throw A.wrapException(A.StateError$("Future already completed"));
- t2._asyncComplete$1(t1._eval$1("1/")._as(value));
+ set$_async$_next(_next) {
+ this._async$_next = this.$ti._eval$1("_BroadcastSubscription<1>?")._as(_next);
},
- complete$0($receiver) {
- return this.complete$1($receiver, null);
+ set$_async$_previous(_previous) {
+ this._async$_previous = this.$ti._eval$1("_BroadcastSubscription<1>?")._as(_previous);
}
};
- A._FutureListener.prototype = {
- matchesErrorTest$1(asyncError) {
- if ((this.state & 15) !== 6)
- return true;
- return this.result._zone.runUnary$2$2(type$.bool_Function_Object._as(this.callback), asyncError.error, type$.bool, type$.Object);
+ A._BroadcastStreamController.prototype = {
+ get$_mayAddEvent() {
+ return this._state < 4;
},
- handleError$1(asyncError) {
- var exception, _this = this,
- errorCallback = _this.errorCallback,
- result = null,
- t1 = type$.dynamic,
- t2 = type$.Object,
- t3 = asyncError.error,
- t4 = _this.result._zone;
- if (type$.dynamic_Function_Object_StackTrace._is(errorCallback))
- result = t4.runBinary$3$3(errorCallback, t3, asyncError.stackTrace, t1, t2, type$.StackTrace);
+ _subscribe$4(onData, onError, onDone, cancelOnError) {
+ var t2, t3, t4, t5, subscription, oldLast, _this = this,
+ t1 = A._instanceType(_this);
+ t1._eval$1("~(1)?")._as(onData);
+ type$.nullable_void_Function._as(onDone);
+ if ((_this._state & 4) !== 0) {
+ t1 = new A._DoneStreamSubscription($.Zone__current, t1._eval$1("_DoneStreamSubscription<1>"));
+ A.scheduleMicrotask(t1.get$_onMicrotask());
+ if (onDone != null)
+ t1.set$_onDone(type$.void_Function._as(onDone));
+ return t1;
+ }
+ t2 = $.Zone__current;
+ t3 = cancelOnError ? 1 : 0;
+ t4 = onError != null ? 32 : 0;
+ type$.$env_1_1_void._bind$1(t1._precomputed1)._eval$1("1(2)")._as(onData);
+ A._BufferingStreamSubscription__registerErrorHandler(t2, onError);
+ t5 = onDone == null ? A.async___nullDoneHandler$closure() : onDone;
+ type$.void_Function._as(t5);
+ t1 = t1._eval$1("_BroadcastSubscription<1>");
+ subscription = new A._BroadcastSubscription(_this, onData, t2, t3 | t4, t1);
+ subscription.set$_async$_previous(subscription);
+ subscription.set$_async$_next(subscription);
+ t1._as(subscription);
+ subscription._eventState = _this._state & 1;
+ oldLast = _this._lastSubscription;
+ _this.set$_lastSubscription(subscription);
+ subscription.set$_async$_next(null);
+ subscription.set$_async$_previous(oldLast);
+ if (oldLast == null)
+ _this.set$_firstSubscription(subscription);
else
- result = t4.runUnary$2$2(type$.dynamic_Function_Object._as(errorCallback), t3, t1, t2);
+ oldLast.set$_async$_next(subscription);
+ if (_this._firstSubscription == _this._lastSubscription)
+ A._runGuarded(_this.onListen);
+ return subscription;
+ },
+ _addEventError$0() {
+ if ((this._state & 4) !== 0)
+ return new A.StateError("Cannot add new events after calling close");
+ return new A.StateError("Cannot add new events while doing an addStream");
+ },
+ _forEachListener$1(action) {
+ var t2, subscription, id, next, previous, _this = this,
+ t1 = A._instanceType(_this);
+ t1._eval$1("~(_BufferingStreamSubscription<1>)")._as(action);
+ t2 = _this._state;
+ if ((t2 & 2) !== 0)
+ throw A.wrapException(A.StateError$(string$.Cannot));
+ subscription = _this._firstSubscription;
+ if (subscription == null)
+ return;
+ id = t2 & 1;
+ _this._state = t2 ^ 3;
+ for (t1 = t1._eval$1("_BroadcastSubscription<1>"); subscription != null;) {
+ t2 = subscription._eventState;
+ if ((t2 & 1) === id) {
+ subscription._eventState = t2 | 2;
+ action.call$1(subscription);
+ t2 = subscription._eventState ^= 1;
+ next = subscription._async$_next;
+ if ((t2 & 4) !== 0) {
+ t1._as(subscription);
+ previous = subscription._async$_previous;
+ if (previous == null)
+ _this.set$_firstSubscription(next);
+ else
+ previous.set$_async$_next(next);
+ if (next == null)
+ _this.set$_lastSubscription(previous);
+ else
+ next.set$_async$_previous(previous);
+ subscription.set$_async$_previous(subscription);
+ subscription.set$_async$_next(subscription);
+ }
+ subscription._eventState &= 4294967293;
+ subscription = next;
+ } else
+ subscription = subscription._async$_next;
+ }
+ _this._state &= 4294967293;
+ if (_this._firstSubscription == null)
+ _this._callOnCancel$0();
+ },
+ _callOnCancel$0() {
+ if ((this._state & 4) !== 0)
+ if (null.get$_mayComplete())
+ null._asyncComplete$1(null);
+ A._runGuarded(this.onCancel);
+ },
+ set$_firstSubscription(_firstSubscription) {
+ this._firstSubscription = A._instanceType(this)._eval$1("_BroadcastSubscription<1>?")._as(_firstSubscription);
+ },
+ set$_lastSubscription(_lastSubscription) {
+ this._lastSubscription = A._instanceType(this)._eval$1("_BroadcastSubscription<1>?")._as(_lastSubscription);
+ },
+ $isStreamController: 1,
+ $is_StreamControllerLifecycle: 1,
+ $is_EventDispatch: 1
+ };
+ A._SyncBroadcastStreamController.prototype = {
+ get$_mayAddEvent() {
+ return A._BroadcastStreamController.prototype.get$_mayAddEvent.call(this) && (this._state & 2) === 0;
+ },
+ _addEventError$0() {
+ if ((this._state & 2) !== 0)
+ return new A.StateError(string$.Cannot);
+ return this.super$_BroadcastStreamController$_addEventError();
+ },
+ _sendData$1(data) {
+ var t1, _this = this;
+ _this.$ti._precomputed1._as(data);
+ t1 = _this._firstSubscription;
+ if (t1 == null)
+ return;
+ if (t1 === _this._lastSubscription) {
+ _this._state |= 2;
+ t1._add$1(data);
+ _this._state &= 4294967293;
+ if (_this._firstSubscription == null)
+ _this._callOnCancel$0();
+ return;
+ }
+ _this._forEachListener$1(new A._SyncBroadcastStreamController__sendData_closure(_this, data));
+ }
+ };
+ A._SyncBroadcastStreamController__sendData_closure.prototype = {
+ call$1(subscription) {
+ this.$this.$ti._eval$1("_BufferingStreamSubscription<1>")._as(subscription)._add$1(this.data);
+ },
+ $signature() {
+ return this.$this.$ti._eval$1("~(_BufferingStreamSubscription<1>)");
+ }
+ };
+ A._Completer.prototype = {
+ completeError$2(error, stackTrace) {
+ var _0_0,
+ t1 = this.future;
+ if ((t1._state & 30) !== 0)
+ throw A.wrapException(A.StateError$("Future already completed"));
+ _0_0 = A._interceptUserError(error, stackTrace);
+ t1._asyncCompleteError$2(_0_0.error, _0_0.stackTrace);
+ },
+ completeError$1(error) {
+ return this.completeError$2(error, null);
+ }
+ };
+ A._AsyncCompleter.prototype = {
+ complete$1(value) {
+ var t2,
+ t1 = this.$ti;
+ t1._eval$1("1/?")._as(value);
+ t2 = this.future;
+ if ((t2._state & 30) !== 0)
+ throw A.wrapException(A.StateError$("Future already completed"));
+ t2._asyncComplete$1(t1._eval$1("1/")._as(value));
+ }
+ };
+ A._FutureListener.prototype = {
+ matchesErrorTest$1(asyncError) {
+ if ((this.state & 15) !== 6)
+ return true;
+ return this.result._zone.runUnary$2$2(type$.bool_Function_Object._as(this.callback), asyncError.error, type$.bool, type$.Object);
+ },
+ handleError$1(asyncError) {
+ var exception, _this = this,
+ errorCallback = _this.errorCallback,
+ result = null,
+ t1 = type$.dynamic,
+ t2 = type$.Object,
+ t3 = asyncError.error,
+ t4 = _this.result._zone;
+ if (type$.dynamic_Function_Object_StackTrace._is(errorCallback))
+ result = t4.runBinary$3$3(errorCallback, t3, asyncError.stackTrace, t1, t2, type$.StackTrace);
+ else
+ result = t4.runUnary$2$2(type$.dynamic_Function_Object._as(errorCallback), t3, t1, t2);
try {
t1 = _this.$ti._eval$1("2/")._as(result);
return t1;
@@ -6454,32 +6440,27 @@
};
A._Future.prototype = {
then$1$2$onError(f, onError, $R) {
- var currentZone, result, t2,
+ var currentZone, result,
t1 = this.$ti;
t1._bind$1($R)._eval$1("1/(2)")._as(f);
currentZone = $.Zone__current;
if (currentZone === B.C__RootZone) {
- if (onError != null && !type$.dynamic_Function_Object_StackTrace._is(onError) && !type$.dynamic_Function_Object._is(onError))
+ if (!type$.dynamic_Function_Object_StackTrace._is(onError) && !type$.dynamic_Function_Object._is(onError))
throw A.wrapException(A.ArgumentError$value(onError, "onError", string$.Error_));
} else {
$R._eval$1("@<0/>")._bind$1(t1._precomputed1)._eval$1("1(2)")._as(f);
- if (onError != null)
- onError = A._registerErrorHandler(onError, currentZone);
+ onError = A._registerErrorHandler(onError, currentZone);
}
result = new A._Future(currentZone, $R._eval$1("_Future<0>"));
- t2 = onError == null ? 1 : 3;
- this._addListener$1(new A._FutureListener(result, t2, f, onError, t1._eval$1("@<1>")._bind$1($R)._eval$1("_FutureListener<1,2>")));
+ this._addListener$1(new A._FutureListener(result, 3, f, onError, t1._eval$1("@<1>")._bind$1($R)._eval$1("_FutureListener<1,2>")));
return result;
},
- then$1$1(f, $R) {
- return this.then$1$2$onError(f, null, $R);
- },
_thenAwait$1$2(f, onError, $E) {
var result,
t1 = this.$ti;
t1._bind$1($E)._eval$1("1/(2)")._as(f);
result = new A._Future($.Zone__current, $E._eval$1("_Future<0>"));
- this._addListener$1(new A._FutureListener(result, 3, f, onError, t1._eval$1("@<1>")._bind$1($E)._eval$1("_FutureListener<1,2>")));
+ this._addListener$1(new A._FutureListener(result, 19, f, onError, t1._eval$1("@<1>")._bind$1($E)._eval$1("_FutureListener<1,2>")));
return result;
},
_setErrorObject$1(error) {
@@ -6568,11 +6549,25 @@
_this._resultOrListeners = value;
A._Future__propagateToListeners(_this, listeners);
},
+ _completeWithResultOf$1(source) {
+ var t1, listeners, _this = this;
+ if ((source._state & 16) !== 0) {
+ t1 = _this._zone === source._zone;
+ t1 = !(t1 || t1);
+ } else
+ t1 = false;
+ if (t1)
+ return;
+ listeners = _this._removeListeners$0();
+ _this._cloneResult$1(source);
+ A._Future__propagateToListeners(_this, listeners);
+ },
_completeError$2(error, stackTrace) {
var listeners;
+ type$.Object._as(error);
type$.StackTrace._as(stackTrace);
listeners = this._removeListeners$0();
- this._setErrorObject$1(A.AsyncError$(error, stackTrace));
+ this._setErrorObject$1(new A.AsyncError(error, stackTrace));
A._Future__propagateToListeners(this, listeners);
},
_asyncComplete$1(value) {
@@ -6582,7 +6577,7 @@
this._chainFuture$1(value);
return;
}
- this._asyncCompleteWithValue$1(t1._precomputed1._as(value));
+ this._asyncCompleteWithValue$1(value);
},
_asyncCompleteWithValue$1(value) {
var _this = this;
@@ -6591,18 +6586,13 @@
A._rootScheduleMicrotask(null, null, _this._zone, type$.void_Function._as(new A._Future__asyncCompleteWithValue_closure(_this, value)));
},
_chainFuture$1(value) {
- var _this = this,
- t1 = _this.$ti;
+ var t1 = this.$ti;
t1._eval$1("Future<1>")._as(value);
if (t1._is(value)) {
- if ((value._state & 16) !== 0) {
- _this._state ^= 2;
- A._rootScheduleMicrotask(null, null, _this._zone, type$.void_Function._as(new A._Future__chainFuture_closure(_this, value)));
- } else
- A._Future__chainCoreFuture(value, _this);
+ A._Future__chainCoreFuture(value, this, false);
return;
}
- _this._chainForeignFuture$1(value);
+ this._chainForeignFuture$1(value);
},
_asyncCompleteError$2(error, stackTrace) {
this._state ^= 2;
@@ -6635,13 +6625,13 @@
t1._completeError$2(error, stackTrace);
}
},
- $signature: 3
+ $signature: 2
};
A._Future__chainForeignFuture_closure0.prototype = {
call$2(error, stackTrace) {
this.$this._completeError$2(type$.Object._as(error), type$.StackTrace._as(stackTrace));
},
- $signature: 14
+ $signature: 7
};
A._Future__chainForeignFuture_closure1.prototype = {
call$0() {
@@ -6649,15 +6639,15 @@
},
$signature: 0
};
- A._Future__asyncCompleteWithValue_closure.prototype = {
+ A._Future__chainCoreFuture_closure.prototype = {
call$0() {
- this.$this._completeWithValue$1(this.value);
+ A._Future__chainCoreFuture(this._box_0.source, this.target, true);
},
$signature: 0
};
- A._Future__chainFuture_closure.prototype = {
+ A._Future__asyncCompleteWithValue_closure.prototype = {
call$0() {
- A._Future__chainCoreFuture(this.value, this.$this);
+ this.$this._completeWithValue$1(this.value);
},
$signature: 0
};
@@ -6669,20 +6659,26 @@
};
A._Future__propagateToListeners_handleWhenCompleteCallback.prototype = {
call$0() {
- var e, s, t1, exception, t2, originalSource, _this = this, completeResult = null;
+ var e, s, t1, exception, t2, t3, originalSource, joinedResult, _this = this, completeResult = null;
try {
t1 = _this._box_0.listener;
completeResult = t1.result._zone.run$1$1(type$.dynamic_Function._as(t1.callback), type$.dynamic);
} catch (exception) {
e = A.unwrapException(exception);
s = A.getTraceFromException(exception);
- t1 = _this.hasError && type$.AsyncError._as(_this._box_1.source._resultOrListeners).error === e;
- t2 = _this._box_0;
- if (t1)
- t2.listenerValueOrError = type$.AsyncError._as(_this._box_1.source._resultOrListeners);
- else
- t2.listenerValueOrError = A.AsyncError$(e, s);
- t2.listenerHasError = true;
+ if (_this.hasError && type$.AsyncError._as(_this._box_1.source._resultOrListeners).error === e) {
+ t1 = _this._box_0;
+ t1.listenerValueOrError = type$.AsyncError._as(_this._box_1.source._resultOrListeners);
+ } else {
+ t1 = e;
+ t2 = s;
+ if (t2 == null)
+ t2 = A.AsyncError_defaultStackTrace(t1);
+ t3 = _this._box_0;
+ t3.listenerValueOrError = new A.AsyncError(t1, t2);
+ t1 = t3;
+ }
+ t1.listenerHasError = true;
return;
}
if (completeResult instanceof A._Future && (completeResult._state & 24) !== 0) {
@@ -6693,20 +6689,28 @@
}
return;
}
- if (type$.Future_dynamic._is(completeResult)) {
+ if (completeResult instanceof A._Future) {
originalSource = _this._box_1.source;
+ joinedResult = new A._Future(originalSource._zone, originalSource.$ti);
+ completeResult.then$1$2$onError(new A._Future__propagateToListeners_handleWhenCompleteCallback_closure(joinedResult, originalSource), new A._Future__propagateToListeners_handleWhenCompleteCallback_closure0(joinedResult), type$.void);
t1 = _this._box_0;
- t1.listenerValueOrError = completeResult.then$1$1(new A._Future__propagateToListeners_handleWhenCompleteCallback_closure(originalSource), type$.dynamic);
+ t1.listenerValueOrError = joinedResult;
t1.listenerHasError = false;
}
},
$signature: 0
};
A._Future__propagateToListeners_handleWhenCompleteCallback_closure.prototype = {
- call$1(_) {
- return this.originalSource;
+ call$1(__wc0_formal) {
+ this.joinedResult._completeWithResultOf$1(this.originalSource);
},
- $signature: 15
+ $signature: 2
+ };
+ A._Future__propagateToListeners_handleWhenCompleteCallback_closure0.prototype = {
+ call$2(e, s) {
+ this.joinedResult._completeError$2(type$.Object._as(e), type$.StackTrace._as(s));
+ },
+ $signature: 7
};
A._Future__propagateToListeners_handleValueCallback.prototype = {
call$0() {
@@ -6721,16 +6725,20 @@
} catch (exception) {
e = A.unwrapException(exception);
s = A.getTraceFromException(exception);
- t1 = this._box_0;
- t1.listenerValueOrError = A.AsyncError$(e, s);
- t1.listenerHasError = true;
+ t1 = e;
+ t2 = s;
+ if (t2 == null)
+ t2 = A.AsyncError_defaultStackTrace(t1);
+ t3 = this._box_0;
+ t3.listenerValueOrError = new A.AsyncError(t1, t2);
+ t3.listenerHasError = true;
}
},
$signature: 0
};
A._Future__propagateToListeners_handleError.prototype = {
call$0() {
- var asyncError, e, s, t1, exception, t2, _this = this;
+ var asyncError, e, s, t1, exception, t2, t3, _this = this;
try {
asyncError = type$.AsyncError._as(_this._box_1.source._resultOrListeners);
t1 = _this._box_0;
@@ -6742,12 +6750,20 @@
e = A.unwrapException(exception);
s = A.getTraceFromException(exception);
t1 = type$.AsyncError._as(_this._box_1.source._resultOrListeners);
- t2 = _this._box_0;
- if (t1.error === e)
+ if (t1.error === e) {
+ t2 = _this._box_0;
t2.listenerValueOrError = t1;
- else
- t2.listenerValueOrError = A.AsyncError$(e, s);
- t2.listenerHasError = true;
+ t1 = t2;
+ } else {
+ t1 = e;
+ t2 = s;
+ if (t2 == null)
+ t2 = A.AsyncError_defaultStackTrace(t1);
+ t3 = _this._box_0;
+ t3.listenerValueOrError = new A.AsyncError(t1, t2);
+ t1 = t3;
+ }
+ t1.listenerHasError = true;
}
},
$signature: 0
@@ -6755,19 +6771,16 @@
A._AsyncCallbackEntry.prototype = {};
A.Stream.prototype = {
get$length(_) {
- var t2, t3, _this = this, t1 = {},
+ var t1 = {},
future = new A._Future($.Zone__current, type$._Future_int);
t1.count = 0;
- t2 = _this.$ti;
- t3 = t2._eval$1("~(1)?")._as(new A.Stream_length_closure(t1, _this));
- type$.nullable_void_Function._as(new A.Stream_length_closure0(t1, future));
- A._EventStreamSubscription$(_this._target, _this._eventType, t3, false, t2._precomputed1);
+ this.listen$4$cancelOnError$onDone$onError(new A.Stream_length_closure(t1, this), true, new A.Stream_length_closure0(t1, future), future.get$_completeError());
return future;
}
};
A.Stream_length_closure.prototype = {
- call$1(_) {
- this.$this.$ti._precomputed1._as(_);
+ call$1(__wc0_formal) {
+ this.$this.$ti._precomputed1._as(__wc0_formal);
++this._box_0.count;
},
$signature() {
@@ -6787,17 +6800,184 @@
},
$signature: 0
};
- A.StreamSubscription.prototype = {};
- A.StreamTransformerBase.prototype = {};
+ A._ControllerStream.prototype = {
+ get$hashCode(_) {
+ return (A.Primitives_objectHashCode(this._async$_controller) ^ 892482866) >>> 0;
+ },
+ $eq(_, other) {
+ if (other == null)
+ return false;
+ if (this === other)
+ return true;
+ return other instanceof A._BroadcastStream && other._async$_controller === this._async$_controller;
+ }
+ };
+ A._ControllerSubscription.prototype = {
+ _onPause$0() {
+ A._instanceType(this._async$_controller)._eval$1("StreamSubscription<1>")._as(this);
+ },
+ _onResume$0() {
+ A._instanceType(this._async$_controller)._eval$1("StreamSubscription<1>")._as(this);
+ }
+ };
+ A._BufferingStreamSubscription.prototype = {
+ _add$1(data) {
+ var t2, _this = this,
+ t1 = A._instanceType(_this);
+ t1._precomputed1._as(data);
+ t2 = _this._state;
+ if ((t2 & 8) !== 0)
+ return;
+ if (t2 < 64)
+ _this._sendData$1(data);
+ else
+ _this._addPending$1(new A._DelayedData(data, t1._eval$1("_DelayedData<1>")));
+ },
+ _onPause$0() {
+ },
+ _onResume$0() {
+ },
+ _addPending$1($event) {
+ var lastEvent, t1, _this = this,
+ pending = _this._pending;
+ if (pending == null) {
+ pending = new A._PendingEvents(A._instanceType(_this)._eval$1("_PendingEvents<1>"));
+ _this.set$_pending(pending);
+ }
+ lastEvent = pending.lastPendingEvent;
+ if (lastEvent == null)
+ pending.firstPendingEvent = pending.lastPendingEvent = $event;
+ else
+ pending.lastPendingEvent = lastEvent.next = $event;
+ t1 = _this._state;
+ if ((t1 & 128) === 0) {
+ t1 |= 128;
+ _this._state = t1;
+ if (t1 < 256)
+ pending.schedule$1(_this);
+ }
+ },
+ _sendData$1(data) {
+ var t2, _this = this,
+ t1 = A._instanceType(_this)._precomputed1;
+ t1._as(data);
+ t2 = _this._state;
+ _this._state = t2 | 64;
+ _this._zone.runUnaryGuarded$1$2(_this._onData, data, t1);
+ _this._state &= 4294967231;
+ _this._checkState$1((t2 & 4) !== 0);
+ },
+ _checkState$1(wasInputPaused) {
+ var t2, isInputPaused, _this = this,
+ t1 = _this._state;
+ if ((t1 & 128) !== 0 && _this._pending.lastPendingEvent == null) {
+ t1 = _this._state = t1 & 4294967167;
+ t2 = false;
+ if ((t1 & 4) !== 0)
+ if (t1 < 256) {
+ t2 = _this._pending;
+ t2 = t2 == null ? null : t2.lastPendingEvent == null;
+ t2 = t2 !== false;
+ }
+ if (t2) {
+ t1 &= 4294967291;
+ _this._state = t1;
+ }
+ }
+ for (; true; wasInputPaused = isInputPaused) {
+ if ((t1 & 8) !== 0) {
+ _this.set$_pending(null);
+ return;
+ }
+ isInputPaused = (t1 & 4) !== 0;
+ if (wasInputPaused === isInputPaused)
+ break;
+ _this._state = t1 ^ 64;
+ if (isInputPaused)
+ _this._onPause$0();
+ else
+ _this._onResume$0();
+ t1 = _this._state &= 4294967231;
+ }
+ if ((t1 & 128) !== 0 && t1 < 256)
+ _this._pending.schedule$1(_this);
+ },
+ set$_pending(_pending) {
+ this._pending = A._instanceType(this)._eval$1("_PendingEvents<1>?")._as(_pending);
+ },
+ $isStreamSubscription: 1,
+ $is_EventDispatch: 1
+ };
+ A._StreamImpl.prototype = {
+ listen$4$cancelOnError$onDone$onError(onData, cancelOnError, onDone, onError) {
+ var t1 = this.$ti;
+ t1._eval$1("~(1)?")._as(onData);
+ type$.nullable_void_Function._as(onDone);
+ return this._async$_controller._subscribe$4(t1._eval$1("~(1)?")._as(onData), onError, onDone, cancelOnError === true);
+ },
+ listen$1(onData) {
+ return this.listen$4$cancelOnError$onDone$onError(onData, null, null, null);
+ }
+ };
+ A._DelayedEvent.prototype = {};
+ A._DelayedData.prototype = {};
+ A._PendingEvents.prototype = {
+ schedule$1(dispatch) {
+ var t1, _this = this;
+ _this.$ti._eval$1("_EventDispatch<1>")._as(dispatch);
+ t1 = _this._state;
+ if (t1 === 1)
+ return;
+ if (t1 >= 1) {
+ _this._state = 1;
+ return;
+ }
+ A.scheduleMicrotask(new A._PendingEvents_schedule_closure(_this, dispatch));
+ _this._state = 1;
+ }
+ };
+ A._PendingEvents_schedule_closure.prototype = {
+ call$0() {
+ var t2, $event, nextEvent,
+ t1 = this.$this,
+ oldState = t1._state;
+ t1._state = 0;
+ if (oldState === 3)
+ return;
+ t2 = t1.$ti._eval$1("_EventDispatch<1>")._as(this.dispatch);
+ $event = t1.firstPendingEvent;
+ nextEvent = $event.next;
+ t1.firstPendingEvent = nextEvent;
+ if (nextEvent == null)
+ t1.lastPendingEvent = null;
+ A._instanceType($event)._eval$1("_EventDispatch<1>")._as(t2)._sendData$1($event.value);
+ },
+ $signature: 0
+ };
+ A._DoneStreamSubscription.prototype = {
+ _onMicrotask$0() {
+ var _0_0, _this = this,
+ unscheduledState = _this._state - 1;
+ if (unscheduledState === 0) {
+ _this._state = -1;
+ _0_0 = _this._onDone;
+ if (_0_0 != null) {
+ _this.set$_onDone(null);
+ _this._zone.runGuarded$1(_0_0);
+ }
+ } else
+ _this._state = unscheduledState;
+ },
+ set$_onDone(_onDone) {
+ this._onDone = type$.nullable_void_Function._as(_onDone);
+ },
+ $isStreamSubscription: 1
+ };
A._StreamIterator.prototype = {};
A._Zone.prototype = {$isZone: 1};
A._rootHandleError_closure.prototype = {
call$0() {
- var t1 = this.error,
- t2 = this.stackTrace;
- A.checkNotNullable(t1, "error", type$.Object);
- A.checkNotNullable(t2, "stackTrace", type$.StackTrace);
- A.Error__throw(t1, t2);
+ A.Error_throwWithStackTrace(this.error, this.stackTrace);
},
$signature: 0
};
@@ -6836,9 +7016,6 @@
bindCallbackGuarded$1(f) {
return new A._RootZone_bindCallbackGuarded_closure(this, type$.void_Function._as(f));
},
- bindUnaryCallbackGuarded$1$1(f, $T) {
- return new A._RootZone_bindUnaryCallbackGuarded_closure(this, $T._eval$1("~(0)")._as(f), $T);
- },
$index(_, key) {
return null;
},
@@ -6873,23 +7050,14 @@
},
$signature: 0
};
- A._RootZone_bindUnaryCallbackGuarded_closure.prototype = {
- call$1(arg) {
- var t1 = this.T;
- return this.$this.runUnaryGuarded$1$2(this.f, t1._as(arg), t1);
- },
- $signature() {
- return this.T._eval$1("~(0)");
- }
- };
A._HashMap.prototype = {
get$length(_) {
return this._collection$_length;
},
- get$keys(_) {
+ get$keys() {
return new A._HashMapKeyIterable(this, this.$ti._eval$1("_HashMapKeyIterable<1>"));
},
- containsKey$1(_, key) {
+ containsKey$1(key) {
var strings, nums;
if (typeof key == "string" && key !== "__proto__") {
strings = this._collection$_strings;
@@ -6917,9 +7085,9 @@
t1 = nums == null ? null : A._HashMap__getTableEntry(nums, key);
return t1;
} else
- return this._get$1(0, key);
+ return this._get$1(key);
},
- _get$1(_, key) {
+ _get$1(key) {
var bucket, index,
rest = this._collection$_rest;
if (rest == null)
@@ -6929,27 +7097,35 @@
return index < 0 ? null : bucket[index + 1];
},
$indexSet(_, key, value) {
- var rest, hash, bucket, index, _this = this,
+ var strings, nums, rest, hash, bucket, index, _this = this,
t1 = _this.$ti;
t1._precomputed1._as(key);
t1._rest[1]._as(value);
- rest = _this._collection$_rest;
- if (rest == null)
- rest = _this._collection$_rest = A._HashMap__newHashTable();
- hash = A.objectHashCode(key) & 1073741823;
- bucket = rest[hash];
- if (bucket == null) {
- A._HashMap__setTableEntry(rest, hash, [key, value]);
- ++_this._collection$_length;
- _this._keys = null;
+ if (typeof key == "string" && key !== "__proto__") {
+ strings = _this._collection$_strings;
+ _this._addHashTableEntry$3(strings == null ? _this._collection$_strings = A._HashMap__newHashTable() : strings, key, value);
+ } else if (typeof key == "number" && (key & 1073741823) === key) {
+ nums = _this._collection$_nums;
+ _this._addHashTableEntry$3(nums == null ? _this._collection$_nums = A._HashMap__newHashTable() : nums, key, value);
} else {
- index = _this._findBucketIndex$2(bucket, key);
- if (index >= 0)
- bucket[index + 1] = value;
- else {
- bucket.push(key, value);
+ rest = _this._collection$_rest;
+ if (rest == null)
+ rest = _this._collection$_rest = A._HashMap__newHashTable();
+ hash = A.objectHashCode(key) & 1073741823;
+ bucket = rest[hash];
+ if (bucket == null) {
+ A._HashMap__setTableEntry(rest, hash, [key, value]);
++_this._collection$_length;
- _this._keys = null;
+ _this._collection$_keys = null;
+ } else {
+ index = _this._findBucketIndex$2(bucket, key);
+ if (index >= 0)
+ bucket[index + 1] = value;
+ else {
+ bucket.push(key, value);
+ ++_this._collection$_length;
+ _this._collection$_keys = null;
+ }
}
}
},
@@ -6963,26 +7139,26 @@
t2._as(key);
t3 = _this.$index(0, key);
action.call$2(key, t3 == null ? t1._as(t3) : t3);
- if (keys !== _this._keys)
+ if (keys !== _this._collection$_keys)
throw A.wrapException(A.ConcurrentModificationError$(_this));
}
},
_computeKeys$0() {
- var strings, names, entries, index, i, nums, rest, bucket, $length, i0, _this = this,
- result = _this._keys;
+ var strings, index, names, entries, i, nums, rest, bucket, $length, i0, _this = this,
+ result = _this._collection$_keys;
if (result != null)
return result;
result = A.List_List$filled(_this._collection$_length, null, false, type$.dynamic);
strings = _this._collection$_strings;
+ index = 0;
if (strings != null) {
names = Object.getOwnPropertyNames(strings);
entries = names.length;
- for (index = 0, i = 0; i < entries; ++i) {
+ for (i = 0; i < entries; ++i) {
result[index] = names[i];
++index;
}
- } else
- index = 0;
+ }
nums = _this._collection$_nums;
if (nums != null) {
names = Object.getOwnPropertyNames(nums);
@@ -7005,7 +7181,17 @@
}
}
}
- return _this._keys = result;
+ return _this._collection$_keys = result;
+ },
+ _addHashTableEntry$3(table, key, value) {
+ var t1 = this.$ti;
+ t1._precomputed1._as(key);
+ t1._rest[1]._as(value);
+ if (table[key] == null) {
+ ++this._collection$_length;
+ this._collection$_keys = null;
+ }
+ A._HashMap__setTableEntry(table, key, value);
},
_getBucket$2(table, key) {
return table[A.objectHashCode(key) & 1073741823];
@@ -7035,16 +7221,16 @@
}
};
A._HashMapKeyIterator.prototype = {
- get$current(_) {
+ get$current() {
var t1 = this._collection$_current;
return t1 == null ? this.$ti._precomputed1._as(t1) : t1;
},
moveNext$0() {
var _this = this,
- keys = _this._keys,
+ keys = _this._collection$_keys,
offset = _this._offset,
t1 = _this._collection$_map;
- if (keys !== t1._keys)
+ if (keys !== t1._collection$_keys)
throw A.wrapException(A.ConcurrentModificationError$(t1));
else if (offset >= keys.length) {
_this.set$_collection$_current(null);
@@ -7060,59 +7246,41 @@
},
$isIterator: 1
};
- A.ListBase.prototype = {$isEfficientLengthIterable: 1, $isIterable: 1, $isList: 1};
- A.ListMixin.prototype = {
+ A.ListBase.prototype = {
get$iterator(receiver) {
- return new A.ListIterator(receiver, this.get$length(receiver), A.instanceType(receiver)._eval$1("ListIterator"));
+ return new A.ListIterator(receiver, this.get$length(receiver), A.instanceType(receiver)._eval$1("ListIterator"));
},
elementAt$1(receiver, index) {
return this.$index(receiver, index);
},
map$1$1(receiver, f, $T) {
var t1 = A.instanceType(receiver);
- return new A.MappedListIterable(receiver, t1._bind$1($T)._eval$1("1(ListMixin.E)")._as(f), t1._eval$1("@")._bind$1($T)._eval$1("MappedListIterable<1,2>"));
- },
- skip$1(receiver, count) {
- return A.SubListIterable$(receiver, count, null, A.instanceType(receiver)._eval$1("ListMixin.E"));
- },
- setRange$4(receiver, start, end, iterable, skipCount) {
- var $length, otherStart, otherList, i,
- t1 = A.instanceType(receiver);
- t1._eval$1("Iterable")._as(iterable);
- A.RangeError_checkValidRange(start, end, this.get$length(receiver));
- $length = end - start;
- if ($length === 0)
- return;
- A.RangeError_checkNotNegative(skipCount, "skipCount");
- if (t1._eval$1("List")._is(iterable)) {
- otherStart = skipCount;
- otherList = iterable;
- } else {
- otherList = J.skip$1$ax(iterable, skipCount).toList$1$growable(0, false);
- otherStart = 0;
- }
- if (otherStart + $length > otherList.length)
- throw A.wrapException(A.StateError$("Too few elements"));
- if (otherStart < start)
- for (i = $length - 1; i >= 0; --i) {
- t1 = otherStart + i;
- if (!(t1 < otherList.length))
- return A.ioore(otherList, t1);
- this.$indexSet(receiver, start + i, otherList[t1]);
- }
- else
- for (i = 0; i < $length; ++i) {
- t1 = otherStart + i;
- if (!(t1 < otherList.length))
- return A.ioore(otherList, t1);
- this.$indexSet(receiver, start + i, otherList[t1]);
- }
+ return new A.MappedListIterable(receiver, t1._bind$1($T)._eval$1("1(ListBase.E)")._as(f), t1._eval$1("@")._bind$1($T)._eval$1("MappedListIterable<1,2>"));
},
toString$0(receiver) {
- return A.IterableBase_iterableToFullString(receiver, "[", "]");
+ return A.Iterable_iterableToFullString(receiver, "[", "]");
}
};
- A.MapBase.prototype = {};
+ A.MapBase.prototype = {
+ forEach$1(_, action) {
+ var t2, key, t3,
+ t1 = A._instanceType(this);
+ t1._eval$1("~(1,2)")._as(action);
+ for (t2 = this.get$keys(), t2 = t2.get$iterator(t2), t1 = t1._rest[1]; t2.moveNext$0();) {
+ key = t2.get$current();
+ t3 = this.$index(0, key);
+ action.call$2(key, t3 == null ? t1._as(t3) : t3);
+ }
+ },
+ get$length(_) {
+ var t1 = this.get$keys();
+ return t1.get$length(t1);
+ },
+ toString$0(_) {
+ return A.MapBase_mapToString(this);
+ },
+ $isMap: 1
+ };
A.MapBase_mapToString_closure.prototype = {
call$2(k, v) {
var t2,
@@ -7121,30 +7289,13 @@
this.result._contents += ", ";
t1.first = false;
t1 = this.result;
- t2 = t1._contents += A.S(k);
+ t2 = A.S(k);
+ t2 = t1._contents += t2;
t1._contents = t2 + ": ";
- t1._contents += A.S(v);
- },
- $signature: 16
- };
- A.MapMixin.prototype = {
- forEach$1(receiver, action) {
- var t2, key, t3,
- t1 = A.instanceType(receiver);
- t1._eval$1("~(MapMixin.K,MapMixin.V)")._as(action);
- for (t2 = J.get$iterator$ax(this.get$keys(receiver)), t1 = t1._eval$1("MapMixin.V"); t2.moveNext$0();) {
- key = t2.get$current(t2);
- t3 = this.$index(receiver, key);
- action.call$2(key, t3 == null ? t1._as(t3) : t3);
- }
- },
- get$length(receiver) {
- return J.get$length$asx(this.get$keys(receiver));
- },
- toString$0(receiver) {
- return A.MapBase_mapToString(receiver);
+ t2 = A.S(v);
+ t1._contents += t2;
},
- $isMap: 1
+ $signature: 19
};
A._UnmodifiableMapMixin.prototype = {};
A.MapView.prototype = {
@@ -7152,14 +7303,14 @@
return this._collection$_map.$index(0, key);
},
forEach$1(_, action) {
- this._collection$_map.forEach$1(0, this.$ti._eval$1("~(1,2)")._as(action));
+ this._collection$_map.forEach$1(0, A._instanceType(this)._eval$1("~(1,2)")._as(action));
},
get$length(_) {
- return this._collection$_map._length;
+ return this._collection$_map.__js_helper$_length;
},
- get$keys(_) {
+ get$keys() {
var t1 = this._collection$_map;
- return new A.LinkedHashMapKeyIterable(t1, t1.$ti._eval$1("LinkedHashMapKeyIterable<1>"));
+ return new A.LinkedHashMapKeysIterable(t1, A._instanceType(t1)._eval$1("LinkedHashMapKeysIterable<1>"));
},
toString$0(_) {
return A.MapBase_mapToString(this._collection$_map);
@@ -7167,7 +7318,6 @@
$isMap: 1
};
A.UnmodifiableMapView.prototype = {};
- A._ListBase_Object_ListMixin.prototype = {};
A._UnmodifiableMapView_MapView__UnmodifiableMapMixin.prototype = {};
A.Base64Codec.prototype = {};
A.Base64Encoder.prototype = {
@@ -7206,7 +7356,7 @@
if (0 === end)
return new Uint8Array(0);
decoder = new A._Base64Decoder();
- t1 = decoder.decode$3(0, input, 0, end);
+ t1 = decoder.decode$3(input, 0, end);
t1.toString;
t2 = decoder._convert$_state;
if (t2 < -1)
@@ -7218,7 +7368,7 @@
}
};
A._Base64Decoder.prototype = {
- decode$3(_, input, start, end) {
+ decode$3(input, start, end) {
var buffer, _this = this,
t1 = _this._convert$_state;
if (t1 < 0) {
@@ -7244,20 +7394,20 @@
t3 += key.__internal$_name;
t1._contents = t3;
t1._contents = t3 + ": ";
- t1._contents += A.Error_safeToString(value);
+ t3 = A.Error_safeToString(value);
+ t1._contents += t3;
t2.comma = ", ";
},
- $signature: 17
+ $signature: 20
};
A.DateTime.prototype = {
$eq(_, other) {
if (other == null)
return false;
- return other instanceof A.DateTime && this._value === other._value && true;
+ return other instanceof A.DateTime && this._value === other._value && this._microsecond === other._microsecond && this.isUtc === other.isUtc;
},
get$hashCode(_) {
- var t1 = this._value;
- return (t1 ^ B.JSInt_methods._shrOtherPositive$1(t1, 30)) & 1073741823;
+ return A.Object_hash(this._value, this._microsecond);
},
toString$0(_) {
var _this = this,
@@ -7267,8 +7417,14 @@
h = A.DateTime__twoDigits(A.Primitives_getHours(_this)),
min = A.DateTime__twoDigits(A.Primitives_getMinutes(_this)),
sec = A.DateTime__twoDigits(A.Primitives_getSeconds(_this)),
- ms = A.DateTime__threeDigits(A.Primitives_getMilliseconds(_this));
- return y + "-" + m + "-" + d + " " + h + ":" + min + ":" + sec + "." + ms + "Z";
+ ms = A.DateTime__threeDigits(A.Primitives_getMilliseconds(_this)),
+ t1 = _this._microsecond,
+ us = t1 === 0 ? "" : A.DateTime__threeDigits(t1);
+ t1 = y + "-" + m;
+ if (_this.isUtc)
+ return t1 + "-" + d + " " + h + ":" + min + ":" + sec + "." + ms + us + "Z";
+ else
+ return t1 + "-" + d + " " + h + ":" + min + ":" + sec + "." + ms + us;
}
};
A._Enum.prototype = {
@@ -7278,7 +7434,7 @@
};
A.Error.prototype = {
get$stackTrace() {
- return A.getTraceFromException(this.$thrownJsError);
+ return A.Primitives_extractStackTrace(this);
}
};
A.AssertionError.prototype = {
@@ -7290,12 +7446,6 @@
}
};
A.TypeError.prototype = {};
- A.NullThrownError.prototype = {
- toString$0(_) {
- return "Throw of null.";
- },
- $isTypeError: 1
- };
A.ArgumentError.prototype = {
get$_errorName() {
return "Invalid argument" + (!this._hasValue ? "(s)" : "");
@@ -7368,7 +7518,8 @@
for (t1 = $arguments.length, _i = 0, t2 = "", t3 = ""; _i < t1; ++_i, t3 = ", ") {
argument = $arguments[_i];
sb._contents = t2 + t3;
- t2 = sb._contents += A.Error_safeToString(argument);
+ t2 = A.Error_safeToString(argument);
+ t2 = sb._contents += t2;
_box_0.comma = ", ";
}
_this._namedArguments.forEach$1(0, new A.NoSuchMethodError_toString_closure(_box_0, sb));
@@ -7418,11 +7569,6 @@
},
$isError: 1
};
- A.CyclicInitializationError.prototype = {
- toString$0(_) {
- return "Reading static variable '" + this.variableName + "' during its initialization";
- }
- };
A._Exception.prototype = {
toString$0(_) {
return "Exception: " + this.message;
@@ -7430,7 +7576,7 @@
};
A.FormatException.prototype = {
toString$0(_) {
- var lineNum, lineStart, previousCharWasCR, i, char, lineEnd, end, start, prefix, postfix,
+ var lineEnd, lineNum, lineStart, previousCharWasCR, i, char, prefix, postfix, end, start,
message = this.message,
report = "" !== message ? "FormatException: " + message : "FormatException",
offset = this.offset,
@@ -7443,8 +7589,10 @@
source = B.JSString_methods.substring$2(source, 0, 75) + "...";
return report + "\n" + source;
}
- for (lineNum = 1, lineStart = 0, previousCharWasCR = false, i = 0; i < offset; ++i) {
- char = B.JSString_methods._codeUnitAt$1(source, i);
+ for (lineEnd = source.length, lineNum = 1, lineStart = 0, previousCharWasCR = false, i = 0; i < offset; ++i) {
+ if (!(i < lineEnd))
+ return A.ioore(source, i);
+ char = source.charCodeAt(i);
if (char === 10) {
if (lineStart !== i || !previousCharWasCR)
++lineNum;
@@ -7457,20 +7605,21 @@
}
}
report = lineNum > 1 ? report + (" (at line " + lineNum + ", character " + (offset - lineStart + 1) + ")\n") : report + (" (at character " + (offset + 1) + ")\n");
- lineEnd = source.length;
for (i = offset; i < lineEnd; ++i) {
- char = B.JSString_methods.codeUnitAt$1(source, i);
+ if (!(i >= 0))
+ return A.ioore(source, i);
+ char = source.charCodeAt(i);
if (char === 10 || char === 13) {
lineEnd = i;
break;
}
}
- if (lineEnd - lineStart > 78)
+ prefix = "";
+ if (lineEnd - lineStart > 78) {
+ postfix = "...";
if (offset - lineStart < 75) {
end = lineStart + 75;
start = lineStart;
- prefix = "";
- postfix = "...";
} else {
if (lineEnd - offset < 75) {
start = lineEnd - 75;
@@ -7479,14 +7628,12 @@
} else {
start = offset - 36;
end = offset + 36;
- postfix = "...";
}
prefix = "...";
}
- else {
+ } else {
end = lineEnd;
start = lineStart;
- prefix = "";
postfix = "";
}
return report + prefix + B.JSString_methods.substring$2(source, start, end) + postfix + "\n" + B.JSString_methods.$mul(" ", offset - start + prefix.length) + "^\n";
@@ -7505,24 +7652,23 @@
return count;
},
elementAt$1(_, index) {
- var t1, elementIndex, element;
+ var iterator, skipCount;
A.RangeError_checkNotNegative(index, "index");
- for (t1 = this.get$iterator(this), elementIndex = 0; t1.moveNext$0();) {
- element = t1.get$current(t1);
- if (index === elementIndex)
- return element;
- ++elementIndex;
+ iterator = this.get$iterator(this);
+ for (skipCount = index; iterator.moveNext$0();) {
+ if (skipCount === 0)
+ return iterator.get$current();
+ --skipCount;
}
- throw A.wrapException(A.IndexError$withLength(index, elementIndex, this, "index"));
+ throw A.wrapException(A.IndexError$withLength(index, index - skipCount, this, "index"));
},
toString$0(_) {
- return A.IterableBase_iterableToShortString(this, "(", ")");
+ return A.Iterable_iterableToShortString(this, "(", ")");
}
};
- A.Iterator.prototype = {};
A.Null.prototype = {
get$hashCode(_) {
- return A.Object.prototype.get$hashCode.call(this, this);
+ return A.Object.prototype.get$hashCode.call(this, 0);
},
toString$0(_) {
return "null";
@@ -7539,8 +7685,10 @@
return "Instance of '" + A.Primitives_objectTypeName(this) + "'";
},
noSuchMethod$1(_, invocation) {
- type$.Invocation._as(invocation);
- throw A.wrapException(A.NoSuchMethodError$_(this, invocation.get$memberName(), invocation.get$positionalArguments(), invocation.get$namedArguments(), null));
+ throw A.wrapException(A.NoSuchMethodError_NoSuchMethodError$withInvocation(this, type$.Invocation._as(invocation)));
+ },
+ get$runtimeType(_) {
+ return A.getRuntimeTypeOfDartObject(this);
},
toString() {
return this.toString$0(this);
@@ -7561,1470 +7709,847 @@
return t1.charCodeAt(0) == 0 ? t1 : t1;
}
};
- A.HtmlElement.prototype = {};
- A.AccessibleNodeList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.AnchorElement.prototype = {
- toString$0(receiver) {
- return String(receiver);
- }
- };
- A.AreaElement.prototype = {
- toString$0(receiver) {
- return String(receiver);
- }
+ A.jsify__convert.prototype = {
+ call$1(o) {
+ var t1, convertedMap, key, convertedList;
+ if (A._noJsifyRequired(o))
+ return o;
+ t1 = this._convertedObjects;
+ if (t1.containsKey$1(o))
+ return t1.$index(0, o);
+ if (type$.Map_of_nullable_Object_and_nullable_Object._is(o)) {
+ convertedMap = {};
+ t1.$indexSet(0, o, convertedMap);
+ for (t1 = o.get$keys(), t1 = t1.get$iterator(t1); t1.moveNext$0();) {
+ key = t1.get$current();
+ convertedMap[key] = this.call$1(o.$index(0, key));
+ }
+ return convertedMap;
+ } else if (type$.Iterable_nullable_Object._is(o)) {
+ convertedList = [];
+ t1.$indexSet(0, o, convertedList);
+ B.JSArray_methods.addAll$1(convertedList, J.map$1$1$ax(o, this, type$.dynamic));
+ return convertedList;
+ } else
+ return o;
+ },
+ $signature: 8
};
- A.Blob.prototype = {$isBlob: 1};
- A.CharacterData.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
+ A.promiseToFuture_closure.prototype = {
+ call$1(r) {
+ return this.completer.complete$1(this.T._eval$1("0/?")._as(r));
+ },
+ $signature: 3
};
- A.CryptoKey.prototype = {$isCryptoKey: 1};
- A.CssPerspective.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.CssRule.prototype = {$isCssRule: 1};
- A.CssStyleDeclaration.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.CssStyleDeclarationBase.prototype = {};
- A.CssStyleValue.prototype = {};
- A.CssTransformComponent.prototype = {};
- A.CssTransformValue.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
+ A.promiseToFuture_closure0.prototype = {
+ call$1(e) {
+ if (e == null)
+ return this.completer.completeError$1(new A.NullRejectionException(e === undefined));
+ return this.completer.completeError$1(e);
+ },
+ $signature: 3
};
- A.CssUnparsedValue.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
+ A.dartify_convert.prototype = {
+ call$1(o) {
+ var t1, millisSinceEpoch, proto, t2, dartObject, originalKeys, dartKeys, i, jsKey, dartKey, l, $length;
+ if (A._noDartifyRequired(o))
+ return o;
+ t1 = this._convertedObjects;
+ o.toString;
+ if (t1.containsKey$1(o))
+ return t1.$index(0, o);
+ if (o instanceof Date) {
+ millisSinceEpoch = o.getTime();
+ if (millisSinceEpoch < -864e13 || millisSinceEpoch > 864e13)
+ A.throwExpression(A.RangeError$range(millisSinceEpoch, -864e13, 864e13, "millisecondsSinceEpoch", null));
+ A.checkNotNullable(true, "isUtc", type$.bool);
+ return new A.DateTime(millisSinceEpoch, 0, true);
+ }
+ if (o instanceof RegExp)
+ throw A.wrapException(A.ArgumentError$("structured clone of RegExp", null));
+ if (typeof Promise != "undefined" && o instanceof Promise)
+ return A.promiseToFuture(o, type$.nullable_Object);
+ proto = Object.getPrototypeOf(o);
+ if (proto === Object.prototype || proto === null) {
+ t2 = type$.nullable_Object;
+ dartObject = A.LinkedHashMap_LinkedHashMap$_empty(t2, t2);
+ t1.$indexSet(0, o, dartObject);
+ originalKeys = Object.keys(o);
+ dartKeys = [];
+ for (t1 = J.getInterceptor$ax(originalKeys), t2 = t1.get$iterator(originalKeys); t2.moveNext$0();)
+ dartKeys.push(A.dartify(t2.get$current()));
+ for (i = 0; i < t1.get$length(originalKeys); ++i) {
+ jsKey = t1.$index(originalKeys, i);
+ if (!(i < dartKeys.length))
+ return A.ioore(dartKeys, i);
+ dartKey = dartKeys[i];
+ if (jsKey != null)
+ dartObject.$indexSet(0, dartKey, this.call$1(o[jsKey]));
+ }
+ return dartObject;
+ }
+ if (o instanceof Array) {
+ l = o;
+ dartObject = [];
+ t1.$indexSet(0, o, dartObject);
+ $length = A._asInt(o.length);
+ for (t1 = J.getInterceptor$asx(l), i = 0; i < $length; ++i)
+ dartObject.push(this.call$1(t1.$index(l, i)));
+ return dartObject;
+ }
+ return o;
+ },
+ $signature: 8
};
- A.DataTransferItem.prototype = {
- get$kind(receiver) {
- return receiver.kind;
+ A.NullRejectionException.prototype = {
+ toString$0(_) {
+ return "Promise was rejected with a value of `" + (this.isUndefined ? "undefined" : "null") + "`.";
}
};
- A.DataTransferItemList.prototype = {
- get$length(receiver) {
- return receiver.length;
+ A._JSSecureRandom.prototype = {
+ _JSSecureRandom$0() {
+ var $crypto = self.crypto;
+ if ($crypto != null)
+ if ($crypto.getRandomValues != null)
+ return;
+ throw A.wrapException(A.UnsupportedError$("No source of cryptographically secure random numbers available."));
},
- $index(receiver, index) {
- return receiver[A._asInt(index)];
+ nextInt$1(max) {
+ var byteCount, t1, start, randomLimit, t2, t3, random, result, _null = null;
+ if (max <= 0 || max > 4294967296)
+ throw A.wrapException(new A.RangeError(_null, _null, false, _null, _null, "max must be in range 0 < max \u2264 2^32, was " + max));
+ if (max > 255)
+ if (max > 65535)
+ byteCount = max > 16777215 ? 4 : 3;
+ else
+ byteCount = 2;
+ else
+ byteCount = 1;
+ t1 = this._math$_buffer;
+ t1.$flags & 2 && A.throwUnsupportedOperation(t1, 11);
+ t1.setUint32(0, 0, false);
+ start = 4 - byteCount;
+ randomLimit = A._asInt(Math.pow(256, byteCount));
+ for (t2 = max - 1, t3 = (max & t2) === 0; true;) {
+ crypto.getRandomValues(J.asUint8List$2$x(B.NativeByteData_methods.get$buffer(t1), start, byteCount));
+ random = t1.getUint32(0, false);
+ if (t3)
+ return (random & t2) >>> 0;
+ result = random % max;
+ if (random - result + max < randomLimit)
+ return result;
+ }
}
};
- A.DedicatedWorkerGlobalScope.prototype = {
- postMessage$1(receiver, message) {
- receiver.postMessage(new A._StructuredCloneDart2Js([], []).walk$1(message));
- return;
- },
- $isDedicatedWorkerGlobalScope: 1
- };
- A.DomException.prototype = {
- toString$0(receiver) {
- return String(receiver);
+ A.CryptorError.prototype = {
+ _enumToString$0() {
+ return "CryptorError." + this._name;
}
};
- A.DomRectList.prototype = {
- get$length(receiver) {
- return receiver.length;
+ A.FrameInfo.prototype = {};
+ A.FrameCryptor.prototype = {
+ get$enabled() {
+ if (this.participantIdentity == null)
+ return false;
+ return this._enabled;
},
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
+ setupTransform$6$codec$kind$operation$readable$trackId$writable(codec, kind, operation, readable, trackId, writable) {
+ return this.setupTransform$body$FrameCryptor(codec, kind, operation, readable, trackId, writable);
},
- $indexSet(receiver, index, value) {
- type$.Rectangle_num._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
+ setupTransform$5$kind$operation$readable$trackId$writable(kind, operation, readable, trackId, writable) {
+ return this.setupTransform$6$codec$kind$operation$readable$trackId$writable(null, kind, operation, readable, trackId, writable);
},
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
+ setupTransform$body$FrameCryptor(codec, kind, operation, readable, trackId, writable) {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ $async$self = this, transformer, e, t2, t3, t4, t5, exception, t1;
+ var $async$setupTransform$6$codec$kind$operation$readable$trackId$writable = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1)
+ return A._asyncRethrow($async$result, $async$completer);
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ t1 = $.$get$logger();
+ t1.log$4(B.Level_INFO_800, "setupTransform " + operation + " kind " + kind, null, null);
+ $async$self.__FrameCryptor_kind_A = kind;
+ if (codec != null) {
+ t1.log$4(B.Level_INFO_800, "setting codec on cryptor to " + codec, null, null);
+ $async$self.codec = codec;
+ }
+ t1 = self.TransformStream;
+ t2 = operation === "encode" ? $async$self.get$encodeFunction() : $async$self.get$decodeFunction();
+ t3 = type$.Future_void_Function_JSObject_JSObject;
+ t4 = type$.String;
+ t5 = type$.JSObject;
+ transformer = t5._as(new t1(t5._as(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["transform", A.allowInterop(t2, t3)], t4, t3)))));
+ try {
+ t5._as(t5._as(readable.pipeThrough(transformer)).pipeTo(writable));
+ } catch (exception) {
+ e = A.unwrapException(exception);
+ $.$get$logger().log$4(B.Level_WARNING_900, "e " + J.toString$0$(e), null, null);
+ if ($async$self.lastError !== B.CryptorError_7) {
+ $async$self.lastError = B.CryptorError_7;
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", $async$self.participantIdentity, "state", "internalError", "error", "Internal error: " + J.toString$0$(e)], t4, type$.nullable_String)));
+ }
+ }
+ $async$self.trackId = trackId;
+ // implicit return
+ return A._asyncReturn(null, $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$setupTransform$6$codec$kind$operation$readable$trackId$writable, $async$completer);
},
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.DomRectReadOnly.prototype = {
- toString$0(receiver) {
- var t2,
- t1 = receiver.left;
- t1.toString;
- t2 = receiver.top;
- t2.toString;
- return "Rectangle (" + A.S(t1) + ", " + A.S(t2) + ") " + A.S(this.get$width(receiver)) + " x " + A.S(this.get$height(receiver));
+ getUnencryptedBytes$2(obj, codec) {
+ var naluIndices, t1, t2, _i, index, type, _null = null, frameType = "",
+ data = A.NativeUint8List_NativeUint8List$view(type$.NativeByteBuffer._as(obj.data), 0, _null);
+ if ("type" in obj) {
+ frameType = A._asString(obj.type);
+ $.$get$logger().log$4(B.Level_FINER_400, "frameType: " + frameType, _null, _null);
+ }
+ if (codec != null && codec.toLowerCase() === "h264") {
+ type$.Uint8List._as(data);
+ naluIndices = A.findNALUIndices(data);
+ for (t1 = naluIndices.length, t2 = data.length, _i = 0; _i < naluIndices.length; naluIndices.length === t1 || (0, A.throwConcurrentModificationError)(naluIndices), ++_i) {
+ index = naluIndices[_i];
+ if (!(index < t2))
+ return A.ioore(data, index);
+ type = data[index] & 31;
+ switch (type) {
+ case 5:
+ case 1:
+ t1 = index + 2;
+ $.$get$logger().log$4(B.Level_FINER_400, "unEncryptedBytes NALU of type " + type + ", offset " + t1, _null, _null);
+ return t1;
+ default:
+ $.$get$logger().log$4(B.Level_FINER_400, "skipping NALU of type " + type, _null, _null);
+ break;
+ }
+ }
+ throw A.wrapException(A.Exception_Exception("Could not find NALU"));
+ }
+ switch (frameType) {
+ case "key":
+ return 10;
+ case "delta":
+ return 3;
+ case "audio":
+ return 1;
+ default:
+ return 0;
+ }
},
- $eq(receiver, other) {
- var t1, t2;
- if (other == null)
- return false;
- if (type$.Rectangle_num._is(other)) {
- t1 = receiver.left;
- t1.toString;
- t2 = other.left;
- t2.toString;
- if (t1 === t2) {
- t1 = receiver.top;
- t1.toString;
- t2 = other.top;
- t2.toString;
- if (t1 === t2) {
- t1 = J.getInterceptor$x(other);
- t1 = this.get$width(receiver) === t1.get$width(other) && this.get$height(receiver) === t1.get$height(other);
- } else
- t1 = false;
- } else
- t1 = false;
+ readFrameInfo$1(frameObj) {
+ var buffer, frameType, t1, synchronizationSource, timestamp;
+ new Uint8Array(0);
+ buffer = A.NativeUint8List_NativeUint8List$view(type$.NativeByteBuffer._as(frameObj.data), 0, null);
+ if ("type" in frameObj) {
+ frameType = A._asString(frameObj.type);
+ $.$get$logger().log$4(B.Level_FINER_400, "frameType: " + frameType, null, null);
} else
- t1 = false;
- return t1;
- },
- get$hashCode(receiver) {
- var t2,
- t1 = receiver.left;
- t1.toString;
- t2 = receiver.top;
- t2.toString;
- return A.Object_hash(t1, t2, this.get$width(receiver), this.get$height(receiver));
- },
- get$_height(receiver) {
- return receiver.height;
- },
- get$height(receiver) {
- var t1 = this.get$_height(receiver);
- t1.toString;
- return t1;
- },
- get$_width(receiver) {
- return receiver.width;
+ frameType = "";
+ t1 = type$.JSObject;
+ synchronizationSource = A._asInt(t1._as(frameObj.getMetadata()).synchronizationSource);
+ if ("rtpTimestamp" in t1._as(frameObj.getMetadata()))
+ timestamp = B.JSInt_methods.toInt$0(A._asInt(t1._as(frameObj.getMetadata()).rtpTimestamp));
+ else
+ timestamp = "timestamp" in frameObj ? A._asInt(A._asDouble(frameObj.timestamp)) : 0;
+ return new A.FrameInfo(frameType, synchronizationSource, timestamp, buffer);
},
- get$width(receiver) {
- var t1 = this.get$_width(receiver);
- t1.toString;
- return t1;
+ enqueueFrame$3(frameObj, controller, buffer) {
+ var t1 = type$.NativeByteBuffer._as(B.NativeUint8List_methods.get$buffer(buffer.toBytes$0()));
+ frameObj.data = t1;
+ controller.enqueue(frameObj);
},
- $isRectangle: 1
- };
- A.DomStringList.prototype = {
- get$length(receiver) {
- return receiver.length;
+ encodeFunction$2(frameObj, controller) {
+ var t1 = type$.JSObject;
+ return this.encodeFunction$body$FrameCryptor(t1._as(frameObj), t1._as(controller));
},
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
+ encodeFunction$body$FrameCryptor(frameObj, controller) {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ $async$returnValue, $async$handler = 2, $async$errorStack = [], $async$self = this, srcFrame, secretKey, keyIndex, headerLength, iv, frameTrailer, cipherText, finalBuffer, e, t1, t2, t3, t4, iv0, sendCount, t5, t6, t7, exception, $async$exception, $async$temp1;
+ var $async$encodeFunction$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1) {
+ $async$errorStack.push($async$result);
+ $async$goto = $async$handler;
+ }
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ $async$handler = 4;
+ t1 = true;
+ if ($async$self.get$enabled()) {
+ t2 = type$.NativeByteBuffer;
+ if (!(t2._as(frameObj.data).byteLength === 0))
+ t1 = t2._as(frameObj.data).byteLength === 0;
+ }
+ if (t1) {
+ if ($async$self.keyHandler.keyOptions.discardFrameWhenCryptorNotReady) {
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ controller.enqueue(frameObj);
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ srcFrame = $async$self.readFrameInfo$1(frameObj);
+ t1 = $.$get$logger();
+ t1.log$4(B.Level_FINE_500, "encodeFunction: buffer " + srcFrame.buffer.length + ", synchronizationSource " + srcFrame.ssrc + " frameType " + srcFrame.frameType, null, null);
+ t2 = $async$self.keyHandler.getKeySet$1($async$self.currentKeyIndex);
+ secretKey = t2 == null ? null : t2.encryptionKey;
+ keyIndex = $async$self.currentKeyIndex;
+ if (secretKey == null) {
+ if ($async$self.lastError !== B.CryptorError_5) {
+ $async$self.lastError = B.CryptorError_5;
+ t1 = $async$self.participantIdentity;
+ t2 = $async$self.trackId;
+ t3 = $async$self.__FrameCryptor_kind_A;
+ t3 === $ && A.throwLateFieldNI("kind");
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", t1, "trackId", t2, "kind", t3, "state", "missingKey", "error", "Missing key for track " + t2], type$.String, type$.nullable_String)));
+ }
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ t2 = $async$self.__FrameCryptor_kind_A;
+ t2 === $ && A.throwLateFieldNI("kind");
+ headerLength = t2 === "video" ? $async$self.getUnencryptedBytes$2(frameObj, $async$self.codec) : 1;
+ t3 = srcFrame.ssrc;
+ t4 = srcFrame.timestamp;
+ iv0 = new DataView(new ArrayBuffer(12));
+ t2 = $async$self.sendCounts;
+ if (t2.$index(0, t3) == null)
+ t2.$indexSet(0, t3, $.$get$Random__secureRandom().nextInt$1(65535));
+ sendCount = t2.$index(0, t3);
+ if (sendCount == null)
+ sendCount = 0;
+ iv0.setUint32(0, t3, false);
+ iv0.setUint32(4, t4, false);
+ iv0.setUint32(8, t4 - B.JSInt_methods.$mod(sendCount, 65535), false);
+ t2.$indexSet(0, t3, sendCount + 1);
+ iv = J.asUint8List$0$x(B.NativeByteData_methods.get$buffer(iv0));
+ frameTrailer = new DataView(new ArrayBuffer(2));
+ t2 = frameTrailer;
+ t2.$flags & 2 && A.throwUnsupportedOperation(t2, 6);
+ J._setInt8$2$x(t2, 0, 12);
+ t2 = frameTrailer;
+ t3 = A._asInt(keyIndex);
+ t2.$flags & 2 && A.throwUnsupportedOperation(t2, 6);
+ J._setInt8$2$x(t2, 1, t3);
+ t3 = $async$self.worker;
+ t2 = type$.JSObject;
+ t4 = t2._as(t2._as(t3.crypto).subtle);
+ t5 = type$.String;
+ t6 = type$.Object;
+ t7 = A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", "AES-GCM", "iv", iv, "additionalData", B.NativeUint8List_methods.sublist$2(srcFrame.buffer, 0, headerLength)], t5, t6));
+ t6 = t7 == null ? t6._as(t7) : t7;
+ $async$temp1 = type$.NativeByteBuffer;
+ $async$goto = 7;
+ return A._asyncAwait(A.promiseToFuture(t2._as(t4.encrypt(t6, secretKey, B.NativeUint8List_methods.sublist$2(srcFrame.buffer, headerLength, srcFrame.buffer.length))), type$.nullable_Object), $async$encodeFunction$2);
+ case 7:
+ // returning from await.
+ cipherText = $async$temp1._as($async$result);
+ t1.log$4(B.Level_FINER_400, "encodeFunction: encrypted buffer: " + srcFrame.buffer.length + ", cipherText: " + A.NativeUint8List_NativeUint8List$view(cipherText, 0, null).length, null, null);
+ t2 = $.$get$_CopyingBytesBuilder__emptyList();
+ finalBuffer = new A._CopyingBytesBuilder(t2);
+ J.add$1$ax(finalBuffer, new Uint8Array(A._ensureNativeList(B.NativeUint8List_methods.sublist$2(srcFrame.buffer, 0, headerLength))));
+ J.add$1$ax(finalBuffer, A.NativeUint8List_NativeUint8List$view(cipherText, 0, null));
+ J.add$1$ax(finalBuffer, iv);
+ J.add$1$ax(finalBuffer, J.asUint8List$0$x(J.get$buffer$x(frameTrailer)));
+ $async$self.enqueueFrame$3(frameObj, controller, finalBuffer);
+ if ($async$self.lastError !== B.CryptorError_1) {
+ $async$self.lastError = B.CryptorError_1;
+ t3.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", $async$self.participantIdentity, "trackId", $async$self.trackId, "kind", $async$self.__FrameCryptor_kind_A, "state", "ok", "error", "encryption ok"], t5, type$.nullable_String)));
+ }
+ t1.log$4(B.Level_FINER_400, "encodeFunction[CryptorError.kOk]: frame enqueued kind " + $async$self.__FrameCryptor_kind_A + ",codec " + A.S($async$self.codec) + " headerLength: " + A.S(headerLength) + ", timestamp: " + srcFrame.timestamp + ", ssrc: " + srcFrame.ssrc + ", data length: " + srcFrame.buffer.length + ", encrypted length: " + finalBuffer.toBytes$0().length + ", iv " + A.S(iv), null, null);
+ $async$handler = 2;
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 4:
+ // catch
+ $async$handler = 3;
+ $async$exception = $async$errorStack.pop();
+ e = A.unwrapException($async$exception);
+ $.$get$logger().log$4(B.Level_WARNING_900, "encodeFunction encrypt: e " + J.toString$0$(e), null, null);
+ if ($async$self.lastError !== B.CryptorError_3) {
+ $async$self.lastError = B.CryptorError_3;
+ t1 = $async$self.participantIdentity;
+ t2 = $async$self.trackId;
+ t3 = $async$self.__FrameCryptor_kind_A;
+ t3 === $ && A.throwLateFieldNI("kind");
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", t1, "trackId", t2, "kind", t3, "state", "encryptError", "error", J.toString$0$(e)], type$.String, type$.nullable_String)));
+ }
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 3:
+ // uncaught
+ // goto rethrow
+ $async$goto = 2;
+ break;
+ case 6:
+ // after finally
+ case 1:
+ // return
+ return A._asyncReturn($async$returnValue, $async$completer);
+ case 2:
+ // rethrow
+ return A._asyncRethrow($async$errorStack.at(-1), $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$encodeFunction$2, $async$completer);
},
- $indexSet(receiver, index, value) {
- A._asString(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
+ decodeFunction$2(frameObj, controller) {
+ var t1 = type$.JSObject;
+ return this.decodeFunction$body$FrameCryptor(t1._as(frameObj), t1._as(controller));
},
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.DomTokenList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.Element.prototype = {
- toString$0(receiver) {
- return receiver.localName;
- }
- };
- A.Event.prototype = {$isEvent: 1};
- A.EventTarget.prototype = {
- addEventListener$3(receiver, type, listener, useCapture) {
- type$.nullable_dynamic_Function_Event._as(listener);
- if (listener != null)
- this._addEventListener$3(receiver, type, listener, false);
- },
- _addEventListener$3(receiver, type, listener, options) {
- return receiver.addEventListener(type, A.convertDartClosureToJS(type$.nullable_dynamic_Function_Event._as(listener), 1), false);
- },
- $isEventTarget: 1
- };
- A.File.prototype = {$isFile: 1};
- A.FileList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.File._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1,
- $isFileList: 1
- };
- A.FileWriter.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.FormElement.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.Gamepad.prototype = {$isGamepad: 1};
- A.History.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.HtmlCollection.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.Node._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.ImageData.prototype = {$isImageData: 1};
- A.Location.prototype = {
- toString$0(receiver) {
- return String(receiver);
- }
- };
- A.MediaDeviceInfo.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- }
- };
- A.MediaList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.MediaStreamTrack.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- }
- };
- A.MessageEvent.prototype = {$isMessageEvent: 1};
- A.MessagePort.prototype = {$isMessagePort: 1};
- A.MidiInputMap.prototype = {
- $index(receiver, key) {
- return A.convertNativeToDart_Dictionary(receiver.get(A._asString(key)));
- },
- forEach$1(receiver, f) {
- var entries, entry;
- type$.void_Function_String_dynamic._as(f);
- entries = receiver.entries();
- for (; true;) {
- entry = entries.next();
- if (entry.done)
- return;
- f.call$2(entry.value[0], A.convertNativeToDart_Dictionary(entry.value[1]));
- }
- },
- get$keys(receiver) {
- var keys = A._setArrayType([], type$.JSArray_String);
- this.forEach$1(receiver, new A.MidiInputMap_keys_closure(keys));
- return keys;
- },
- get$length(receiver) {
- return receiver.size;
- },
- $isMap: 1
- };
- A.MidiInputMap_keys_closure.prototype = {
- call$2(k, v) {
- return B.JSArray_methods.add$1(this.keys, k);
- },
- $signature: 2
- };
- A.MidiOutputMap.prototype = {
- $index(receiver, key) {
- return A.convertNativeToDart_Dictionary(receiver.get(A._asString(key)));
- },
- forEach$1(receiver, f) {
- var entries, entry;
- type$.void_Function_String_dynamic._as(f);
- entries = receiver.entries();
- for (; true;) {
- entry = entries.next();
- if (entry.done)
- return;
- f.call$2(entry.value[0], A.convertNativeToDart_Dictionary(entry.value[1]));
- }
- },
- get$keys(receiver) {
- var keys = A._setArrayType([], type$.JSArray_String);
- this.forEach$1(receiver, new A.MidiOutputMap_keys_closure(keys));
- return keys;
- },
- get$length(receiver) {
- return receiver.size;
- },
- $isMap: 1
- };
- A.MidiOutputMap_keys_closure.prototype = {
- call$2(k, v) {
- return B.JSArray_methods.add$1(this.keys, k);
- },
- $signature: 2
- };
- A.MimeType.prototype = {$isMimeType: 1};
- A.MimeTypeArray.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.MimeType._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.Node.prototype = {
- toString$0(receiver) {
- var value = receiver.nodeValue;
- return value == null ? this.super$Interceptor$toString(receiver) : value;
- },
- $isNode: 1
- };
- A.NodeList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.Node._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.Plugin.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $isPlugin: 1
- };
- A.PluginArray.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.Plugin._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.RtcStatsReport.prototype = {
- $index(receiver, key) {
- return A.convertNativeToDart_Dictionary(receiver.get(A._asString(key)));
- },
- forEach$1(receiver, f) {
- var entries, entry;
- type$.void_Function_String_dynamic._as(f);
- entries = receiver.entries();
- for (; true;) {
- entry = entries.next();
- if (entry.done)
- return;
- f.call$2(entry.value[0], A.convertNativeToDart_Dictionary(entry.value[1]));
- }
- },
- get$keys(receiver) {
- var keys = A._setArrayType([], type$.JSArray_String);
- this.forEach$1(receiver, new A.RtcStatsReport_keys_closure(keys));
- return keys;
- },
- get$length(receiver) {
- return receiver.size;
- },
- $isMap: 1
- };
- A.RtcStatsReport_keys_closure.prototype = {
- call$2(k, v) {
- return B.JSArray_methods.add$1(this.keys, k);
- },
- $signature: 2
- };
- A.SelectElement.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.SharedArrayBuffer.prototype = {$isSharedArrayBuffer: 1};
- A.SourceBuffer.prototype = {$isSourceBuffer: 1};
- A.SourceBufferList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.SourceBuffer._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.SpeechGrammar.prototype = {$isSpeechGrammar: 1};
- A.SpeechGrammarList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.SpeechGrammar._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.SpeechRecognitionResult.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $isSpeechRecognitionResult: 1
- };
- A.Storage.prototype = {
- $index(receiver, key) {
- return receiver.getItem(A._asString(key));
- },
- forEach$1(receiver, f) {
- var i, key, t1;
- type$.void_Function_String_String._as(f);
- for (i = 0; true; ++i) {
- key = receiver.key(i);
- if (key == null)
- return;
- t1 = receiver.getItem(key);
- t1.toString;
- f.call$2(key, t1);
- }
- },
- get$keys(receiver) {
- var keys = A._setArrayType([], type$.JSArray_String);
- this.forEach$1(receiver, new A.Storage_keys_closure(keys));
- return keys;
- },
- get$length(receiver) {
- return receiver.length;
- },
- $isMap: 1
- };
- A.Storage_keys_closure.prototype = {
- call$2(k, v) {
- return B.JSArray_methods.add$1(this.keys, k);
- },
- $signature: 18
- };
- A.StyleSheet.prototype = {$isStyleSheet: 1};
- A.TextTrack.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- },
- $isTextTrack: 1
- };
- A.TextTrackCue.prototype = {$isTextTrackCue: 1};
- A.TextTrackCueList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.TextTrackCue._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.TextTrackList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.TextTrack._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.TimeRanges.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.Touch.prototype = {$isTouch: 1};
- A.TouchList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.Touch._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.TrackDefaultList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.TrackElement.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- }
- };
- A.Url.prototype = {
- toString$0(receiver) {
- return String(receiver);
- }
- };
- A.VideoTrack.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- }
- };
- A.VideoTrackList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.WorkerGlobalScope.prototype = {};
- A._CssRuleList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.CssRule._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A._DomRect.prototype = {
- toString$0(receiver) {
- var t2, t3, t4,
- t1 = receiver.left;
- t1.toString;
- t2 = receiver.top;
- t2.toString;
- t3 = receiver.width;
- t3.toString;
- t4 = receiver.height;
- t4.toString;
- return "Rectangle (" + A.S(t1) + ", " + A.S(t2) + ") " + A.S(t3) + " x " + A.S(t4);
- },
- $eq(receiver, other) {
- var t1, t2;
- if (other == null)
- return false;
- if (type$.Rectangle_num._is(other)) {
- t1 = receiver.left;
- t1.toString;
- t2 = other.left;
- t2.toString;
- if (t1 === t2) {
- t1 = receiver.top;
- t1.toString;
- t2 = other.top;
- t2.toString;
- if (t1 === t2) {
- t1 = receiver.width;
- t1.toString;
- t2 = J.getInterceptor$x(other);
- if (t1 === t2.get$width(other)) {
- t1 = receiver.height;
+ decodeFunction$body$FrameCryptor(frameObj, controller) {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ $async$returnValue, $async$handler = 2, $async$errorStack = [], $async$self = this, headerLength, frameTrailer, ivLength, keyIndex, iv, decryptFrameInternal, ratchedKeyInternal, e, finalBuffer, e0, t2, t3, t4, t5, t6, magicBytesBuffer, t7, initialKeySet, exception, t1, srcFrame, $async$exception, $async$exception1;
+ var $async$decodeFunction$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1) {
+ $async$errorStack.push($async$result);
+ $async$goto = $async$handler;
+ }
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ t1 = {};
+ srcFrame = $async$self.readFrameInfo$1(frameObj);
+ t1.ratchetCount = 0;
+ t2 = $.$get$logger();
+ t2.log$4(B.Level_FINE_500, "decodeFunction: frame lenght " + srcFrame.buffer.length, null, null);
+ t1.initialKeySet = t1.decrypted = null;
+ t1.initialKeyIndex = $async$self.currentKeyIndex;
+ if (!$async$self.get$enabled() || srcFrame.buffer.length === 0) {
+ $async$self.sifGuard.recordUserFrame$0();
+ if ($async$self.keyHandler.keyOptions.discardFrameWhenCryptorNotReady) {
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ t2.log$4(B.Level_FINE_500, "enqueing empty frame", null, null);
+ controller.enqueue(frameObj);
+ t2.log$4(B.Level_FINER_400, "enqueing silent frame", null, null);
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ t3 = $async$self.keyHandler.keyOptions.uncryptedMagicBytes;
+ if (t3 != null) {
+ t4 = srcFrame.buffer;
+ t5 = t3.length;
+ t6 = t5 + 1;
+ if (t4.length > t6) {
+ magicBytesBuffer = B.NativeUint8List_methods.sublist$2(srcFrame.buffer, srcFrame.buffer.length - t5 - 1, srcFrame.buffer.length - 1);
+ t2.log$4(B.Level_FINER_400, "magicBytesBuffer " + A.S(magicBytesBuffer) + ", magicBytes " + A.S(t3), null, null);
+ t4 = $async$self.sifGuard;
+ if (A.Iterable_iterableToFullString(magicBytesBuffer, "[", "]") === A.Iterable_iterableToFullString(t3, "[", "]")) {
+ ++t4.consecutiveSifCount;
+ if (t4.sifSequenceStartedAt == null)
+ t4.sifSequenceStartedAt = Date.now();
+ t4.lastSifReceivedAt = Date.now();
+ if (t4.consecutiveSifCount < 100)
+ if (t4.sifSequenceStartedAt != null) {
+ t1 = Date.now();
+ t4 = t4.sifSequenceStartedAt;
+ t4.toString;
+ t4 = t1 - t4 < 2000;
+ t1 = t4;
+ } else
+ t1 = true;
+ else
+ t1 = false;
+ if (t1) {
+ t1 = B.NativeUint8List_methods.sublist$1(srcFrame.buffer, srcFrame.buffer.length - 1);
+ if (0 >= t1.length) {
+ $async$returnValue = A.ioore(t1, 0);
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ t2.log$4(B.Level_FINER_400, "ecodeFunction: skip uncrypted frame, type " + t1[0], null, null);
+ finalBuffer = new A._CopyingBytesBuilder($.$get$_CopyingBytesBuilder__emptyList());
+ finalBuffer.add$1(0, new Uint8Array(A._ensureNativeList(B.NativeUint8List_methods.sublist$2(srcFrame.buffer, 0, srcFrame.buffer.length - t6))));
+ $async$self.enqueueFrame$3(frameObj, controller, finalBuffer);
+ t2.log$4(B.Level_FINE_500, "ecodeFunction: enqueing silent frame", null, null);
+ controller.enqueue(frameObj);
+ } else
+ t2.log$4(B.Level_FINER_400, "ecodeFunction: SIF limit reached, dropping frame", null, null);
+ t2.log$4(B.Level_FINER_400, "ecodeFunction: enqueing silent frame", null, null);
+ controller.enqueue(frameObj);
+ // goto return
+ $async$goto = 1;
+ break;
+ } else
+ t4.recordUserFrame$0();
+ }
+ }
+ $async$handler = 4;
+ t3 = {};
+ t4 = $async$self.__FrameCryptor_kind_A;
+ t4 === $ && A.throwLateFieldNI("kind");
+ headerLength = t4 === "video" ? $async$self.getUnencryptedBytes$2(frameObj, $async$self.codec) : 1;
+ frameTrailer = B.NativeUint8List_methods.sublist$1(srcFrame.buffer, srcFrame.buffer.length - 2);
+ ivLength = J.$index$asx(frameTrailer, 0);
+ keyIndex = J.$index$asx(frameTrailer, 1);
+ t5 = srcFrame.buffer;
+ t6 = srcFrame.buffer;
+ t7 = ivLength;
+ if (typeof t7 !== "number") {
+ $async$returnValue = A.iae(t7);
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ iv = B.NativeUint8List_methods.sublist$2(t5, t6.length - t7 - 2, srcFrame.buffer.length - 2);
+ initialKeySet = t1.initialKeySet = $async$self.keyHandler.getKeySet$1(keyIndex);
+ t1.initialKeyIndex = keyIndex;
+ t2.log$4(B.Level_FINER_400, "decodeFunction: start decrypting frame headerLength " + A.S(headerLength) + " " + srcFrame.buffer.length + " frameTrailer " + A.S(frameTrailer) + ", ivLength " + A.S(ivLength) + ", keyIndex " + A.S(keyIndex) + ", iv " + A.S(iv), null, null);
+ if (initialKeySet == null || !$async$self.keyHandler._hasValidKey) {
+ if ($async$self.lastError !== B.CryptorError_5) {
+ $async$self.lastError = B.CryptorError_5;
+ t1 = $async$self.participantIdentity;
+ t2 = $async$self.trackId;
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", t1, "trackId", t2, "kind", $async$self.__FrameCryptor_kind_A, "state", "missingKey", "error", "Missing key for track " + t2], type$.String, type$.nullable_String)));
+ }
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ t3.currentkeySet = initialKeySet;
+ decryptFrameInternal = new A.FrameCryptor_decodeFunction_decryptFrameInternal(t1, t3, $async$self, iv, srcFrame, headerLength, ivLength);
+ ratchedKeyInternal = new A.FrameCryptor_decodeFunction_ratchedKeyInternal(t1, t3, $async$self, decryptFrameInternal);
+ $async$handler = 8;
+ $async$goto = 11;
+ return A._asyncAwait(decryptFrameInternal.call$0(), $async$decodeFunction$2);
+ case 11:
+ // returning from await.
+ $async$handler = 4;
+ // goto after finally
+ $async$goto = 10;
+ break;
+ case 8:
+ // catch
+ $async$handler = 7;
+ $async$exception = $async$errorStack.pop();
+ e = A.unwrapException($async$exception);
+ $async$self.lastError = B.CryptorError_7;
+ t2 = $.$get$logger();
+ t2.log$4(B.Level_FINER_400, "decodeFunction: kInternalError catch " + A.S(e), null, null);
+ $async$goto = 12;
+ return A._asyncAwait(ratchedKeyInternal.call$0(), $async$decodeFunction$2);
+ case 12:
+ // returning from await.
+ // goto after finally
+ $async$goto = 10;
+ break;
+ case 7:
+ // uncaught
+ // goto catch
+ $async$goto = 4;
+ break;
+ case 10:
+ // after finally
+ t3 = t1.decrypted;
+ if (t3 == null) {
+ t1 = A.Exception_Exception("[decodeFunction] decryption failed even after ratchting");
+ throw A.wrapException(t1);
+ }
+ t4 = $async$self.keyHandler;
+ t4._decryptionFailureCount = 0;
+ t4._hasValidKey = true;
+ t2.log$4(B.Level_FINER_400, "decodeFunction: decryption success, buffer length " + srcFrame.buffer.length + ", decrypted: " + A.NativeUint8List_NativeUint8List$view(t3, 0, null).length, null, null);
+ t3 = $.$get$_CopyingBytesBuilder__emptyList();
+ finalBuffer = new A._CopyingBytesBuilder(t3);
+ J.add$1$ax(finalBuffer, new Uint8Array(A._ensureNativeList(B.NativeUint8List_methods.sublist$2(srcFrame.buffer, 0, headerLength))));
+ t1 = t1.decrypted;
t1.toString;
- t2 = t1 === t2.get$height(other);
- t1 = t2;
- } else
- t1 = false;
- } else
- t1 = false;
- } else
- t1 = false;
- } else
- t1 = false;
- return t1;
- },
- get$hashCode(receiver) {
- var t2, t3, t4,
- t1 = receiver.left;
- t1.toString;
- t2 = receiver.top;
- t2.toString;
- t3 = receiver.width;
- t3.toString;
- t4 = receiver.height;
- t4.toString;
- return A.Object_hash(t1, t2, t3, t4);
- },
- get$_height(receiver) {
- return receiver.height;
- },
- get$height(receiver) {
- var t1 = receiver.height;
- t1.toString;
- return t1;
- },
- get$_width(receiver) {
- return receiver.width;
- },
- get$width(receiver) {
- var t1 = receiver.width;
- t1.toString;
- return t1;
- }
- };
- A._GamepadList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.nullable_Gamepad._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A._NamedNodeMap.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.Node._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A._SpeechRecognitionResultList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.SpeechRecognitionResult._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A._StyleSheetList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- var t1;
- A._asInt(index);
- t1 = receiver.length;
- if (index >>> 0 !== index || index >= t1)
- throw A.wrapException(A.IndexError$withLength(index, t1, receiver, null));
- return receiver[index];
- },
- $indexSet(receiver, index, value) {
- type$.StyleSheet._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- if (!(index >= 0 && index < receiver.length))
- return A.ioore(receiver, index);
- return receiver[index];
- },
- $isJSIndexable: 1,
- $isEfficientLengthIterable: 1,
- $isJavaScriptIndexingBehavior: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.EventStreamProvider.prototype = {};
- A._EventStream.prototype = {};
- A._EventStreamSubscription.prototype = {};
- A._EventStreamSubscription_closure.prototype = {
- call$1(e) {
- return this.onData.call$1(type$.Event._as(e));
- },
- $signature: 19
- };
- A.ImmutableListMixin.prototype = {
- get$iterator(receiver) {
- return new A.FixedSizeListIterator(receiver, this.get$length(receiver), A.instanceType(receiver)._eval$1("FixedSizeListIterator"));
- }
- };
- A.FixedSizeListIterator.prototype = {
- moveNext$0() {
- var _this = this,
- nextPosition = _this._position + 1,
- t1 = _this._html$_length;
- if (nextPosition < t1) {
- _this.set$_html$_current(J.$index$asx(_this._array, nextPosition));
- _this._position = nextPosition;
- return true;
- }
- _this.set$_html$_current(null);
- _this._position = t1;
- return false;
- },
- get$current(_) {
- var t1 = this._html$_current;
- return t1 == null ? this.$ti._precomputed1._as(t1) : t1;
- },
- set$_html$_current(_current) {
- this._html$_current = this.$ti._eval$1("1?")._as(_current);
- },
- $isIterator: 1
- };
- A._CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase.prototype = {};
- A._DomRectList_JavaScriptObject_ListMixin.prototype = {};
- A._DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._DomStringList_JavaScriptObject_ListMixin.prototype = {};
- A._DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._FileList_JavaScriptObject_ListMixin.prototype = {};
- A._FileList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._HtmlCollection_JavaScriptObject_ListMixin.prototype = {};
- A._HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._MidiInputMap_JavaScriptObject_MapMixin.prototype = {};
- A._MidiOutputMap_JavaScriptObject_MapMixin.prototype = {};
- A._MimeTypeArray_JavaScriptObject_ListMixin.prototype = {};
- A._MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._NodeList_JavaScriptObject_ListMixin.prototype = {};
- A._NodeList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._PluginArray_JavaScriptObject_ListMixin.prototype = {};
- A._PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._RtcStatsReport_JavaScriptObject_MapMixin.prototype = {};
- A._SourceBufferList_EventTarget_ListMixin.prototype = {};
- A._SourceBufferList_EventTarget_ListMixin_ImmutableListMixin.prototype = {};
- A._SpeechGrammarList_JavaScriptObject_ListMixin.prototype = {};
- A._SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._Storage_JavaScriptObject_MapMixin.prototype = {};
- A._TextTrackCueList_JavaScriptObject_ListMixin.prototype = {};
- A._TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._TextTrackList_EventTarget_ListMixin.prototype = {};
- A._TextTrackList_EventTarget_ListMixin_ImmutableListMixin.prototype = {};
- A._TouchList_JavaScriptObject_ListMixin.prototype = {};
- A._TouchList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.__CssRuleList_JavaScriptObject_ListMixin.prototype = {};
- A.__CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.__GamepadList_JavaScriptObject_ListMixin.prototype = {};
- A.__GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.__NamedNodeMap_JavaScriptObject_ListMixin.prototype = {};
- A.__NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin.prototype = {};
- A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.__StyleSheetList_JavaScriptObject_ListMixin.prototype = {};
- A.__StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._StructuredClone.prototype = {
- findSlot$1(value) {
- var i,
- t1 = this.values,
- $length = t1.length;
- for (i = 0; i < $length; ++i)
- if (t1[i] === value)
- return i;
- B.JSArray_methods.add$1(t1, value);
- B.JSArray_methods.add$1(this.copies, null);
- return $length;
- },
- walk$1(e) {
- var slot, t2, copy, _this = this, t1 = {};
- if (e == null)
- return e;
- if (A._isBool(e))
- return e;
- if (typeof e == "number")
- return e;
- if (typeof e == "string")
- return e;
- if (e instanceof A.DateTime)
- return new Date(e._value);
- if (type$.File._is(e))
- return e;
- if (type$.Blob._is(e))
- return e;
- if (type$.FileList._is(e))
- return e;
- if (type$.ImageData._is(e))
- return e;
- if (type$.NativeByteBuffer._is(e) || type$.NativeTypedData._is(e) || type$.MessagePort._is(e) || type$.SharedArrayBuffer._is(e))
- return e;
- if (type$.Map_dynamic_dynamic._is(e)) {
- slot = _this.findSlot$1(e);
- t2 = _this.copies;
- if (!(slot < t2.length))
- return A.ioore(t2, slot);
- copy = t1.copy = t2[slot];
- if (copy != null)
- return copy;
- copy = {};
- t1.copy = copy;
- B.JSArray_methods.$indexSet(t2, slot, copy);
- J.forEach$1$x(e, new A._StructuredClone_walk_closure(t1, _this));
- return t1.copy;
- }
- if (type$.List_dynamic._is(e)) {
- slot = _this.findSlot$1(e);
- t1 = _this.copies;
- if (!(slot < t1.length))
- return A.ioore(t1, slot);
- copy = t1[slot];
- if (copy != null)
- return copy;
- return _this.copyList$2(e, slot);
- }
- if (type$.JSObject._is(e)) {
- slot = _this.findSlot$1(e);
- t2 = _this.copies;
- if (!(slot < t2.length))
- return A.ioore(t2, slot);
- copy = t1.copy = t2[slot];
- if (copy != null)
- return copy;
- copy = {};
- t1.copy = copy;
- B.JSArray_methods.$indexSet(t2, slot, copy);
- _this.forEachObjectKey$2(e, new A._StructuredClone_walk_closure0(t1, _this));
- return t1.copy;
- }
- throw A.wrapException(A.UnimplementedError$("structured clone of other type"));
- },
- copyList$2(e, slot) {
- var i,
- t1 = J.getInterceptor$asx(e),
- $length = t1.get$length(e),
- copy = new Array($length);
- B.JSArray_methods.$indexSet(this.copies, slot, copy);
- for (i = 0; i < $length; ++i)
- B.JSArray_methods.$indexSet(copy, i, this.walk$1(t1.$index(e, i)));
- return copy;
- }
- };
- A._StructuredClone_walk_closure.prototype = {
- call$2(key, value) {
- this._box_0.copy[key] = this.$this.walk$1(value);
- },
- $signature: 20
- };
- A._StructuredClone_walk_closure0.prototype = {
- call$2(key, value) {
- this._box_0.copy[key] = this.$this.walk$1(value);
- },
- $signature: 21
- };
- A._AcceptStructuredClone.prototype = {
- findSlot$1(value) {
- var i,
- t1 = this.values,
- $length = t1.length;
- for (i = 0; i < $length; ++i)
- if (t1[i] === value)
- return i;
- B.JSArray_methods.add$1(t1, value);
- B.JSArray_methods.add$1(this.copies, null);
- return $length;
- },
- walk$1(e) {
- var millisSinceEpoch, t1, slot, copy, t2, map, l, $length, i, _this = this;
- if (e == null)
- return e;
- if (A._isBool(e))
- return e;
- if (typeof e == "number")
- return e;
- if (typeof e == "string")
- return e;
- if (e instanceof Date) {
- millisSinceEpoch = e.getTime();
- if (Math.abs(millisSinceEpoch) <= 864e13)
- t1 = false;
- else
- t1 = true;
- if (t1)
- A.throwExpression(A.ArgumentError$("DateTime is outside valid range: " + millisSinceEpoch, null));
- A.checkNotNullable(true, "isUtc", type$.bool);
- return new A.DateTime(millisSinceEpoch, true);
- }
- if (e instanceof RegExp)
- throw A.wrapException(A.UnimplementedError$("structured clone of RegExp"));
- if (typeof Promise != "undefined" && e instanceof Promise)
- return A.promiseToFuture(e, type$.dynamic);
- if (A.isJavaScriptSimpleObject(e)) {
- slot = _this.findSlot$1(e);
- t1 = _this.copies;
- if (!(slot < t1.length))
- return A.ioore(t1, slot);
- copy = t1[slot];
- if (copy != null)
- return copy;
- t2 = type$.dynamic;
- map = A.LinkedHashMap_LinkedHashMap$_empty(t2, t2);
- B.JSArray_methods.$indexSet(t1, slot, map);
- _this.forEachJsField$2(e, new A._AcceptStructuredClone_walk_closure(_this, map));
- return map;
- }
- if (e instanceof Array) {
- l = e;
- slot = _this.findSlot$1(l);
- t1 = _this.copies;
- if (!(slot < t1.length))
- return A.ioore(t1, slot);
- copy = t1[slot];
- if (copy != null)
- return copy;
- t2 = J.getInterceptor$asx(l);
- $length = t2.get$length(l);
- copy = _this.mustCopy ? new Array($length) : l;
- B.JSArray_methods.$indexSet(t1, slot, copy);
- for (t1 = J.getInterceptor$ax(copy), i = 0; i < $length; ++i)
- t1.$indexSet(copy, i, _this.walk$1(t2.$index(l, i)));
- return copy;
- }
- return e;
- }
- };
- A._AcceptStructuredClone_walk_closure.prototype = {
- call$2(key, value) {
- var t1 = this.$this.walk$1(value);
- this.map.$indexSet(0, key, t1);
- return t1;
- },
- $signature: 22
- };
- A._StructuredCloneDart2Js.prototype = {
- forEachObjectKey$2(object, action) {
- var t1, t2, _i, key;
- type$.dynamic_Function_dynamic_dynamic._as(action);
- for (t1 = Object.keys(object), t2 = t1.length, _i = 0; _i < t2; ++_i) {
- key = t1[_i];
- action.call$2(key, object[key]);
- }
- }
- };
- A._AcceptStructuredCloneDart2Js.prototype = {
- forEachJsField$2(object, action) {
- var t1, t2, _i, key;
- type$.dynamic_Function_dynamic_dynamic._as(action);
- for (t1 = Object.keys(object), t2 = t1.length, _i = 0; _i < t1.length; t1.length === t2 || (0, A.throwConcurrentModificationError)(t1), ++_i) {
- key = t1[_i];
- action.call$2(key, object[key]);
- }
+ J.add$1$ax(finalBuffer, A.NativeUint8List_NativeUint8List$view(t1, 0, null));
+ $async$self.enqueueFrame$3(frameObj, controller, finalBuffer);
+ if ($async$self.lastError !== B.CryptorError_1) {
+ $async$self.lastError = B.CryptorError_1;
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", $async$self.participantIdentity, "trackId", $async$self.trackId, "kind", $async$self.__FrameCryptor_kind_A, "state", "ok", "error", "decryption ok"], type$.String, type$.nullable_String)));
+ }
+ t2.log$4(B.Level_FINE_500, "decodeFunction[CryptorError.kOk]: decryption success kind " + $async$self.__FrameCryptor_kind_A + ", headerLength: " + A.S(headerLength) + ", timestamp: " + srcFrame.timestamp + ", ssrc: " + srcFrame.ssrc + ", data length: " + srcFrame.buffer.length + ", decrypted length: " + finalBuffer.toBytes$0().length + ", keyindex " + A.S(keyIndex) + " iv " + A.S(iv), null, null);
+ $async$handler = 2;
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 4:
+ // catch
+ $async$handler = 3;
+ $async$exception1 = $async$errorStack.pop();
+ e0 = A.unwrapException($async$exception1);
+ if ($async$self.lastError !== B.CryptorError_2) {
+ $async$self.lastError = B.CryptorError_2;
+ t1 = $async$self.participantIdentity;
+ t2 = $async$self.trackId;
+ t3 = $async$self.__FrameCryptor_kind_A;
+ t3 === $ && A.throwLateFieldNI("kind");
+ $async$self.worker.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", t1, "trackId", t2, "kind", t3, "state", "decryptError", "error", J.toString$0$(e0)], type$.String, type$.nullable_String)));
+ }
+ $async$self.keyHandler.decryptionFailure$0();
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 3:
+ // uncaught
+ // goto rethrow
+ $async$goto = 2;
+ break;
+ case 6:
+ // after finally
+ case 1:
+ // return
+ return A._asyncReturn($async$returnValue, $async$completer);
+ case 2:
+ // rethrow
+ return A._asyncRethrow($async$errorStack.at(-1), $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$decodeFunction$2, $async$completer);
}
};
- A._convertDataTree__convert.prototype = {
- call$1(o) {
- var convertedMap, t2, key, convertedList,
- t1 = this._convertedObjects;
- if (t1.containsKey$1(0, o))
- return t1.$index(0, o);
- if (type$.Map_dynamic_dynamic._is(o)) {
- convertedMap = {};
- t1.$indexSet(0, o, convertedMap);
- for (t1 = J.getInterceptor$x(o), t2 = J.get$iterator$ax(t1.get$keys(o)); t2.moveNext$0();) {
- key = t2.get$current(t2);
- convertedMap[key] = this.call$1(t1.$index(o, key));
- }
- return convertedMap;
- } else if (type$.Iterable_dynamic._is(o)) {
- convertedList = [];
- t1.$indexSet(0, o, convertedList);
- B.JSArray_methods.addAll$1(convertedList, J.map$1$1$ax(o, this, type$.dynamic));
- return convertedList;
- } else
- return o;
- },
- $signature: 23
- };
- A.promiseToFuture_closure.prototype = {
- call$1(r) {
- return this.completer.complete$1(0, this.T._eval$1("0/?")._as(r));
+ A.FrameCryptor_decodeFunction_decryptFrameInternal.prototype = {
+ call$0() {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ $async$self = this, decrypted, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, $async$temp1;
+ var $async$call$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1)
+ return A._asyncRethrow($async$result, $async$completer);
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ t1 = $async$self.$this;
+ t2 = t1.worker;
+ t3 = type$.JSObject;
+ t4 = t3._as(t3._as(t2.crypto).subtle);
+ t5 = $async$self.srcFrame;
+ t6 = t5.buffer;
+ t7 = $async$self.headerLength;
+ t8 = type$.String;
+ t9 = type$.Object;
+ t10 = A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", "AES-GCM", "iv", $async$self.iv, "additionalData", B.NativeUint8List_methods.sublist$2(t6, 0, t7)], t8, t9));
+ t9 = t10 == null ? t9._as(t10) : t10;
+ t10 = $async$self._box_0;
+ $async$temp1 = type$.NativeByteBuffer;
+ $async$goto = 2;
+ return A._asyncAwait(A.promiseToFuture(t3._as(t4.decrypt(t9, t10.currentkeySet.encryptionKey, B.NativeUint8List_methods.sublist$2(t6, t7, t6.length - $async$self.ivLength - 2))), type$.nullable_Object), $async$call$0);
+ case 2:
+ // returning from await.
+ decrypted = $async$temp1._as($async$result);
+ t6 = $async$self._box_1;
+ t6.decrypted = decrypted;
+ t7 = $.$get$logger();
+ t7.log$4(B.Level_FINER_400, string$.decode + A.NativeUint8List_NativeUint8List$view(decrypted, 0, null).length, null, null);
+ t3 = t6.decrypted;
+ if (t3 == null)
+ throw A.wrapException(A.Exception_Exception("[decryptFrameInternal] could not decrypt"));
+ t7.log$4(B.Level_FINER_400, string$.decode + A.NativeUint8List_NativeUint8List$view(t3, 0, null).length, null, null);
+ $async$goto = t10.currentkeySet !== t6.initialKeySet ? 3 : 4;
+ break;
+ case 3:
+ // then
+ t7.log$4(B.Level_FINE_500, "decodeFunction::decryptFrameInternal: ratchetKey: decryption ok, newState: kKeyRatcheted", null, null);
+ $async$goto = 5;
+ return A._asyncAwait(t1.keyHandler.setKeySetFromMaterial$2(t10.currentkeySet, t6.initialKeyIndex), $async$call$0);
+ case 5:
+ // returning from await.
+ case 4:
+ // join
+ t3 = t1.lastError;
+ if (t3 !== B.CryptorError_1 && t3 !== B.CryptorError_6 && t6.ratchetCount > 0) {
+ t7.log$4(B.Level_FINER_400, "decodeFunction::decryptFrameInternal: KeyRatcheted: ssrc " + t5.ssrc + " timestamp " + t5.timestamp + " ratchetCount " + t6.ratchetCount + " participantId: " + A.S(t1.participantIdentity), null, null);
+ t7.log$4(B.Level_FINER_400, "decodeFunction::decryptFrameInternal: ratchetKey: lastError != CryptorError.kKeyRatcheted, reset state to kKeyRatcheted", null, null);
+ t1.lastError = B.CryptorError_6;
+ t3 = t1.participantIdentity;
+ t4 = t1.trackId;
+ t1 = t1.__FrameCryptor_kind_A;
+ t1 === $ && A.throwLateFieldNI("kind");
+ t2.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "msgType", "event", "participantId", t3, "trackId", t4, "kind", t1, "state", "keyRatcheted", "error", "Key ratcheted ok"], t8, type$.nullable_String)));
+ }
+ // implicit return
+ return A._asyncReturn(null, $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$call$0, $async$completer);
},
- $signature: 4
+ $signature: 10
};
- A.promiseToFuture_closure0.prototype = {
- call$1(e) {
- if (e == null)
- return this.completer.completeError$1(new A.NullRejectionException(e === undefined));
- return this.completer.completeError$1(e);
+ A.FrameCryptor_decodeFunction_ratchedKeyInternal.prototype = {
+ call$0() {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.void),
+ $async$self = this, newKeyBuffer, newMaterial, t1, t2, t3, t4, t5, t6, $async$temp1;
+ var $async$call$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1)
+ return A._asyncRethrow($async$result, $async$completer);
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ t1 = $async$self._box_1;
+ t2 = t1.ratchetCount;
+ t3 = $async$self.$this;
+ t4 = t3.keyHandler;
+ t5 = t4.keyOptions;
+ t6 = t5.ratchetWindowSize;
+ if (t2 >= t6 || t6 <= 0)
+ throw A.wrapException(A.Exception_Exception("[ratchedKeyInternal] cannot ratchet anymore"));
+ t2 = $async$self._box_0;
+ $async$goto = 2;
+ return A._asyncAwait(t4.ratchet$2(t2.currentkeySet.material, t5.ratchetSalt), $async$call$0);
+ case 2:
+ // returning from await.
+ newKeyBuffer = $async$result;
+ $async$goto = 3;
+ return A._asyncAwait(t3.keyHandler.ratchetMaterial$2(t2.currentkeySet.material, J.get$buffer$x(newKeyBuffer)), $async$call$0);
+ case 3:
+ // returning from await.
+ newMaterial = $async$result;
+ t3 = t3.keyHandler;
+ $async$temp1 = t2;
+ $async$goto = 4;
+ return A._asyncAwait(t3.deriveKeys$2(newMaterial, t3.keyOptions.ratchetSalt), $async$call$0);
+ case 4:
+ // returning from await.
+ $async$temp1.currentkeySet = $async$result;
+ ++t1.ratchetCount;
+ $async$goto = 5;
+ return A._asyncAwait($async$self.decryptFrameInternal.call$0(), $async$call$0);
+ case 5:
+ // returning from await.
+ // implicit return
+ return A._asyncReturn(null, $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$call$0, $async$completer);
},
- $signature: 4
+ $signature: 10
};
- A.NullRejectionException.prototype = {
+ A.KeyOptions.prototype = {
toString$0(_) {
- return "Promise was rejected with a value of `" + (this.isUndefined ? "undefined" : "null") + "`.";
- }
- };
- A._JSSecureRandom.prototype = {
- _JSSecureRandom$0() {
- var $crypto = self.crypto;
- if ($crypto != null)
- if ($crypto.getRandomValues != null)
- return;
- throw A.wrapException(A.UnsupportedError$("No source of cryptographically secure random numbers available."));
- },
- nextInt$1(max) {
- var byteCount, t1, start, randomLimit, t2, t3, t4, random, result, _null = null;
- if (max <= 0 || max > 4294967296)
- throw A.wrapException(new A.RangeError(_null, _null, false, _null, _null, "max must be in range 0 < max \u2264 2^32, was " + max));
- if (max > 255)
- if (max > 65535)
- byteCount = max > 16777215 ? 4 : 3;
- else
- byteCount = 2;
- else
- byteCount = 1;
- t1 = this._math$_buffer;
- B.NativeByteData_methods._setUint32$3(t1, 0, 0, false);
- start = 4 - byteCount;
- randomLimit = A._asInt(Math.pow(256, byteCount));
- for (t2 = max - 1, t3 = (max & t2) === 0; true;) {
- t4 = t1.buffer;
- t4 = new Uint8Array(t4, start, byteCount);
- crypto.getRandomValues(t4);
- random = B.NativeByteData_methods._getUint32$2(t1, 0, false);
- if (t3)
- return (random & t2) >>> 0;
- result = random % max;
- if (random - result + max < randomLimit)
- return result;
- }
- }
- };
- A.Length.prototype = {$isLength: 1};
- A.LengthList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- A._asInt(index);
- if (index >>> 0 !== index || index >= receiver.length)
- throw A.wrapException(A.IndexError$withLength(index, this.get$length(receiver), receiver, null));
- return receiver.getItem(index);
- },
- $indexSet(receiver, index, value) {
- type$.Length._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- return this.$index(receiver, index);
- },
- $isEfficientLengthIterable: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.Number.prototype = {$isNumber: 1};
- A.NumberList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- A._asInt(index);
- if (index >>> 0 !== index || index >= receiver.length)
- throw A.wrapException(A.IndexError$withLength(index, this.get$length(receiver), receiver, null));
- return receiver.getItem(index);
- },
- $indexSet(receiver, index, value) {
- type$.Number._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- return this.$index(receiver, index);
- },
- $isEfficientLengthIterable: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.PointList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.StringList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- A._asInt(index);
- if (index >>> 0 !== index || index >= receiver.length)
- throw A.wrapException(A.IndexError$withLength(index, this.get$length(receiver), receiver, null));
- return receiver.getItem(index);
- },
- $indexSet(receiver, index, value) {
- A._asString(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- return this.$index(receiver, index);
- },
- $isEfficientLengthIterable: 1,
- $isIterable: 1,
- $isList: 1
- };
- A.Transform.prototype = {$isTransform: 1};
- A.TransformList.prototype = {
- get$length(receiver) {
- return receiver.length;
- },
- $index(receiver, index) {
- A._asInt(index);
- if (index >>> 0 !== index || index >= receiver.length)
- throw A.wrapException(A.IndexError$withLength(index, this.get$length(receiver), receiver, null));
- return receiver.getItem(index);
- },
- $indexSet(receiver, index, value) {
- type$.Transform._as(value);
- throw A.wrapException(A.UnsupportedError$("Cannot assign element of immutable List."));
- },
- elementAt$1(receiver, index) {
- return this.$index(receiver, index);
- },
- $isEfficientLengthIterable: 1,
- $isIterable: 1,
- $isList: 1
- };
- A._LengthList_JavaScriptObject_ListMixin.prototype = {};
- A._LengthList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._NumberList_JavaScriptObject_ListMixin.prototype = {};
- A._NumberList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._StringList_JavaScriptObject_ListMixin.prototype = {};
- A._StringList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A._TransformList_JavaScriptObject_ListMixin.prototype = {};
- A._TransformList_JavaScriptObject_ListMixin_ImmutableListMixin.prototype = {};
- A.AudioBuffer.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.AudioParamMap.prototype = {
- $index(receiver, key) {
- return A.convertNativeToDart_Dictionary(receiver.get(A._asString(key)));
- },
- forEach$1(receiver, f) {
- var entries, entry;
- type$.void_Function_String_dynamic._as(f);
- entries = receiver.entries();
- for (; true;) {
- entry = entries.next();
- if (entry.done)
- return;
- f.call$2(entry.value[0], A.convertNativeToDart_Dictionary(entry.value[1]));
+ var _this = this;
+ return "KeyOptions{sharedKey: " + _this.sharedKey + ", ratchetWindowSize: " + _this.ratchetWindowSize + ", failureTolerance: " + _this.failureTolerance + ", uncryptedMagicBytes: " + A.S(_this.uncryptedMagicBytes) + ", ratchetSalt: " + A.S(_this.ratchetSalt) + "}";
+ }
+ };
+ A.KeyProvider.prototype = {
+ getParticipantKeyHandler$1(participantIdentity) {
+ var t2, keys, _this = this,
+ t1 = _this.keyProviderOptions;
+ if (t1.sharedKey)
+ return _this.getSharedKeyHandler$0();
+ t2 = _this.participantKeys;
+ keys = t2.$index(0, participantIdentity);
+ if (keys == null) {
+ keys = A.ParticipantKeyHandler$(t1, participantIdentity, _this.worker);
+ t1 = _this.sharedKey;
+ if (t1.length !== 0)
+ keys.setKey$1(t1);
+ t2.$indexSet(0, participantIdentity, keys);
}
- },
- get$keys(receiver) {
- var keys = A._setArrayType([], type$.JSArray_String);
- this.forEach$1(receiver, new A.AudioParamMap_keys_closure(keys));
return keys;
},
- get$length(receiver) {
- return receiver.size;
- },
- $isMap: 1
- };
- A.AudioParamMap_keys_closure.prototype = {
- call$2(k, v) {
- return B.JSArray_methods.add$1(this.keys, k);
- },
- $signature: 2
- };
- A.AudioTrack.prototype = {
- get$kind(receiver) {
- return receiver.kind;
- }
- };
- A.AudioTrackList.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A.BaseAudioContext.prototype = {};
- A.OfflineAudioContext.prototype = {
- get$length(receiver) {
- return receiver.length;
- }
- };
- A._AudioParamMap_JavaScriptObject_MapMixin.prototype = {};
- A.WritableStream.prototype = {};
- A.ReadableStream.prototype = {};
- A.TransformStream.prototype = {};
- A.TransformStreamDefaultController.prototype = {};
- A.EncodedStreams.prototype = {};
- A.RTCEncodedFrame.prototype = {};
- A.RTCEncodedAudioFrame.prototype = {};
- A.RTCEncodedVideoFrame.prototype = {};
- A.RTCEncodedFrameMetadata.prototype = {};
- A.RTCEncodedAudioFrameMetadata.prototype = {};
- A.RTCEncodedVideoFrameMetadata.prototype = {};
- A.RTCTransformEvent.prototype = {};
- A.RTCRtpScriptTransformer.prototype = {};
- A.RTCRtpScriptTransform.prototype = {};
- A.Promise.prototype = {};
- A.Algorithm.prototype = {};
- A.AesGcmParams.prototype = {};
- A.KeyOptions.prototype = {
- toString$0(_) {
- return "KeyOptions{sharedKey: " + this.sharedKey + ", ratchetWindowSize: " + this.ratchetWindowSize + "}";
- }
- };
- A.CryptorError.prototype = {
- _enumToString$0() {
- return "CryptorError." + this._name;
+ getSharedKeyHandler$0() {
+ var _this = this,
+ t1 = _this.sharedKeyHandler;
+ return t1 == null ? _this.sharedKeyHandler = A.ParticipantKeyHandler$(_this.keyProviderOptions, "shared-key", _this.worker) : t1;
}
};
A.KeySet.prototype = {};
- A.Cryptor.prototype = {
- get$kind(_) {
- var t1 = this.__Cryptor_kind_A;
- t1 === $ && A.throwLateFieldNI("kind");
- return t1;
+ A.ParticipantKeyHandler.prototype = {
+ decryptionFailure$0() {
+ var _this = this,
+ t1 = _this.keyOptions.failureTolerance;
+ if (t1 < 0)
+ return;
+ if (++_this._decryptionFailureCount > t1) {
+ $.$get$logger().log$4(B.Level_WARNING_900, "key for " + _this.participantIdentity + " is being marked as invalid", null, null);
+ _this._hasValidKey = false;
+ }
+ },
+ exportKey$1(keyIndex) {
+ var $async$goto = 0,
+ $async$completer = A._makeAsyncAwaitCompleter(type$.nullable_Uint8List),
+ $async$returnValue, $async$handler = 2, $async$errorStack = [], $async$self = this, key, e, exception, t1, currentMaterial, $async$exception, $async$temp1;
+ var $async$exportKey$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1) {
+ $async$errorStack.push($async$result);
+ $async$goto = $async$handler;
+ }
+ while (true)
+ switch ($async$goto) {
+ case 0:
+ // Function start
+ t1 = $async$self.getKeySet$1(keyIndex);
+ currentMaterial = t1 == null ? null : t1.material;
+ if (currentMaterial == null) {
+ $async$returnValue = null;
+ // goto return
+ $async$goto = 1;
+ break;
+ }
+ $async$handler = 4;
+ t1 = type$.JSObject;
+ $async$temp1 = type$.NativeByteBuffer;
+ $async$goto = 7;
+ return A._asyncAwait(A.promiseToFuture(t1._as(t1._as(t1._as($async$self.worker.crypto).subtle).exportKey("raw", currentMaterial)), type$.nullable_Object), $async$exportKey$1);
+ case 7:
+ // returning from await.
+ key = $async$temp1._as($async$result);
+ t1 = A.NativeUint8List_NativeUint8List$view(key, 0, null);
+ $async$returnValue = t1;
+ // goto return
+ $async$goto = 1;
+ break;
+ $async$handler = 2;
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 4:
+ // catch
+ $async$handler = 3;
+ $async$exception = $async$errorStack.pop();
+ e = A.unwrapException($async$exception);
+ $.$get$logger().log$4(B.Level_WARNING_900, "exportKey: " + A.S(e), null, null);
+ $async$returnValue = null;
+ // goto return
+ $async$goto = 1;
+ break;
+ // goto after finally
+ $async$goto = 6;
+ break;
+ case 3:
+ // uncaught
+ // goto rethrow
+ $async$goto = 2;
+ break;
+ case 6:
+ // after finally
+ case 1:
+ // return
+ return A._asyncReturn($async$returnValue, $async$completer);
+ case 2:
+ // rethrow
+ return A._asyncRethrow($async$errorStack.at(-1), $async$completer);
+ }
+ });
+ return A._asyncStartSync($async$exportKey$1, $async$completer);
},
ratchetKey$1(keyIndex) {
var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$returnValue, $async$self = this, t1, currentMaterial;
+ $async$completer = A._makeAsyncAwaitCompleter(type$.nullable_Uint8List),
+ $async$returnValue, $async$self = this, newKey, newKeySet, t1, currentMaterial;
var $async$ratchetKey$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
@@ -9032,20 +8557,34 @@
switch ($async$goto) {
case 0:
// Function start
- if ($async$self._ratchetCompleter == null) {
- $async$self._ratchetCompleter = new A._AsyncCompleter(new A._Future($.Zone__current, type$._Future_void), type$._AsyncCompleter_void);
- t1 = $async$self.getKeySet$1(keyIndex);
- currentMaterial = t1 == null ? null : t1.material;
- if (currentMaterial == null) {
- $async$self._ratchetCompleter.complete$0(0);
- $async$self._ratchetCompleter = null;
- // goto return
- $async$goto = 1;
- break;
- }
- $async$self.ratchetMaterial$1(currentMaterial).then$1$1(new A.Cryptor_ratchetKey_closure($async$self, keyIndex), type$.Null);
+ t1 = $async$self.getKeySet$1(keyIndex);
+ currentMaterial = t1 == null ? null : t1.material;
+ if (currentMaterial == null) {
+ $async$returnValue = null;
+ // goto return
+ $async$goto = 1;
+ break;
}
- $async$returnValue = $async$self._ratchetCompleter.future;
+ t1 = $async$self.keyOptions.ratchetSalt;
+ $async$goto = 3;
+ return A._asyncAwait($async$self.ratchet$2(currentMaterial, t1), $async$ratchetKey$1);
+ case 3:
+ // returning from await.
+ newKey = $async$result;
+ $async$goto = 5;
+ return A._asyncAwait($async$self.ratchetMaterial$2(currentMaterial, B.NativeUint8List_methods.get$buffer(newKey)), $async$ratchetKey$1);
+ case 5:
+ // returning from await.
+ $async$goto = 4;
+ return A._asyncAwait($async$self.deriveKeys$2($async$result, t1), $async$ratchetKey$1);
+ case 4:
+ // returning from await.
+ newKeySet = $async$result;
+ $async$goto = 6;
+ return A._asyncAwait($async$self.setKeySetFromMaterial$2(newKeySet, keyIndex == null ? $async$self.currentKeyIndex : keyIndex), $async$ratchetKey$1);
+ case 6:
+ // returning from await.
+ $async$returnValue = newKey;
// goto return
$async$goto = 1;
break;
@@ -9056,30 +8595,23 @@
});
return A._asyncStartSync($async$ratchetKey$1, $async$completer);
},
- ratchetMaterial$1(currentMaterial) {
+ ratchetMaterial$2(currentMaterial, newKeyBuffer) {
var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.CryptoKey),
- $async$returnValue, $async$self = this, $async$temp1, $async$temp2, $async$temp3, $async$temp4;
- var $async$ratchetMaterial$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ $async$completer = A._makeAsyncAwaitCompleter(type$.JSObject),
+ $async$returnValue, $async$self = this, t1;
+ var $async$ratchetMaterial$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
while (true)
switch ($async$goto) {
case 0:
// Function start
- $async$temp1 = type$.FutureOr_CryptoKey;
- $async$temp2 = A;
- $async$temp3 = self.crypto.subtle;
- $async$temp4 = A;
- $async$goto = 4;
- return A._asyncAwait($async$self.ratchet$2(currentMaterial, $async$self.keyOptions.ratchetSalt), $async$ratchetMaterial$1);
- case 4:
- // returning from await.
+ t1 = type$.JSObject;
$async$goto = 3;
- return A._asyncAwait($async$temp2.promiseToFuture($async$temp3.importKey("raw", $async$temp4.jsArrayBufferFrom($async$result), J.get$name$x(type$.Algorithm._as(currentMaterial.algorithm)), false, A._setArrayType(["deriveBits", "deriveKey"], type$.JSArray_String)), type$.dynamic), $async$ratchetMaterial$1);
+ return A._asyncAwait(A.promiseToFuture(A.callMethod(t1._as(t1._as($async$self.worker.crypto).subtle), "importKey", ["raw", type$.NativeByteBuffer._as(newKeyBuffer), type$.Object._as(t1._as(currentMaterial.algorithm).name), false, type$.JSArray_nullable_Object._as(A.jsify(A._setArrayType(["deriveBits", "deriveKey"], type$.JSArray_String)))], t1), t1), $async$ratchetMaterial$2);
case 3:
// returning from await.
- $async$returnValue = $async$temp1._as($async$result);
+ $async$returnValue = $async$result;
// goto return
$async$goto = 1;
break;
@@ -9088,52 +8620,61 @@
return A._asyncReturn($async$returnValue, $async$completer);
}
});
- return A._asyncStartSync($async$ratchetMaterial$1, $async$completer);
+ return A._asyncStartSync($async$ratchetMaterial$2, $async$completer);
},
getKeySet$1(keyIndex) {
- var t1 = this.cryptoKeyRing,
- t2 = keyIndex == null ? this.currentKeyIndex : keyIndex;
- if (!(t2 >= 0 && t2 < 16))
+ var t2,
+ t1 = this.__ParticipantKeyHandler_cryptoKeyRing_A;
+ t1 === $ && A.throwLateFieldNI("cryptoKeyRing");
+ t2 = keyIndex == null ? this.currentKeyIndex : keyIndex;
+ if (!(t2 >= 0 && t2 < t1.length))
return A.ioore(t1, t2);
return t1[t2];
},
- setKey$2(keyIndex, key) {
+ setKey$2$keyIndex(key, keyIndex) {
var $async$goto = 0,
$async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$self = this;
- var $async$setKey$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ $async$self = this, t1, t2, t3;
+ var $async$setKey$2$keyIndex = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
while (true)
switch ($async$goto) {
case 0:
// Function start
- if ($async$self.lastError !== B.CryptorError_1) {
- A.print("setKey: lastError != CryptorError.kOk, reset state to kNew");
- $async$self.lastError = B.CryptorError_0;
- }
+ t1 = type$.JSObject;
+ t2 = t1._as(t1._as($async$self.worker.crypto).subtle);
+ t3 = type$.String;
+ t3 = A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", "PBKDF2"], t3, t3));
+ if (t3 == null)
+ t3 = type$.Object._as(t3);
$async$goto = 4;
- return A._asyncAwait(A.impportKeyFromRawData(key, A._setArrayType(["deriveBits", "deriveKey"], type$.JSArray_String), "PBKDF2"), $async$setKey$2);
+ return A._asyncAwait(A.promiseToFuture(A.callMethod(t2, "importKey", ["raw", key, t3, false, type$.JSArray_nullable_Object._as(A.jsify(A._setArrayType(["deriveBits", "deriveKey"], type$.JSArray_String)))], t1), t1), $async$setKey$2$keyIndex);
case 4:
// returning from await.
$async$goto = 3;
- return A._asyncAwait($async$self.deriveKeys$2($async$result, $async$self.keyOptions.ratchetSalt), $async$setKey$2);
+ return A._asyncAwait($async$self.deriveKeys$2($async$result, $async$self.keyOptions.ratchetSalt), $async$setKey$2$keyIndex);
case 3:
// returning from await.
$async$goto = 2;
- return A._asyncAwait($async$self.setKeySetFromMaterial$2($async$result, keyIndex), $async$setKey$2);
+ return A._asyncAwait($async$self.setKeySetFromMaterial$2($async$result, keyIndex), $async$setKey$2$keyIndex);
case 2:
// returning from await.
+ $async$self._decryptionFailureCount = 0;
+ $async$self._hasValidKey = true;
// implicit return
return A._asyncReturn(null, $async$completer);
}
});
- return A._asyncStartSync($async$setKey$2, $async$completer);
+ return A._asyncStartSync($async$setKey$2$keyIndex, $async$completer);
+ },
+ setKey$1(key) {
+ return this.setKey$2$keyIndex(key, 0);
},
setKeySetFromMaterial$2(keySet, keyIndex) {
var $async$goto = 0,
$async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$self = this;
+ $async$self = this, t1;
var $async$setKeySetFromMaterial$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
@@ -9141,10 +8682,15 @@
switch ($async$goto) {
case 0:
// Function start
- A.print("setting new key");
- if (keyIndex >= 0)
- $async$self.currentKeyIndex = B.JSInt_methods.$mod(keyIndex, 16);
- B.JSArray_methods.$indexSet($async$self.cryptoKeyRing, $async$self.currentKeyIndex, keySet);
+ $.$get$logger().log$4(B.Level_CONFIG_700, "setKeySetFromMaterial: set new key, index: " + keyIndex, null, null);
+ if (keyIndex >= 0) {
+ t1 = $async$self.__ParticipantKeyHandler_cryptoKeyRing_A;
+ t1 === $ && A.throwLateFieldNI("cryptoKeyRing");
+ $async$self.currentKeyIndex = B.JSInt_methods.$mod(keyIndex, t1.length);
+ }
+ t1 = $async$self.__ParticipantKeyHandler_cryptoKeyRing_A;
+ t1 === $ && A.throwLateFieldNI("cryptoKeyRing");
+ B.JSArray_methods.$indexSet(t1, $async$self.currentKeyIndex, keySet);
// implicit return
return A._asyncReturn(null, $async$completer);
}
@@ -9154,7 +8700,7 @@
deriveKeys$2(material, salt) {
var $async$goto = 0,
$async$completer = A._makeAsyncAwaitCompleter(type$.KeySet),
- $async$returnValue, algorithmOptions, $async$temp1, $async$temp2;
+ $async$returnValue, $async$self = this, t4, t5, t1, algorithmOptions, t2, t3, $async$temp1, $async$temp2, $async$temp3;
var $async$deriveKeys$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
@@ -9162,14 +8708,23 @@
switch ($async$goto) {
case 0:
// Function start
- algorithmOptions = A.getAlgoOptions(J.get$name$x(type$.Algorithm._as(material.algorithm)), salt);
+ t1 = type$.JSObject;
+ algorithmOptions = A.getAlgoOptions(A._asString(t1._as(material.algorithm).name), salt);
+ t2 = t1._as(t1._as($async$self.worker.crypto).subtle);
+ t3 = A.jsify(algorithmOptions);
+ if (t3 == null)
+ t3 = type$.Object._as(t3);
+ t4 = type$.Object;
+ t5 = A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", "AES-GCM", "length", 128], type$.String, t4));
+ t4 = t5 == null ? t4._as(t5) : t5;
$async$temp1 = A;
$async$temp2 = material;
+ $async$temp3 = t1;
$async$goto = 3;
- return A._asyncAwait(A.promiseToFuture(self.crypto.subtle.deriveKey(A.jsify(algorithmOptions), material, A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["name", "AES-GCM", "length", 128], type$.String, type$.Object)), false, A._setArrayType(["encrypt", "decrypt"], type$.JSArray_String)), type$.CryptoKey), $async$deriveKeys$2);
+ return A._asyncAwait(A.promiseToFuture(A.callMethod(t2, "deriveKey", [t3, material, t4, false, type$.JSArray_nullable_Object._as(A.jsify(A._setArrayType(["encrypt", "decrypt"], type$.JSArray_String)))], t1), type$.nullable_Object), $async$deriveKeys$2);
case 3:
// returning from await.
- $async$returnValue = new $async$temp1.KeySet($async$temp2, $async$result);
+ $async$returnValue = new $async$temp1.KeySet($async$temp2, $async$temp3._as($async$result));
// goto return
$async$goto = 1;
break;
@@ -9183,7 +8738,7 @@
ratchet$2(material, salt) {
var $async$goto = 0,
$async$completer = A._makeAsyncAwaitCompleter(type$.Uint8List),
- $async$returnValue, algorithmOptions, $async$temp1;
+ $async$returnValue, $async$self = this, algorithmOptions, t1, t2, t3, $async$temp1;
var $async$ratchet$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
if ($async$errorCode === 1)
return A._asyncRethrow($async$result, $async$completer);
@@ -9192,9 +8747,14 @@
case 0:
// Function start
algorithmOptions = A.getAlgoOptions("PBKDF2", salt);
+ t1 = type$.JSObject;
+ t2 = t1._as(t1._as($async$self.worker.crypto).subtle);
+ t3 = A.jsify(algorithmOptions);
+ if (t3 == null)
+ t3 = type$.Object._as(t3);
$async$temp1 = A;
$async$goto = 3;
- return A._asyncAwait(A.promiseToFuture(self.crypto.subtle.deriveBits(A.jsify(algorithmOptions), material, 256), type$.ByteBuffer), $async$ratchet$2);
+ return A._asyncAwait(A.promiseToFuture(t1._as(t2.deriveBits(t3, material, 256)), type$.NativeByteBuffer), $async$ratchet$2);
case 3:
// returning from await.
$async$returnValue = $async$temp1.NativeUint8List_NativeUint8List$view($async$result, 0, null);
@@ -9208,802 +8768,668 @@
});
return A._asyncStartSync($async$ratchet$2, $async$completer);
},
- setupTransform$6$codec$kind$operation$readable$trackId$writable(codec, kind, operation, readable, trackId, writable) {
- return this.setupTransform$body$Cryptor(codec, kind, operation, readable, trackId, writable);
+ set$__ParticipantKeyHandler_cryptoKeyRing_A(__ParticipantKeyHandler_cryptoKeyRing_A) {
+ this.__ParticipantKeyHandler_cryptoKeyRing_A = type$.List_nullable_KeySet._as(__ParticipantKeyHandler_cryptoKeyRing_A);
+ }
+ };
+ A.SifGuard.prototype = {
+ recordUserFrame$0() {
+ var _this = this;
+ if (_this.sifSequenceStartedAt == null)
+ return;
+ if (++_this.userFramesSinceSif > _this.consecutiveSifCount || Date.now() - _this.lastSifReceivedAt > 2000)
+ _this.reset$0();
},
- setupTransform$5$kind$operation$readable$trackId$writable(kind, operation, readable, trackId, writable) {
- return this.setupTransform$6$codec$kind$operation$readable$trackId$writable(null, kind, operation, readable, trackId, writable);
+ reset$0() {
+ this.consecutiveSifCount = this.userFramesSinceSif = 0;
+ this.sifSequenceStartedAt = null;
+ }
+ };
+ A.getTrackCryptor_closure.prototype = {
+ call$1(c) {
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
- setupTransform$body$Cryptor(codec, kind, operation, readable, trackId, writable) {
- var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$self = this, transformer, e, t1, t2, t3, exception;
- var $async$setupTransform$6$codec$kind$operation$readable$trackId$writable = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
- if ($async$errorCode === 1)
- return A._asyncRethrow($async$result, $async$completer);
- while (true)
- switch ($async$goto) {
- case 0:
- // Function start
- A.print("setupTransform " + operation);
- $async$self.__Cryptor_kind_A = kind;
- if (codec != null) {
- A.print("setting codec on cryptor to " + codec);
- $async$self.codec = codec;
- }
- t1 = operation === "encode" ? $async$self.get$encodeFunction() : $async$self.get$decodeFunction();
- t2 = type$.Future_void_Function_RTCEncodedFrame_TransformStreamDefaultController;
- t3 = type$.String;
- transformer = new self.TransformStream(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["transform", A.allowInterop(t1, t2)], t3, t2)));
- try {
- J.pipeTo$1$x(J.pipeThrough$1$x(readable, transformer), writable);
- } catch (exception) {
- e = A.unwrapException(exception);
- A.print("e " + J.toString$0$(e));
- if ($async$self.lastError !== B.CryptorError_7) {
- $async$self.lastError = B.CryptorError_7;
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", $async$self.participantId, "state", "internalError", "error", "Internal error: " + J.toString$0$(e)], t3, type$.nullable_String));
- }
- }
- $async$self.trackId = trackId;
- // implicit return
- return A._asyncReturn(null, $async$completer);
- }
- });
- return A._asyncStartSync($async$setupTransform$6$codec$kind$operation$readable$trackId$writable, $async$completer);
+ $signature: 1
+ };
+ A.unsetCryptorParticipant_closure.prototype = {
+ call$1(c) {
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
- getUnencryptedBytes$2(frame, codec) {
- var data, naluIndices, t1, t2, _i, index;
- if (codec != null && codec.toLowerCase() === "h264") {
- data = A.NativeUint8List_NativeUint8List$view(J.get$data$x(frame), 0, null);
- naluIndices = A.findNALUIndices(data);
- for (t1 = naluIndices.length, t2 = data.length, _i = 0; _i < t1; ++_i) {
- index = naluIndices[_i];
- if (!(index < t2))
- return A.ioore(data, index);
- switch (data[index] & 31) {
- case 5:
- case 1:
- return index + 2;
- default:
- break;
- }
- }
- throw A.wrapException(A.Exception_Exception("Could not find NALU"));
- }
- switch (J.get$type$x(frame)) {
- case "key":
- return 10;
- case "delta":
- return 3;
- case "audio":
- return 1;
- default:
- return 0;
- }
+ $signature: 1
+ };
+ A.main_closure.prototype = {
+ call$1(record) {
+ type$.LogRecord._as(record);
+ A.printString("[" + record.loggerName + "] " + record.level.name + ": " + record.message);
},
- encodeFunction$2(frame, controller) {
- return this.encodeFunction$body$Cryptor(type$.RTCEncodedFrame._as(frame), type$.TransformStreamDefaultController._as(controller));
+ $signature: 21
+ };
+ A.main_closure0.prototype = {
+ call$1($event) {
+ var t2, transformer, options, kind, participantId, trackId, codec, msgType, keyProviderId, keyProvider, cryptor, _null = null,
+ t1 = type$.JSObject;
+ t1._as($event);
+ t2 = $.$get$logger();
+ t2.log$4(B.Level_INFO_800, "Got onrtctransform event", _null, _null);
+ transformer = t1._as($event.transformer);
+ transformer.handled = true;
+ options = t1._as(transformer.options);
+ kind = A._asString(options.kind);
+ participantId = A._asString(options.participantId);
+ trackId = A._asString(options.trackId);
+ codec = A._asStringQ(options.codec);
+ msgType = A._asString(options.msgType);
+ keyProviderId = A._asString(options.keyProviderId);
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t2.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, _null, _null);
+ return;
+ }
+ cryptor = A.getTrackCryptor(participantId, trackId, keyProvider);
+ t2 = t1._as(transformer.readable);
+ t1 = t1._as(transformer.writable);
+ cryptor.setupTransform$6$codec$kind$operation$readable$trackId$writable(codec == null ? _null : codec, kind, msgType, t2, trackId, t1);
},
- encodeFunction$body$Cryptor(frame, controller) {
+ $signature: 11
+ };
+ A.main_closure2.prototype = {
+ call$1(e) {
var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$returnValue, $async$handler = 2, $async$currentError, $async$self = this, secretKey, keyIndex, headerLength, metaData, iv, frameTrailer, cipherText, finalBuffer, e, t2, t3, t4, iv0, sendCount, exception, t1, buffer, $async$exception;
- var $async$encodeFunction$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
- if ($async$errorCode === 1) {
- $async$currentError = $async$result;
- $async$goto = $async$handler;
- }
+ $async$completer = A._makeAsyncAwaitCompleter(type$.Null),
+ $async$returnValue, options, keyProviderId, t2, t3, t4, t5, t6, t7, t8, keyProviderOptions, enabled, trackId, cryptors, _i, cryptor, kind, exist, participantId, readable, writable, keyProvider, key, keyIndex, newKey, c, sifTrailer, codec, msg, msgType, msgId, t1;
+ var $async$call$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
+ if ($async$errorCode === 1)
+ return A._asyncRethrow($async$result, $async$completer);
while (true)
switch ($async$goto) {
case 0:
// Function start
- t1 = J.getInterceptor$x(frame);
- buffer = A.NativeUint8List_NativeUint8List$view(t1.get$data(frame), 0, null);
- if (!$async$self.enabled || J.get$length$asx(buffer) === 0) {
- J.enqueue$1$x(controller, frame);
- // goto return
- $async$goto = 1;
- break;
- }
- t2 = $async$self.getKeySet$1($async$self.currentKeyIndex);
- secretKey = t2 == null ? null : t2.encryptionKey;
- keyIndex = $async$self.currentKeyIndex;
- if (secretKey == null) {
- if ($async$self.lastError !== B.CryptorError_5) {
- $async$self.lastError = B.CryptorError_5;
- t1 = $async$self.participantId;
- t2 = $async$self.trackId;
- t3 = $async$self.__Cryptor_kind_A;
- t3 === $ && A.throwLateFieldNI("kind");
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", t1, "trackId", t2, "kind", t3, "state", "missingKey", "error", "Missing key for track " + A.S(t2)], type$.String, type$.nullable_String));
- }
- // goto return
- $async$goto = 1;
- break;
- }
- $async$handler = 4;
- t2 = $async$self.__Cryptor_kind_A;
- t2 === $ && A.throwLateFieldNI("kind");
- headerLength = t2 === "video" ? $async$self.getUnencryptedBytes$2(frame, $async$self.codec) : 1;
- metaData = t1.getMetadata$0(frame);
- t3 = J.get$synchronizationSource$x(metaData);
- t4 = t1.get$timestamp(frame);
- A._asInt(t3);
- A._asInt(t4);
- iv0 = new DataView(new ArrayBuffer(12));
- t2 = $async$self.sendCounts;
- if (t2.$index(0, t3) == null)
- t2.$indexSet(0, t3, $.$get$Random__secureRandom().nextInt$1(65535));
- sendCount = t2.$index(0, t3);
- if (sendCount == null)
- sendCount = 0;
- B.NativeByteData_methods._setUint32$3(iv0, 0, t3, false);
- B.NativeByteData_methods._setUint32$3(iv0, 4, t4, false);
- B.NativeByteData_methods._setUint32$3(iv0, 8, t4 - B.JSInt_methods.$mod(sendCount, 65535), false);
- t2.$indexSet(0, t3, sendCount + 1);
- iv = A.NativeUint8List_NativeUint8List$view(iv0.buffer, 0, null);
- frameTrailer = new DataView(new ArrayBuffer(2));
- J.setInt8$2$x(frameTrailer, 0, 12);
- J.setInt8$2$x(frameTrailer, 1, keyIndex);
- $async$goto = 7;
- return A._asyncAwait(A.promiseToFuture(self.crypto.subtle.encrypt({name: "AES-GCM", iv: A.jsArrayBufferFrom(iv), additionalData: A.jsArrayBufferFrom(J.sublist$2$x(buffer, 0, headerLength))}, secretKey, A.jsArrayBufferFrom(J.sublist$2$x(buffer, headerLength, J.get$length$asx(buffer)))), type$.ByteBuffer), $async$encodeFunction$2);
- case 7:
- // returning from await.
- cipherText = $async$result;
- t2 = $.$get$_CopyingBytesBuilder__emptyList();
- finalBuffer = new A._CopyingBytesBuilder(t2);
- J.add$1$ax(finalBuffer, new Uint8Array(A._ensureNativeList(J.sublist$2$x(buffer, 0, headerLength))));
- J.add$1$ax(finalBuffer, A.NativeUint8List_NativeUint8List$view(cipherText, 0, null));
- J.add$1$ax(finalBuffer, iv);
- J.add$1$ax(finalBuffer, A.NativeUint8List_NativeUint8List$view(frameTrailer.buffer, 0, null));
- t1.set$data(frame, A.jsArrayBufferFrom(finalBuffer.toBytes$0()));
- J.enqueue$1$x(controller, frame);
- if ($async$self.lastError !== B.CryptorError_1) {
- $async$self.lastError = B.CryptorError_1;
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", $async$self.participantId, "trackId", $async$self.trackId, "kind", $async$self.__Cryptor_kind_A, "state", "ok", "error", "encryption ok"], type$.String, type$.nullable_String));
- }
- $async$handler = 2;
- // goto after finally
- $async$goto = 6;
- break;
- case 4:
- // catch
- $async$handler = 3;
- $async$exception = $async$currentError;
- e = A.unwrapException($async$exception);
- if ($async$self.lastError !== B.CryptorError_3) {
- $async$self.lastError = B.CryptorError_3;
- t1 = $async$self.participantId;
- t2 = $async$self.trackId;
- t3 = $async$self.__Cryptor_kind_A;
- t3 === $ && A.throwLateFieldNI("kind");
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", t1, "trackId", t2, "kind", t3, "state", "encryptError", "error", J.toString$0$(e)], type$.String, type$.nullable_String));
+ msg = type$.Map_dynamic_dynamic._as(A.dartify(e.data));
+ msgType = msg.$index(0, "msgType");
+ msgId = A._asStringQ(msg.$index(0, "msgId"));
+ t1 = $.$get$logger();
+ t1.log$4(B.Level_CONFIG_700, "Got message " + A.S(msgType) + ", msgId " + A.S(msgId), null, null);
+ case 3:
+ // switch
+ switch (msgType) {
+ case "keyProviderInit":
+ // goto case
+ $async$goto = 5;
+ break;
+ case "keyProviderDispose":
+ // goto case
+ $async$goto = 6;
+ break;
+ case "enable":
+ // goto case
+ $async$goto = 7;
+ break;
+ case "decode":
+ // goto case
+ $async$goto = 8;
+ break;
+ case "encode":
+ // goto case
+ $async$goto = 9;
+ break;
+ case "removeTransform":
+ // goto case
+ $async$goto = 10;
+ break;
+ case "setKey":
+ // goto case
+ $async$goto = 11;
+ break;
+ case "setSharedKey":
+ // goto case
+ $async$goto = 12;
+ break;
+ case "ratchetKey":
+ // goto case
+ $async$goto = 13;
+ break;
+ case "ratchetSharedKey":
+ // goto case
+ $async$goto = 14;
+ break;
+ case "setKeyIndex":
+ // goto case
+ $async$goto = 15;
+ break;
+ case "exportKey":
+ // goto case
+ $async$goto = 16;
+ break;
+ case "exportSharedKey":
+ // goto case
+ $async$goto = 17;
+ break;
+ case "setSifTrailer":
+ // goto case
+ $async$goto = 18;
+ break;
+ case "updateCodec":
+ // goto case
+ $async$goto = 19;
+ break;
+ case "dispose":
+ // goto case
+ $async$goto = 20;
+ break;
+ default:
+ // goto default
+ $async$goto = 21;
+ break;
}
- // goto after finally
- $async$goto = 6;
break;
- case 3:
- // uncaught
- // goto rethrow
- $async$goto = 2;
+ case 5:
+ // case
+ options = msg.$index(0, "keyOptions");
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ t2 = J.getInterceptor$asx(options);
+ t3 = A._asBool(t2.$index(options, "sharedKey"));
+ t4 = new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(t2.$index(options, "ratchetSalt")))));
+ t5 = A._asInt(t2.$index(options, "ratchetWindowSize"));
+ t6 = t2.$index(options, "failureTolerance");
+ t6 = A._asInt(t6 == null ? -1 : t6);
+ t7 = t2.$index(options, "uncryptedMagicBytes") != null ? new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(t2.$index(options, "uncryptedMagicBytes"))))) : null;
+ t8 = t2.$index(options, "keyRingSize");
+ t8 = A._asInt(t8 == null ? 16 : t8);
+ t2 = t2.$index(options, "discardFrameWhenCryptorNotReady");
+ keyProviderOptions = new A.KeyOptions(t3, t4, t5, t6, t7, t8, A._asBool(t2 == null ? false : t2));
+ t1.log$4(B.Level_CONFIG_700, "Init with keyProviderOptions:\n " + keyProviderOptions.toString$0(0), null, null);
+ t1 = self;
+ t2 = type$.JSObject;
+ t3 = t2._as(t1.self);
+ t4 = type$.String;
+ t5 = new Uint8Array(0);
+ $.keyProviders.$indexSet(0, keyProviderId, new A.KeyProvider(t3, keyProviderOptions, A.LinkedHashMap_LinkedHashMap$_empty(t4, type$.ParticipantKeyHandler), t5));
+ t2._as(t1.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "init", "msgId", msgId, "msgType", "response"], t4, type$.nullable_String)));
+ // goto after switch
+ $async$goto = 4;
break;
case 6:
- // after finally
- case 1:
- // return
- return A._asyncReturn($async$returnValue, $async$completer);
- case 2:
- // rethrow
- return A._asyncRethrow($async$currentError, $async$completer);
- }
- });
- return A._asyncStartSync($async$encodeFunction$2, $async$completer);
- },
- decodeFunction$2(frame, controller) {
- return this.decodeFunction$body$Cryptor(type$.RTCEncodedFrame._as(frame), type$.TransformStreamDefaultController._as(controller));
- },
- decodeFunction$body$Cryptor(frame, controller) {
- var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.void),
- $async$returnValue, $async$handler = 2, $async$currentError, $async$self = this, headerLength, metaData, frameTrailer, ivLength, keyIndex, iv, currentkeySet, endDecLoop, finalBuffer, e, t2, t3, t4, t5, t6, t7, endDecLoop0, t8, t9, t10, t11, t12, t13, exception, ratchetCount, t1, buffer, decrypted, initialKeySet, initialKeyIndex, $async$exception, $async$exception1;
- var $async$decodeFunction$2 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
- if ($async$errorCode === 1) {
- $async$currentError = $async$result;
- $async$goto = $async$handler;
- }
- while (true)
- switch ($async$goto) {
- case 0:
- // Function start
- ratchetCount = 0;
- t1 = J.getInterceptor$x(frame);
- buffer = A.NativeUint8List_NativeUint8List$view(t1.get$data(frame), 0, null);
- decrypted = null;
- initialKeySet = null;
- initialKeyIndex = $async$self.currentKeyIndex;
- if (!$async$self.enabled || J.get$length$asx(buffer) === 0) {
- J.enqueue$1$x(controller, frame);
- // goto return
- $async$goto = 1;
- break;
- }
- $async$handler = 4;
- t2 = $async$self.__Cryptor_kind_A;
- t2 === $ && A.throwLateFieldNI("kind");
- headerLength = t2 === "video" ? $async$self.getUnencryptedBytes$2(frame, $async$self.codec) : 1;
- metaData = t1.getMetadata$0(frame);
- frameTrailer = J.sublist$1$x(buffer, J.get$length$asx(buffer) - 2);
- ivLength = J.$index$asx(frameTrailer, 0);
- keyIndex = J.$index$asx(frameTrailer, 1);
- t3 = J.get$length$asx(buffer);
- t4 = ivLength;
- if (typeof t4 !== "number") {
- $async$returnValue = A.iae(t4);
- // goto return
- $async$goto = 1;
- break;
- }
- iv = J.sublist$2$x(buffer, t3 - t4 - 2, J.get$length$asx(buffer) - 2);
- currentkeySet = $async$self.getKeySet$1(keyIndex);
- initialKeySet = currentkeySet;
- initialKeyIndex = keyIndex;
- if (currentkeySet == null) {
- if ($async$self.lastError !== B.CryptorError_5) {
- $async$self.lastError = B.CryptorError_5;
- t1 = $async$self.participantId;
- t2 = $async$self.trackId;
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", t1, "trackId", t2, "kind", $async$self.__Cryptor_kind_A, "state", "missingKey", "error", "Missing key for track " + A.S(t2)], type$.String, type$.nullable_String));
- }
- J.enqueue$1$x(controller, frame);
- // goto return
- $async$goto = 1;
- break;
- }
- endDecLoop = false;
- t2 = $async$self.cryptoKeyRing, t3 = $async$self.keyOptions.ratchetWindowSize, t4 = type$.ByteBuffer, t5 = type$.String, t6 = type$.nullable_String, t7 = $async$self.worker, endDecLoop0 = t3 <= 0;
+ // case
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ t1.log$4(B.Level_CONFIG_700, "Dispose keyProvider " + keyProviderId, null, null);
+ $.keyProviders.remove$1(0, keyProviderId);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "dispose", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
+ // goto after switch
+ $async$goto = 4;
+ break;
case 7:
- // for condition
- if (!!A.boolConversionCheck(endDecLoop)) {
- // goto after for
- $async$goto = 8;
- break;
- }
- $async$handler = 10;
- t8 = buffer;
- t8 = {name: "AES-GCM", iv: A.jsArrayBufferFrom(iv), additionalData: A.jsArrayBufferFrom(new Uint8Array(t8.subarray(0, A._checkValidRange(0, A._asIntQ(headerLength), J.get$length$asx(t8)))))};
- t9 = currentkeySet.encryptionKey;
- t10 = buffer;
- t11 = J.get$length$asx(buffer);
- t12 = ivLength;
- if (typeof t12 !== "number") {
- $async$returnValue = A.iae(t12);
- // goto return
- $async$goto = 1;
- break;
- }
- t13 = A._asInt(headerLength);
- $async$goto = 13;
- return A._asyncAwait(A.promiseToFuture(self.crypto.subtle.decrypt(t8, t9, A.jsArrayBufferFrom(new Uint8Array(t10.subarray(t13, A._checkValidRange(t13, A._asIntQ(t11 - t12 - 2), J.get$length$asx(t10)))))), t4), $async$decodeFunction$2);
- case 13:
- // returning from await.
- decrypted = $async$result;
- endDecLoop = true;
- t8 = $async$self.lastError;
- if (t8 !== B.CryptorError_1)
- if (t8 !== B.CryptorError_6) {
- t8 = ratchetCount;
- if (typeof t8 !== "number") {
- $async$returnValue = t8.$gt();
- // goto return
- $async$goto = 1;
- break;
- }
- t8 = t8 > 0;
- } else
- t8 = false;
- else
- t8 = false;
- if (t8) {
- A.printString("KeyRatcheted: ssrc " + A.S(J.get$synchronizationSource$x(metaData)) + " timestamp " + A.S(t1.get$timestamp(frame)) + " ratchetCount " + A.S(ratchetCount) + " participantId: " + A.S($async$self.participantId));
- A.printString("ratchetKey: lastError != CryptorError.kKeyRatcheted, reset state to kKeyRatcheted");
- $async$self.lastError = B.CryptorError_6;
- B.DedicatedWorkerGlobalScope_methods.postMessage$1(t7, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", $async$self.participantId, "trackId", $async$self.trackId, "kind", $async$self.__Cryptor_kind_A, "state", "keyRatcheted", "error", "Key ratcheted ok"], t5, t6));
+ // case
+ enabled = A._asBool(msg.$index(0, "enabled"));
+ trackId = A._asString(msg.$index(0, "trackId"));
+ t2 = $.participantCryptors;
+ t3 = A._arrayInstanceType(t2);
+ t4 = t3._eval$1("WhereIterable<1>");
+ cryptors = A.List_List$of(new A.WhereIterable(t2, t3._eval$1("bool(1)")._as(new A.main__closure(trackId)), t4), true, t4._eval$1("Iterable.E"));
+ for (t2 = cryptors.length, t3 = "" + enabled, t4 = "Set enable " + t3 + " for trackId ", t5 = "setEnabled[" + t3 + string$.___las, _i = 0; _i < t2; ++_i) {
+ cryptor = cryptors[_i];
+ t1.log$4(B.Level_CONFIG_700, t4 + cryptor.trackId, null, null);
+ if (cryptor.lastError !== B.CryptorError_1) {
+ t1.log$4(B.Level_INFO_800, t5, null, null);
+ cryptor.lastError = B.CryptorError_0;
+ }
+ t1.log$4(B.Level_CONFIG_700, "setEnabled for " + A.S(cryptor.participantIdentity) + ", enabled: " + t3, null, null);
+ cryptor._enabled = enabled;
}
- $async$handler = 4;
- // goto after finally
- $async$goto = 12;
- break;
- case 10:
- // catch
- $async$handler = 9;
- $async$exception = $async$currentError;
- $async$self.lastError = B.CryptorError_7;
- t8 = ratchetCount;
- if (typeof t8 !== "number") {
- $async$returnValue = t8.$ge();
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorEnabled", "enable", enabled, "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_Object)));
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 8:
+ // case
+ case 9:
+ // case
+ kind = msg.$index(0, "kind");
+ exist = A._asBool(msg.$index(0, "exist"));
+ participantId = A._asString(msg.$index(0, "participantId"));
+ trackId = msg.$index(0, "trackId");
+ t2 = type$.JSObject;
+ readable = t2._as(msg.$index(0, "readableStream"));
+ writable = t2._as(msg.$index(0, "writableStream"));
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ t1.log$4(B.Level_CONFIG_700, "SetupTransform for kind " + A.S(kind) + ", trackId " + A.S(trackId) + ", participantId " + participantId + ", " + J.get$runtimeType$(readable).toString$0(0) + " " + J.get$runtimeType$(writable).toString$0(0) + "}", null, null);
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t1.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, null, null);
+ t2._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorSetup", "participantId", participantId, "trackId", trackId, "exist", exist, "operation", msgType, "error", "KeyProvider not found", "msgId", msgId, "msgType", "response"], type$.String, type$.dynamic)));
// goto return
$async$goto = 1;
break;
}
- endDecLoop = t8 >= t3 || endDecLoop0;
- if (A.boolConversionCheck(endDecLoop))
- throw $async$exception;
- t8 = currentkeySet;
- t9 = A._asIntQ(keyIndex);
- if (t9 == null)
- t9 = $async$self.currentKeyIndex;
- if (!(t9 >= 0 && t9 < 16)) {
- $async$returnValue = A.ioore(t2, t9);
+ A._asString(trackId);
+ cryptor = A.getTrackCryptor(participantId, trackId, keyProvider);
+ A._asString(msgType);
+ $async$goto = 22;
+ return A._asyncAwait(cryptor.setupTransform$5$kind$operation$readable$trackId$writable(A._asString(kind), msgType, readable, trackId, writable), $async$call$1);
+ case 22:
+ // returning from await.
+ t2._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorSetup", "participantId", participantId, "trackId", trackId, "exist", exist, "operation", msgType, "msgId", msgId, "msgType", "response"], type$.String, type$.dynamic)));
+ cryptor.lastError = B.CryptorError_0;
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 10:
+ // case
+ trackId = A._asString(msg.$index(0, "trackId"));
+ t1.log$4(B.Level_CONFIG_700, "Removing trackId " + trackId, null, null);
+ A.unsetCryptorParticipant(trackId);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorRemoved", "trackId", trackId, "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 11:
+ // case
+ case 12:
+ // case
+ key = new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(msg.$index(0, "key")))));
+ keyIndex = A._asInt(msg.$index(0, "keyIndex"));
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t1.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, null, null);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKey", "error", "KeyProvider not found", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
// goto return
$async$goto = 1;
break;
}
- $async$goto = J.$eq$(t8, t2[t9]) ? 14 : 15;
+ t2 = keyProvider.keyProviderOptions.sharedKey;
+ t3 = "" + keyIndex;
+ $async$goto = t2 ? 23 : 25;
break;
- case 14:
+ case 23:
// then
- t8 = ratchetCount;
- if (typeof t8 !== "number") {
- $async$returnValue = t8.$add();
+ t1.log$4(B.Level_CONFIG_700, "Set SharedKey keyIndex " + t3, null, null);
+ t1.log$4(B.Level_INFO_800, "setting shared key", null, null);
+ keyProvider.sharedKey = key;
+ keyProvider.getSharedKeyHandler$0().setKey$2$keyIndex(key, keyIndex);
+ // goto join
+ $async$goto = 24;
+ break;
+ case 25:
+ // else
+ participantId = A._asString(msg.$index(0, "participantId"));
+ t1.log$4(B.Level_CONFIG_700, "Set key for participant " + participantId + ", keyIndex " + t3, null, null);
+ $async$goto = 26;
+ return A._asyncAwait(keyProvider.getParticipantKeyHandler$1(participantId).setKey$2$keyIndex(key, keyIndex), $async$call$1);
+ case 26:
+ // returning from await.
+ case 24:
+ // join
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKey", "participantId", msg.$index(0, "participantId"), "sharedKey", t2, "keyIndex", keyIndex, "msgId", msgId, "msgType", "response"], type$.String, type$.dynamic)));
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 13:
+ // case
+ case 14:
+ // case
+ keyIndex = msg.$index(0, "keyIndex");
+ participantId = A._asString(msg.$index(0, "participantId"));
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t1.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, null, null);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKey", "error", "KeyProvider not found", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
// goto return
$async$goto = 1;
break;
}
- ratchetCount = t8 + 1;
- $async$goto = 16;
- return A._asyncAwait($async$self.ratchetKey$1(keyIndex), $async$decodeFunction$2);
- case 16:
+ t2 = keyProvider.keyProviderOptions.sharedKey;
+ $async$goto = t2 ? 27 : 29;
+ break;
+ case 27:
+ // then
+ t1.log$4(B.Level_CONFIG_700, "RatchetKey for SharedKey, keyIndex " + A.S(keyIndex), null, null);
+ $async$goto = 30;
+ return A._asyncAwait(keyProvider.getSharedKeyHandler$0().ratchetKey$1(A._asIntQ(keyIndex)), $async$call$1);
+ case 30:
// returning from await.
- case 15:
+ newKey = $async$result;
+ // goto join
+ $async$goto = 28;
+ break;
+ case 29:
+ // else
+ t1.log$4(B.Level_CONFIG_700, "RatchetKey for participant " + participantId + ", keyIndex " + A.S(keyIndex), null, null);
+ $async$goto = 31;
+ return A._asyncAwait(keyProvider.getParticipantKeyHandler$1(participantId).ratchetKey$1(A._asIntQ(keyIndex)), $async$call$1);
+ case 31:
+ // returning from await.
+ newKey = $async$result;
+ case 28:
// join
- t8 = A._asIntQ(keyIndex);
- if (t8 == null)
- t8 = $async$self.currentKeyIndex;
- if (!(t8 >= 0 && t8 < 16)) {
- $async$returnValue = A.ioore(t2, t8);
+ t1 = type$.JSObject._as(self.self);
+ t1.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "ratchetKey", "sharedKey", t2, "participantId", participantId, "newKey", newKey != null ? B.C_Base64Encoder.convert$1(type$.Base64Codec._eval$1("Codec.S")._as(newKey)) : "", "keyIndex", keyIndex, "msgId", msgId, "msgType", "response"], type$.String, type$.dynamic)));
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 15:
+ // case
+ keyIndex = msg.$index(0, "index");
+ trackId = A._asString(msg.$index(0, "trackId"));
+ t1.log$4(B.Level_CONFIG_700, "Setup key index for track " + trackId, null, null);
+ t2 = $.participantCryptors;
+ t3 = A._arrayInstanceType(t2);
+ t4 = t3._eval$1("WhereIterable<1>");
+ cryptors = A.List_List$of(new A.WhereIterable(t2, t3._eval$1("bool(1)")._as(new A.main__closure0(trackId)), t4), true, t4._eval$1("Iterable.E"));
+ for (t2 = cryptors.length, _i = 0; _i < t2; ++_i) {
+ c = cryptors[_i];
+ t1.log$4(B.Level_CONFIG_700, "Set keyIndex for trackId " + c.trackId, null, null);
+ A._asInt(keyIndex);
+ if (c.lastError !== B.CryptorError_1) {
+ t1.log$4(B.Level_INFO_800, "setKeyIndex: lastError != CryptorError.kOk, reset state to kNew", null, null);
+ c.lastError = B.CryptorError_0;
+ }
+ t1.log$4(B.Level_CONFIG_700, "setKeyIndex for " + A.S(c.participantIdentity) + ", newIndex: " + keyIndex, null, null);
+ c.currentKeyIndex = keyIndex;
+ }
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKeyIndex", "keyIndex", keyIndex, "msgId", msgId, "msgType", "response"], type$.String, type$.dynamic)));
+ // goto after switch
+ $async$goto = 4;
+ break;
+ case 16:
+ // case
+ case 17:
+ // case
+ keyIndex = A._asInt(msg.$index(0, "keyIndex"));
+ participantId = A._asString(msg.$index(0, "participantId"));
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t1.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, null, null);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKey", "error", "KeyProvider not found", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
// goto return
$async$goto = 1;
break;
}
- currentkeySet = t2[t8];
- // goto after finally
- $async$goto = 12;
+ t2 = "" + keyIndex;
+ $async$goto = keyProvider.keyProviderOptions.sharedKey ? 32 : 34;
break;
- case 9:
- // uncaught
- // goto catch
- $async$goto = 4;
+ case 32:
+ // then
+ t1.log$4(B.Level_CONFIG_700, "Export SharedKey keyIndex " + t2, null, null);
+ $async$goto = 35;
+ return A._asyncAwait(keyProvider.getSharedKeyHandler$0().exportKey$1(keyIndex), $async$call$1);
+ case 35:
+ // returning from await.
+ key = $async$result;
+ // goto join
+ $async$goto = 33;
break;
- case 12:
- // after finally
- // goto for condition
- $async$goto = 7;
+ case 34:
+ // else
+ t1.log$4(B.Level_CONFIG_700, "Export key for participant " + participantId + ", keyIndex " + t2, null, null);
+ $async$goto = 36;
+ return A._asyncAwait(keyProvider.getParticipantKeyHandler$1(participantId).exportKey$1(keyIndex), $async$call$1);
+ case 36:
+ // returning from await.
+ key = $async$result;
+ case 33:
+ // join
+ t1 = type$.JSObject._as(self.self);
+ t1.postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "exportKey", "participantId", participantId, "keyIndex", keyIndex, "exportedKey", key != null ? B.C_Base64Encoder.convert$1(type$.Base64Codec._eval$1("Codec.S")._as(key)) : "", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_Object)));
+ // goto after switch
+ $async$goto = 4;
break;
- case 8:
- // after for
- t2 = $.$get$_CopyingBytesBuilder__emptyList();
- finalBuffer = new A._CopyingBytesBuilder(t2);
- J.add$1$ax(finalBuffer, new Uint8Array(A._ensureNativeList(J.sublist$2$x(buffer, 0, headerLength))));
- t2 = decrypted;
- t2.toString;
- J.add$1$ax(finalBuffer, A.NativeUint8List_NativeUint8List$view(t2, 0, null));
- t1.set$data(frame, A.jsArrayBufferFrom(finalBuffer.toBytes$0()));
- J.enqueue$1$x(controller, frame);
- if ($async$self.lastError !== B.CryptorError_1) {
- $async$self.lastError = B.CryptorError_1;
- B.DedicatedWorkerGlobalScope_methods.postMessage$1(t7, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", $async$self.participantId, "trackId", $async$self.trackId, "kind", $async$self.__Cryptor_kind_A, "state", "ok", "error", "decryption ok"], t5, t6));
+ case 18:
+ // case
+ sifTrailer = new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(msg.$index(0, "sifTrailer")))));
+ keyProviderId = A._asString(msg.$index(0, "keyProviderId"));
+ keyProvider = $.keyProviders.$index(0, keyProviderId);
+ if (keyProvider == null) {
+ t1.log$4(B.Level_WARNING_900, "KeyProvider not found for " + keyProviderId, null, null);
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setKey", "error", "KeyProvider not found", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
+ // goto return
+ $async$goto = 1;
+ break;
}
- $async$handler = 2;
- // goto after finally
- $async$goto = 6;
- break;
- case 4:
- // catch
- $async$handler = 3;
- $async$exception1 = $async$currentError;
- e = A.unwrapException($async$exception1);
- if ($async$self.lastError !== B.CryptorError_2) {
- $async$self.lastError = B.CryptorError_2;
- t1 = $async$self.participantId;
- t2 = $async$self.trackId;
- t3 = $async$self.__Cryptor_kind_A;
- t3 === $ && A.throwLateFieldNI("kind");
- B.DedicatedWorkerGlobalScope_methods.postMessage$1($async$self.worker, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorState", "participantId", t1, "trackId", t2, "kind", t3, "state", "decryptError", "error", J.toString$0$(e)], type$.String, type$.nullable_String));
+ keyProvider.keyProviderOptions.uncryptedMagicBytes = sifTrailer;
+ t1.log$4(B.Level_CONFIG_700, "SetSifTrailer = " + A.S(sifTrailer), null, null);
+ for (t2 = $.participantCryptors, t3 = t2.length, _i = 0; _i < t2.length; t2.length === t3 || (0, A.throwConcurrentModificationError)(t2), ++_i) {
+ c = t2[_i];
+ t1.log$4(B.Level_CONFIG_700, "setSifTrailer for " + A.S(c.participantIdentity) + ", magicBytes: " + A.S(sifTrailer), null, null);
+ c.keyHandler.keyOptions.uncryptedMagicBytes = sifTrailer;
}
- $async$goto = initialKeySet != null ? 17 : 18;
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "setSifTrailer", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
+ // goto after switch
+ $async$goto = 4;
break;
- case 17:
- // then
- $async$goto = 19;
- return A._asyncAwait($async$self.setKeySetFromMaterial$2(initialKeySet, initialKeyIndex), $async$decodeFunction$2);
case 19:
- // returning from await.
- case 18:
- // join
- // goto after finally
- $async$goto = 6;
+ // case
+ codec = A._asString(msg.$index(0, "codec"));
+ trackId = A._asString(msg.$index(0, "trackId"));
+ t1.log$4(B.Level_CONFIG_700, "Update codec for trackId " + trackId + ", codec " + codec, null, null);
+ cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure1(trackId), type$.FrameCryptor);
+ if (cryptor != null) {
+ if (cryptor.lastError !== B.CryptorError_1) {
+ t1.log$4(B.Level_INFO_800, "updateCodec[" + codec + string$.___las, null, null);
+ cryptor.lastError = B.CryptorError_0;
+ }
+ t1.log$4(B.Level_CONFIG_700, "updateCodec for " + A.S(cryptor.participantIdentity) + ", codec: " + codec, null, null);
+ cryptor.codec = codec;
+ }
+ type$.JSObject._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "updateCodec", "msgId", msgId, "msgType", "response"], type$.String, type$.nullable_String)));
+ // goto after switch
+ $async$goto = 4;
break;
- case 3:
- // uncaught
- // goto rethrow
- $async$goto = 2;
+ case 20:
+ // case
+ trackId = A._asString(msg.$index(0, "trackId"));
+ t1.log$4(B.Level_CONFIG_700, "Dispose for trackId " + trackId, null, null);
+ cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure2(trackId), type$.FrameCryptor);
+ t1 = type$.JSObject;
+ t2 = type$.String;
+ t3 = type$.nullable_String;
+ if (cryptor != null) {
+ cryptor.lastError = B.CryptorError_8;
+ t1._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorDispose", "participantId", cryptor.participantIdentity, "trackId", trackId, "msgId", msgId, "msgType", "response"], t2, t3)));
+ } else
+ t1._as(self.self).postMessage(A.jsify(A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorDispose", "error", "cryptor not found", "msgId", msgId, "msgType", "response"], t2, t3)));
+ // goto after switch
+ $async$goto = 4;
break;
- case 6:
- // after finally
+ case 21:
+ // default
+ t1.log$4(B.Level_WARNING_900, "Unknown message kind " + msg.toString$0(0), null, null);
+ case 4:
+ // after switch
case 1:
// return
return A._asyncReturn($async$returnValue, $async$completer);
- case 2:
- // rethrow
- return A._asyncRethrow($async$currentError, $async$completer);
}
});
- return A._asyncStartSync($async$decodeFunction$2, $async$completer);
- },
- get$participantId(receiver) {
- return this.participantId;
- },
- get$trackId(receiver) {
- return this.trackId;
- },
- get$codec(receiver) {
- return this.codec;
- }
- };
- A.Cryptor_ratchetKey_closure.prototype = {
- call$1(newMaterial) {
- var t1 = this.$this;
- t1.deriveKeys$2(type$.CryptoKey._as(newMaterial), t1.keyOptions.ratchetSalt).then$1$1(new A.Cryptor_ratchetKey__closure(t1, this.keyIndex), type$.Null);
- },
- $signature: 24
- };
- A.Cryptor_ratchetKey__closure.prototype = {
- call$1(newKeySet) {
- var t1, t2;
- type$.KeySet._as(newKeySet);
- t1 = this.$this;
- t2 = this.keyIndex;
- t1.setKeySetFromMaterial$2(newKeySet, t2 == null ? t1.currentKeyIndex : t2).then$1$1(new A.Cryptor_ratchetKey___closure(t1), type$.Null);
- },
- $signature: 25
- };
- A.Cryptor_ratchetKey___closure.prototype = {
- call$1(_) {
- var t1 = this.$this;
- t1._ratchetCompleter.complete$0(0);
- t1._ratchetCompleter = null;
- },
- $signature: 26
- };
- A.TransformMessage.prototype = {};
- A.EnableTransformMessage.prototype = {};
- A.RemoveTransformMessage.prototype = {};
- A.main_closure.prototype = {
- call$1($event) {
- var t1, options, t2, kind, participantId, trackId, codec, msgType, cryptor;
- A.print("got transform event");
- t1 = type$.JavaScriptObject._as(type$.RTCTransformEvent._as($event).transformer);
- t1.handled = true;
- options = t1.options;
- t2 = J.getInterceptor$x(options);
- kind = t2.get$kind(options);
- participantId = t2.get$participantId(options);
- trackId = t2.get$trackId(options);
- codec = t2.get$codec(options);
- msgType = t2.get$msgType(options);
- cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure8(trackId), type$.Cryptor);
- if (cryptor == null) {
- t2 = self.self;
- A._asStringQ(participantId);
- A._asStringQ(trackId);
- cryptor = A.Cryptor$($.$get$keyProviderOptions(), participantId, trackId, t2);
- B.JSArray_methods.add$1($.participantCryptors, cryptor);
- }
- A._asString(msgType);
- t2 = type$.ReadableStream._as(t1.readable);
- t1 = type$.WritableStream._as(t1.writable);
- A._asString(trackId);
- A._asString(kind);
- cryptor.setupTransform$6$codec$kind$operation$readable$trackId$writable(A._asStringQ(codec), kind, msgType, t2, trackId, t1);
- },
- $signature: 3
- };
- A.main__closure8.prototype = {
- call$1(c) {
- return type$.Cryptor._as(c).trackId == this.trackId;
- },
- $signature: 1
- };
- A.main_closure0.prototype = {
- call$1(e) {
- var copy, msgType, options, t3, enabled, participantId, t4, cryptors, line, _i, cryptor, kind, exist, trackId, readable, writable, key, keyIndex, c, keySet, codec,
- _s13_ = "participantId",
- _s53_ = "]: lastError != CryptorError.kOk, reset state to kNew",
- _s7_ = "trackId",
- _s8_ = "keyIndex",
- t1 = type$.MessageEvent._as(e).data,
- t2 = new A._AcceptStructuredCloneDart2Js([], []);
- t2.mustCopy = true;
- copy = t2.walk$1(t1);
- t1 = J.getInterceptor$asx(copy);
- msgType = t1.$index(copy, "msgType");
- switch (msgType) {
- case "init":
- options = t1.$index(copy, "keyOptions");
- t1 = J.getInterceptor$asx(options);
- t2 = A._asBool(t1.$index(options, "sharedKey"));
- t3 = new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(t1.$index(options, "ratchetSalt")))));
- t1 = A._asInt(t1.$index(options, "ratchetWindowSize"));
- $.keyProviderOptions = new A.KeyOptions(t2, t3, t1);
- A.print("worker: init with keyOptions " + ("KeyOptions{sharedKey: " + t2 + ", ratchetWindowSize: " + t1 + "}"));
- break;
- case "enable":
- enabled = A._asBool(t1.$index(copy, "enabled"));
- participantId = A._asString(t1.$index(copy, _s13_));
- t1 = "" + enabled;
- A.print("worker: set enable " + t1 + " for participantId " + participantId);
- t2 = $.participantCryptors;
- t3 = A._arrayInstanceType(t2);
- t4 = t3._eval$1("WhereIterable<1>");
- cryptors = A.List_List$of(new A.WhereIterable(t2, t3._eval$1("bool(1)")._as(new A.main__closure(participantId)), t4), true, t4._eval$1("Iterable.E"));
- for (t2 = cryptors.length, line = "setEnabled[" + t1 + _s53_, _i = 0; _i < t2; ++_i) {
- cryptor = cryptors[_i];
- if (cryptor.lastError !== B.CryptorError_1) {
- A.printString(line);
- cryptor.lastError = B.CryptorError_0;
- }
- cryptor.enabled = enabled;
- }
- J.postMessage$1$x(self.self, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorEnabled", "participantId", participantId, "enable", enabled], type$.String, type$.Object));
- break;
- case "decode":
- case "encode":
- kind = t1.$index(copy, "kind");
- exist = A._asBool(t1.$index(copy, "exist"));
- participantId = A._asString(t1.$index(copy, _s13_));
- trackId = t1.$index(copy, _s7_);
- readable = type$.ReadableStream._as(t1.$index(copy, "readableStream"));
- writable = type$.WritableStream._as(t1.$index(copy, "writableStream"));
- A.print("worker: got " + A.S(msgType) + ", kind " + A.S(kind) + ", trackId " + A.S(trackId) + ", participantId " + participantId + ", " + B.Type_JSObject_8k0.toString$0(0) + " " + B.Type_JSObject_8k0.toString$0(0) + "}");
- cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure0(trackId), type$.Cryptor);
- if (cryptor == null) {
- t1 = self.self;
- A._asStringQ(trackId);
- cryptor = A.Cryptor$($.$get$keyProviderOptions(), participantId, trackId, t1);
- B.JSArray_methods.add$1($.participantCryptors, cryptor);
- }
- if (!exist) {
- A._asString(msgType);
- A._asString(trackId);
- cryptor.setupTransform$5$kind$operation$readable$trackId$writable(A._asString(kind), msgType, readable, trackId, writable);
- }
- if (cryptor.lastError !== B.CryptorError_1) {
- A.print("setParticipantId: lastError != CryptorError.kOk, reset state to kNew");
- cryptor.lastError = B.CryptorError_0;
- }
- cryptor.participantId = participantId;
- J.postMessage$1$x(self.self, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorSetup", "participantId", participantId, "trackId", trackId, "exist", exist, "operation", msgType], type$.String, type$.dynamic));
- cryptor.lastError = B.CryptorError_0;
- break;
- case "removeTransform":
- trackId = A._asString(t1.$index(copy, _s7_));
- A.print("worker: removing trackId " + trackId);
- t1 = $.participantCryptors;
- t2 = A._arrayInstanceType(t1)._eval$1("bool(1)")._as(new A.main__closure1(trackId));
- if (!!t1.fixed$length)
- A.throwExpression(A.UnsupportedError$("removeWhere"));
- B.JSArray_methods._removeWhere$2(t1, t2, true);
- break;
- case "setKey":
- key = new Uint8Array(A._ensureNativeList(B.C_Base64Decoder.convert$1(A._asString(t1.$index(copy, "key")))));
- keyIndex = t1.$index(copy, _s8_);
- participantId = A._asString(t1.$index(copy, _s13_));
- A.print("worker: setup key for participant " + participantId);
- if ($.$get$keyProviderOptions().sharedKey) {
- for (t1 = $.participantCryptors, t2 = t1.length, _i = 0; _i < t1.length; t1.length === t2 || (0, A.throwConcurrentModificationError)(t1), ++_i)
- t1[_i].setKey$2(A._asInt(keyIndex), key);
- return;
- }
- t1 = $.participantCryptors;
- t2 = A._arrayInstanceType(t1);
- t3 = t2._eval$1("WhereIterable<1>");
- cryptors = A.List_List$of(new A.WhereIterable(t1, t2._eval$1("bool(1)")._as(new A.main__closure2(participantId)), t3), true, t3._eval$1("Iterable.E"));
- for (t1 = cryptors.length, _i = 0; _i < t1; ++_i)
- cryptors[_i].setKey$2(A._asInt(keyIndex), key);
- break;
- case "ratchetKey":
- keyIndex = t1.$index(copy, _s8_);
- participantId = A._asString(t1.$index(copy, _s13_));
- A.print("worker: ratchetKey for participant " + participantId + ", keyIndex " + A.S(keyIndex));
- t1 = $.participantCryptors;
- t2 = A._arrayInstanceType(t1);
- t3 = t2._eval$1("WhereIterable<1>");
- cryptors = A.List_List$of(new A.WhereIterable(t1, t2._eval$1("bool(1)")._as(new A.main__closure3(participantId)), t3), true, t3._eval$1("Iterable.E"));
- for (t1 = cryptors.length, t2 = type$.Null, _i = 0; _i < t1; ++_i) {
- c = cryptors[_i];
- A._asIntQ(keyIndex);
- t3 = c.cryptoKeyRing;
- t4 = keyIndex == null ? c.currentKeyIndex : keyIndex;
- if (!(t4 >= 0 && t4 < 16))
- return A.ioore(t3, t4);
- keySet = t3[t4];
- c.ratchetKey$1(keyIndex).then$1$1(new A.main__closure4(c, keySet, participantId), t2);
- }
- break;
- case "setKeyIndex":
- keyIndex = t1.$index(copy, "index");
- participantId = A._asString(t1.$index(copy, _s13_));
- A.print("worker: setup key index for participant " + participantId);
- t1 = $.participantCryptors;
- t2 = A._arrayInstanceType(t1);
- t3 = t2._eval$1("WhereIterable<1>");
- cryptors = A.List_List$of(new A.WhereIterable(t1, t2._eval$1("bool(1)")._as(new A.main__closure5(participantId)), t3), true, t3._eval$1("Iterable.E"));
- for (t1 = cryptors.length, _i = 0; _i < t1; ++_i) {
- c = cryptors[_i];
- A._asInt(keyIndex);
- if (c.lastError !== B.CryptorError_1) {
- A.printString("setKeyIndex: lastError != CryptorError.kOk, reset state to kNew");
- c.lastError = B.CryptorError_0;
- }
- c.currentKeyIndex = keyIndex;
- }
- break;
- case "updateCodec":
- codec = A._asString(t1.$index(copy, "codec"));
- trackId = A._asString(t1.$index(copy, _s7_));
- A.print("worker: update codec for trackId " + trackId + ", codec " + codec);
- cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure6(trackId), type$.Cryptor);
- if (cryptor != null) {
- if (cryptor.lastError !== B.CryptorError_1) {
- A.print("updateCodec[" + codec + _s53_);
- cryptor.lastError = B.CryptorError_0;
- }
- cryptor.codec = codec;
- }
- break;
- case "dispose":
- trackId = A._asString(t1.$index(copy, _s7_));
- A.print("worker: dispose trackId " + trackId);
- cryptor = A.IterableExtension_firstWhereOrNull($.participantCryptors, new A.main__closure7(trackId), type$.Cryptor);
- if (cryptor != null) {
- cryptor.lastError = B.CryptorError_8;
- J.postMessage$1$x(self.self, A.LinkedHashMap_LinkedHashMap$_literal(["type", "cryptorDispose", "participantId", cryptor.participantId, "trackId", trackId], type$.String, type$.nullable_String));
- }
- break;
- default:
- A.print("worker: unknown message kind " + A.S(copy));
- }
+ return A._asyncStartSync($async$call$1, $async$completer);
},
- $signature: 27
+ $signature: 22
};
A.main__closure.prototype = {
call$1(c) {
- return type$.Cryptor._as(c).participantId === this.participantId;
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
$signature: 1
};
A.main__closure0.prototype = {
call$1(c) {
- var t1 = type$.Cryptor._as(c).trackId,
- t2 = this.trackId;
- return t1 == null ? t2 == null : t1 === t2;
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
$signature: 1
};
A.main__closure1.prototype = {
call$1(c) {
- return type$.Cryptor._as(c).trackId === this.trackId;
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
$signature: 1
};
A.main__closure2.prototype = {
call$1(c) {
- return type$.Cryptor._as(c).participantId === this.participantId;
+ return type$.FrameCryptor._as(c).trackId === this.trackId;
},
$signature: 1
};
- A.main__closure3.prototype = {
- call$1(c) {
- return type$.Cryptor._as(c).participantId === this.participantId;
+ A.main_closure1.prototype = {
+ call$1(e) {
+ this.handleMessage.call$1(type$.JSObject._as(e));
},
- $signature: 1
+ $signature: 11
};
- A.main__closure4.prototype = {
- call$1(_) {
- var $async$goto = 0,
- $async$completer = A._makeAsyncAwaitCompleter(type$.Null),
- $async$self = this, t1, newKey;
- var $async$call$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
- if ($async$errorCode === 1)
- return A._asyncRethrow($async$result, $async$completer);
- while (true)
- switch ($async$goto) {
- case 0:
- // Function start
- t1 = $async$self.c;
- $async$goto = 2;
- return A._asyncAwait(t1.ratchet$2($async$self.keySet.material, $.$get$keyProviderOptions().ratchetSalt), $async$call$1);
- case 2:
- // returning from await.
- newKey = $async$result;
- J.postMessage$1$x(self.self, A.LinkedHashMap_LinkedHashMap$_literal(["type", "ratchetKey", "participantId", $async$self.participantId, "trackId", t1.trackId, "key", B.C_Base64Encoder.convert$1(type$.Base64Codec._eval$1("Codec.S")._as(newKey))], type$.String, type$.nullable_String));
- // implicit return
- return A._asyncReturn(null, $async$completer);
- }
- });
- return A._asyncStartSync($async$call$1, $async$completer);
+ A.Level.prototype = {
+ $eq(_, other) {
+ if (other == null)
+ return false;
+ return other instanceof A.Level && this.value === other.value;
},
- $signature: 28
- };
- A.main__closure5.prototype = {
- call$1(c) {
- return type$.Cryptor._as(c).participantId === this.participantId;
+ get$hashCode(_) {
+ return this.value;
},
- $signature: 1
+ toString$0(_) {
+ return this.name;
+ }
};
- A.main__closure6.prototype = {
- call$1(c) {
- return type$.Cryptor._as(c).trackId === this.trackId;
+ A.LogRecord.prototype = {
+ toString$0(_) {
+ return "[" + this.level.name + "] " + this.loggerName + ": " + this.message;
+ }
+ };
+ A.Logger.prototype = {
+ get$fullName() {
+ var t1 = this.parent,
+ t2 = t1 == null ? null : t1.name.length !== 0,
+ t3 = this.name;
+ return t2 === true ? t1.get$fullName() + "." + t3 : t3;
},
- $signature: 1
+ get$level() {
+ var t1, effectiveLevel;
+ if (this.parent == null) {
+ t1 = this._level;
+ t1.toString;
+ effectiveLevel = t1;
+ } else {
+ t1 = $.$get$Logger_root()._level;
+ t1.toString;
+ effectiveLevel = t1;
+ }
+ return effectiveLevel;
+ },
+ log$4(logLevel, message, error, stackTrace) {
+ var record, _this = this,
+ t1 = logLevel.value;
+ if (t1 >= _this.get$level().value) {
+ if (t1 >= 2000) {
+ A.StackTrace_current();
+ logLevel.toString$0(0);
+ }
+ t1 = _this.get$fullName();
+ Date.now();
+ $.LogRecord__nextNumber = $.LogRecord__nextNumber + 1;
+ record = new A.LogRecord(logLevel, message, t1);
+ if (_this.parent == null)
+ _this._publish$1(record);
+ else
+ $.$get$Logger_root()._publish$1(record);
+ }
+ },
+ _getStream$0() {
+ if (this.parent == null) {
+ var t1 = this._controller;
+ if (t1 == null) {
+ t1 = new A._SyncBroadcastStreamController(null, null, type$._SyncBroadcastStreamController_LogRecord);
+ this.set$_controller(t1);
+ }
+ return new A._BroadcastStream(t1, A._instanceType(t1)._eval$1("_BroadcastStream<1>"));
+ } else
+ return $.$get$Logger_root()._getStream$0();
+ },
+ _publish$1(record) {
+ var t1 = this._controller;
+ if (t1 != null) {
+ A._instanceType(t1)._precomputed1._as(record);
+ if (!t1.get$_mayAddEvent())
+ A.throwExpression(t1._addEventError$0());
+ t1._sendData$1(record);
+ }
+ return null;
+ },
+ set$_controller(_controller) {
+ this._controller = type$.nullable_StreamController_LogRecord._as(_controller);
+ }
};
- A.main__closure7.prototype = {
- call$1(c) {
- return type$.Cryptor._as(c).trackId === this.trackId;
+ A.Logger_Logger_closure.prototype = {
+ call$0() {
+ var dot, $parent, t1,
+ thisName = this.name;
+ if (B.JSString_methods.startsWith$1(thisName, "."))
+ A.throwExpression(A.ArgumentError$("name shouldn't start with a '.'", null));
+ if (B.JSString_methods.endsWith$1(thisName, "."))
+ A.throwExpression(A.ArgumentError$("name shouldn't end with a '.'", null));
+ dot = B.JSString_methods.lastIndexOf$1(thisName, ".");
+ if (dot === -1)
+ $parent = thisName !== "" ? A.Logger_Logger("") : null;
+ else {
+ $parent = A.Logger_Logger(B.JSString_methods.substring$2(thisName, 0, dot));
+ thisName = B.JSString_methods.substring$1(thisName, dot + 1);
+ }
+ t1 = new A.Logger(thisName, $parent, A.LinkedHashMap_LinkedHashMap$_empty(type$.String, type$.Logger));
+ if ($parent == null)
+ t1._level = B.Level_INFO_800;
+ else
+ $parent._children.$indexSet(0, thisName, t1);
+ return t1;
},
- $signature: 1
+ $signature: 23
};
(function aliases() {
- var _ = J.Interceptor.prototype;
- _.super$Interceptor$toString = _.toString$0;
- _ = J.LegacyJavaScriptObject.prototype;
+ var _ = J.LegacyJavaScriptObject.prototype;
_.super$LegacyJavaScriptObject$toString = _.toString$0;
- _ = A.ListMixin.prototype;
- _.super$ListMixin$setRange = _.setRange$4;
+ _ = A._BroadcastStreamController.prototype;
+ _.super$_BroadcastStreamController$_addEventError = _._addEventError$0;
})();
(function installTearOffs() {
var _static_1 = hunkHelpers._static_1,
_static_0 = hunkHelpers._static_0,
- _instance_2_u = hunkHelpers._instance_2u;
- _static_1(A, "async__AsyncRun__scheduleImmediateJsOverride$closure", "_AsyncRun__scheduleImmediateJsOverride", 5);
- _static_1(A, "async__AsyncRun__scheduleImmediateWithSetImmediate$closure", "_AsyncRun__scheduleImmediateWithSetImmediate", 5);
- _static_1(A, "async__AsyncRun__scheduleImmediateWithTimer$closure", "_AsyncRun__scheduleImmediateWithTimer", 5);
+ _static_2 = hunkHelpers._static_2,
+ _instance_2_u = hunkHelpers._instance_2u,
+ _instance_0_u = hunkHelpers._instance_0u;
+ _static_1(A, "async__AsyncRun__scheduleImmediateJsOverride$closure", "_AsyncRun__scheduleImmediateJsOverride", 4);
+ _static_1(A, "async__AsyncRun__scheduleImmediateWithSetImmediate$closure", "_AsyncRun__scheduleImmediateWithSetImmediate", 4);
+ _static_1(A, "async__AsyncRun__scheduleImmediateWithTimer$closure", "_AsyncRun__scheduleImmediateWithTimer", 4);
_static_0(A, "async___startMicrotaskLoop$closure", "_startMicrotaskLoop", 0);
+ _static_2(A, "async___nullErrorHandler$closure", "_nullErrorHandler", 6);
+ _static_0(A, "async___nullDoneHandler$closure", "_nullDoneHandler", 0);
+ _instance_2_u(A._Future.prototype, "get$_completeError", "_completeError$2", 6);
+ _instance_0_u(A._DoneStreamSubscription.prototype, "get$_onMicrotask", "_onMicrotask$0", 0);
var _;
- _instance_2_u(_ = A.Cryptor.prototype, "get$encodeFunction", "encodeFunction$2", 7);
- _instance_2_u(_, "get$decodeFunction", "decodeFunction$2", 7);
+ _instance_2_u(_ = A.FrameCryptor.prototype, "get$encodeFunction", "encodeFunction$2", 9);
+ _instance_2_u(_, "get$decodeFunction", "decodeFunction$2", 9);
})();
(function inheritance() {
var _mixin = hunkHelpers.mixin,
_inherit = hunkHelpers.inherit,
_inheritMany = hunkHelpers.inheritMany;
_inherit(A.Object, null);
- _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, J.ArrayIterator, A._CopyingBytesBuilder, A.Error, A._ListBase_Object_ListMixin, A.SentinelValue, A.Iterable, A.ListIterator, A.Iterator, A.FixedLengthListMixin, A.UnmodifiableListMixin, A.Symbol, A.MapView, A.ConstantMap, A.JSInvocationMirror, A.Closure, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A._Required, A.MapMixin, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A.AsyncError, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A.Stream, A.StreamSubscription, A.StreamTransformerBase, A._StreamIterator, A._Zone, A._HashMapKeyIterator, A.ListMixin, A._UnmodifiableMapMixin, A.Codec, A._Base64Encoder, A._Base64Decoder, A.DateTime, A._Enum, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.Null, A._StringStackTrace, A.StringBuffer, A.CssStyleDeclarationBase, A.EventStreamProvider, A.ImmutableListMixin, A.FixedSizeListIterator, A._StructuredClone, A._AcceptStructuredClone, A.NullRejectionException, A._JSSecureRandom, A.KeyOptions, A.KeySet, A.Cryptor]);
- _inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JSArray, J.JSNumber, J.JSString, A.NativeByteBuffer, A.NativeTypedData]);
- _inheritMany(J.JavaScriptObject, [J.LegacyJavaScriptObject, A.EventTarget, A.AccessibleNodeList, A.Blob, A.CryptoKey, A.CssTransformComponent, A.CssRule, A._CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase, A.CssStyleValue, A.DataTransferItem, A.DataTransferItemList, A.DomException, A._DomRectList_JavaScriptObject_ListMixin, A.DomRectReadOnly, A._DomStringList_JavaScriptObject_ListMixin, A.DomTokenList, A.Event, A._FileList_JavaScriptObject_ListMixin, A.Gamepad, A.History, A._HtmlCollection_JavaScriptObject_ListMixin, A.ImageData, A.Location, A.MediaDeviceInfo, A.MediaList, A._MidiInputMap_JavaScriptObject_MapMixin, A._MidiOutputMap_JavaScriptObject_MapMixin, A.MimeType, A._MimeTypeArray_JavaScriptObject_ListMixin, A._NodeList_JavaScriptObject_ListMixin, A.Plugin, A._PluginArray_JavaScriptObject_ListMixin, A._RtcStatsReport_JavaScriptObject_MapMixin, A.SharedArrayBuffer, A.SpeechGrammar, A._SpeechGrammarList_JavaScriptObject_ListMixin, A.SpeechRecognitionResult, A._Storage_JavaScriptObject_MapMixin, A.StyleSheet, A._TextTrackCueList_JavaScriptObject_ListMixin, A.TimeRanges, A.Touch, A._TouchList_JavaScriptObject_ListMixin, A.TrackDefaultList, A.Url, A.VideoTrack, A.__CssRuleList_JavaScriptObject_ListMixin, A.__GamepadList_JavaScriptObject_ListMixin, A.__NamedNodeMap_JavaScriptObject_ListMixin, A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin, A.__StyleSheetList_JavaScriptObject_ListMixin, A.Length, A._LengthList_JavaScriptObject_ListMixin, A.Number, A._NumberList_JavaScriptObject_ListMixin, A.PointList, A._StringList_JavaScriptObject_ListMixin, A.Transform, A._TransformList_JavaScriptObject_ListMixin, A.AudioBuffer, A._AudioParamMap_JavaScriptObject_MapMixin, A.AudioTrack]);
- _inheritMany(J.LegacyJavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction, A.WritableStream, A.ReadableStream, A.TransformStream, A.TransformStreamDefaultController, A.EncodedStreams, A.RTCEncodedFrame, A.RTCEncodedAudioFrame, A.RTCEncodedVideoFrame, A.RTCEncodedFrameMetadata, A.RTCEncodedAudioFrameMetadata, A.RTCEncodedVideoFrameMetadata, A.RTCTransformEvent, A.RTCRtpScriptTransformer, A.RTCRtpScriptTransform, A.Promise, A.Algorithm, A.AesGcmParams, A.TransformMessage, A.EnableTransformMessage, A.RemoveTransformMessage]);
+ _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, J.ArrayIterator, A._CopyingBytesBuilder, A.Error, A.SentinelValue, A.Iterable, A.ListIterator, A.MappedIterator, A.WhereIterator, A.FixedLengthListMixin, A.Symbol, A.MapView, A.ConstantMap, A._KeysOrValuesOrElementsIterator, A.JSInvocationMirror, A.Closure, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A._Required, A.MapBase, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A._UnmodifiableNativeByteBufferView, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A.AsyncError, A.Stream, A._BufferingStreamSubscription, A._BroadcastStreamController, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A._DelayedEvent, A._PendingEvents, A._DoneStreamSubscription, A._StreamIterator, A._Zone, A._HashMapKeyIterator, A.ListBase, A._UnmodifiableMapMixin, A.Codec, A.Converter, A._Base64Encoder, A._Base64Decoder, A.DateTime, A._Enum, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.Null, A._StringStackTrace, A.StringBuffer, A.NullRejectionException, A._JSSecureRandom, A.FrameInfo, A.FrameCryptor, A.KeyOptions, A.KeyProvider, A.KeySet, A.ParticipantKeyHandler, A.SifGuard, A.Level, A.LogRecord, A.Logger]);
+ _inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JavaScriptBigInt, J.JavaScriptSymbol, J.JSNumber, J.JSString]);
+ _inheritMany(J.JavaScriptObject, [J.LegacyJavaScriptObject, J.JSArray, A.NativeByteBuffer, A.NativeTypedData]);
+ _inheritMany(J.LegacyJavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction]);
_inherit(J.JSUnmodifiableArray, J.JSArray);
_inheritMany(J.JSNumber, [J.JSInt, J.JSNumNotInt]);
- _inheritMany(A.Error, [A.LateError, A.TypeError, A.JsNoSuchMethodError, A.UnknownJsTypeError, A.RuntimeError, A.AssertionError, A._Error, A.NullThrownError, A.ArgumentError, A.NoSuchMethodError, A.UnsupportedError, A.UnimplementedError, A.StateError, A.ConcurrentModificationError, A.CyclicInitializationError]);
- _inherit(A.ListBase, A._ListBase_Object_ListMixin);
- _inherit(A.UnmodifiableListBase, A.ListBase);
- _inherit(A.CodeUnits, A.UnmodifiableListBase);
- _inheritMany(A.Iterable, [A.EfficientLengthIterable, A.MappedIterable, A.WhereIterable, A._ConstantMapKeyIterable]);
- _inheritMany(A.EfficientLengthIterable, [A.ListIterable, A.LinkedHashMapKeyIterable, A._HashMapKeyIterable]);
- _inheritMany(A.ListIterable, [A.SubListIterable, A.MappedListIterable]);
+ _inheritMany(A.Error, [A.LateError, A.TypeError, A.JsNoSuchMethodError, A.UnknownJsTypeError, A._CyclicInitializationError, A.RuntimeError, A.AssertionError, A._Error, A.ArgumentError, A.NoSuchMethodError, A.UnsupportedError, A.UnimplementedError, A.StateError, A.ConcurrentModificationError]);
+ _inheritMany(A.Iterable, [A.EfficientLengthIterable, A.MappedIterable, A.WhereIterable, A._KeysOrValues]);
+ _inheritMany(A.EfficientLengthIterable, [A.ListIterable, A.LinkedHashMapKeysIterable, A._HashMapKeyIterable]);
_inherit(A.EfficientLengthMappedIterable, A.MappedIterable);
- _inheritMany(A.Iterator, [A.MappedIterator, A.WhereIterator]);
+ _inherit(A.MappedListIterable, A.ListIterable);
_inherit(A._UnmodifiableMapView_MapView__UnmodifiableMapMixin, A.MapView);
_inherit(A.UnmodifiableMapView, A._UnmodifiableMapView_MapView__UnmodifiableMapMixin);
_inherit(A.ConstantMapView, A.UnmodifiableMapView);
_inherit(A.ConstantStringMap, A.ConstantMap);
- _inheritMany(A.Closure, [A.Closure2Args, A.Closure0Args, A.TearOffClosure, A.initHooks_closure, A.initHooks_closure1, A._AsyncRun__initializeScheduleImmediate_internalCallback, A._AsyncRun__initializeScheduleImmediate_closure, A._awaitOnObject_closure, A._Future__chainForeignFuture_closure, A._Future__propagateToListeners_handleWhenCompleteCallback_closure, A.Stream_length_closure, A._RootZone_bindUnaryCallbackGuarded_closure, A._EventStreamSubscription_closure, A._convertDataTree__convert, A.promiseToFuture_closure, A.promiseToFuture_closure0, A.Cryptor_ratchetKey_closure, A.Cryptor_ratchetKey__closure, A.Cryptor_ratchetKey___closure, A.main_closure, A.main__closure8, A.main_closure0, A.main__closure, A.main__closure0, A.main__closure1, A.main__closure2, A.main__closure3, A.main__closure4, A.main__closure5, A.main__closure6, A.main__closure7]);
- _inheritMany(A.Closure2Args, [A.Primitives_functionNoSuchMethod_closure, A.initHooks_closure0, A._awaitOnObject_closure0, A._wrapJsFunctionForAsync_closure, A._Future__chainForeignFuture_closure0, A.MapBase_mapToString_closure, A.NoSuchMethodError_toString_closure, A.MidiInputMap_keys_closure, A.MidiOutputMap_keys_closure, A.RtcStatsReport_keys_closure, A.Storage_keys_closure, A._StructuredClone_walk_closure, A._StructuredClone_walk_closure0, A._AcceptStructuredClone_walk_closure, A.AudioParamMap_keys_closure]);
+ _inheritMany(A.Closure, [A.Closure2Args, A.Closure0Args, A.TearOffClosure, A.initHooks_closure, A.initHooks_closure1, A._AsyncRun__initializeScheduleImmediate_internalCallback, A._AsyncRun__initializeScheduleImmediate_closure, A._awaitOnObject_closure, A._SyncBroadcastStreamController__sendData_closure, A._Future__chainForeignFuture_closure, A._Future__propagateToListeners_handleWhenCompleteCallback_closure, A.Stream_length_closure, A.jsify__convert, A.promiseToFuture_closure, A.promiseToFuture_closure0, A.dartify_convert, A.getTrackCryptor_closure, A.unsetCryptorParticipant_closure, A.main_closure, A.main_closure0, A.main_closure2, A.main__closure, A.main__closure0, A.main__closure1, A.main__closure2, A.main_closure1]);
+ _inheritMany(A.Closure2Args, [A.Primitives_functionNoSuchMethod_closure, A.initHooks_closure0, A._awaitOnObject_closure0, A._wrapJsFunctionForAsync_closure, A._Future__chainForeignFuture_closure0, A._Future__propagateToListeners_handleWhenCompleteCallback_closure0, A.MapBase_mapToString_closure, A.NoSuchMethodError_toString_closure]);
_inherit(A.NullError, A.TypeError);
_inheritMany(A.TearOffClosure, [A.StaticClosure, A.BoundClosure]);
_inherit(A._AssertionError, A.AssertionError);
- _inherit(A.MapBase, A.MapMixin);
_inheritMany(A.MapBase, [A.JsLinkedHashMap, A._HashMap]);
_inheritMany(A.NativeTypedData, [A.NativeByteData, A.NativeTypedArray]);
_inheritMany(A.NativeTypedArray, [A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin, A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin]);
@@ -10011,228 +9437,107 @@
_inherit(A.NativeTypedArrayOfDouble, A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin_FixedLengthListMixin);
_inherit(A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin_FixedLengthListMixin, A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin);
_inherit(A.NativeTypedArrayOfInt, A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin_FixedLengthListMixin);
+ _inheritMany(A.NativeTypedArrayOfDouble, [A.NativeFloat32List, A.NativeFloat64List]);
_inheritMany(A.NativeTypedArrayOfInt, [A.NativeInt16List, A.NativeInt32List, A.NativeInt8List, A.NativeUint16List, A.NativeUint32List, A.NativeUint8ClampedList, A.NativeUint8List]);
_inherit(A._TypeError, A._Error);
- _inheritMany(A.Closure0Args, [A._AsyncRun__scheduleImmediateJsOverride_internalCallback, A._AsyncRun__scheduleImmediateWithSetImmediate_internalCallback, A._TimerImpl_internalCallback, A._Future__addListener_closure, A._Future__prependListeners_closure, A._Future__chainForeignFuture_closure1, A._Future__asyncCompleteWithValue_closure, A._Future__chainFuture_closure, A._Future__asyncCompleteError_closure, A._Future__propagateToListeners_handleWhenCompleteCallback, A._Future__propagateToListeners_handleValueCallback, A._Future__propagateToListeners_handleError, A.Stream_length_closure0, A._rootHandleError_closure, A._RootZone_bindCallbackGuarded_closure]);
+ _inheritMany(A.Closure0Args, [A._AsyncRun__scheduleImmediateJsOverride_internalCallback, A._AsyncRun__scheduleImmediateWithSetImmediate_internalCallback, A._TimerImpl_internalCallback, A._Future__addListener_closure, A._Future__prependListeners_closure, A._Future__chainForeignFuture_closure1, A._Future__chainCoreFuture_closure, A._Future__asyncCompleteWithValue_closure, A._Future__asyncCompleteError_closure, A._Future__propagateToListeners_handleWhenCompleteCallback, A._Future__propagateToListeners_handleValueCallback, A._Future__propagateToListeners_handleError, A.Stream_length_closure0, A._PendingEvents_schedule_closure, A._rootHandleError_closure, A._RootZone_bindCallbackGuarded_closure, A.FrameCryptor_decodeFunction_decryptFrameInternal, A.FrameCryptor_decodeFunction_ratchedKeyInternal, A.Logger_Logger_closure]);
+ _inherit(A._StreamImpl, A.Stream);
+ _inherit(A._ControllerStream, A._StreamImpl);
+ _inherit(A._BroadcastStream, A._ControllerStream);
+ _inherit(A._ControllerSubscription, A._BufferingStreamSubscription);
+ _inherit(A._BroadcastSubscription, A._ControllerSubscription);
+ _inherit(A._SyncBroadcastStreamController, A._BroadcastStreamController);
_inherit(A._AsyncCompleter, A._Completer);
+ _inherit(A._DelayedData, A._DelayedEvent);
_inherit(A._RootZone, A._Zone);
_inherit(A._IdentityHashMap, A._HashMap);
_inherit(A.Base64Codec, A.Codec);
- _inherit(A.Converter, A.StreamTransformerBase);
_inheritMany(A.Converter, [A.Base64Encoder, A.Base64Decoder]);
_inheritMany(A.ArgumentError, [A.RangeError, A.IndexError]);
- _inheritMany(A.EventTarget, [A.Node, A.WorkerGlobalScope, A.FileWriter, A.MediaStreamTrack, A.MessagePort, A.SourceBuffer, A._SourceBufferList_EventTarget_ListMixin, A.TextTrack, A.TextTrackCue, A._TextTrackList_EventTarget_ListMixin, A.VideoTrackList, A.AudioTrackList, A.BaseAudioContext]);
- _inheritMany(A.Node, [A.Element, A.CharacterData]);
- _inherit(A.HtmlElement, A.Element);
- _inheritMany(A.HtmlElement, [A.AnchorElement, A.AreaElement, A.FormElement, A.SelectElement, A.TrackElement]);
- _inherit(A.CssPerspective, A.CssTransformComponent);
- _inherit(A.CssStyleDeclaration, A._CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase);
- _inheritMany(A.CssStyleValue, [A.CssTransformValue, A.CssUnparsedValue]);
- _inherit(A.DedicatedWorkerGlobalScope, A.WorkerGlobalScope);
- _inherit(A._DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin, A._DomRectList_JavaScriptObject_ListMixin);
- _inherit(A.DomRectList, A._DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin, A._DomStringList_JavaScriptObject_ListMixin);
- _inherit(A.DomStringList, A._DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.File, A.Blob);
- _inherit(A._FileList_JavaScriptObject_ListMixin_ImmutableListMixin, A._FileList_JavaScriptObject_ListMixin);
- _inherit(A.FileList, A._FileList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin, A._HtmlCollection_JavaScriptObject_ListMixin);
- _inherit(A.HtmlCollection, A._HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.MessageEvent, A.Event);
- _inherit(A.MidiInputMap, A._MidiInputMap_JavaScriptObject_MapMixin);
- _inherit(A.MidiOutputMap, A._MidiOutputMap_JavaScriptObject_MapMixin);
- _inherit(A._MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin, A._MimeTypeArray_JavaScriptObject_ListMixin);
- _inherit(A.MimeTypeArray, A._MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._NodeList_JavaScriptObject_ListMixin_ImmutableListMixin, A._NodeList_JavaScriptObject_ListMixin);
- _inherit(A.NodeList, A._NodeList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin, A._PluginArray_JavaScriptObject_ListMixin);
- _inherit(A.PluginArray, A._PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.RtcStatsReport, A._RtcStatsReport_JavaScriptObject_MapMixin);
- _inherit(A._SourceBufferList_EventTarget_ListMixin_ImmutableListMixin, A._SourceBufferList_EventTarget_ListMixin);
- _inherit(A.SourceBufferList, A._SourceBufferList_EventTarget_ListMixin_ImmutableListMixin);
- _inherit(A._SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin, A._SpeechGrammarList_JavaScriptObject_ListMixin);
- _inherit(A.SpeechGrammarList, A._SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.Storage, A._Storage_JavaScriptObject_MapMixin);
- _inherit(A._TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin, A._TextTrackCueList_JavaScriptObject_ListMixin);
- _inherit(A.TextTrackCueList, A._TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._TextTrackList_EventTarget_ListMixin_ImmutableListMixin, A._TextTrackList_EventTarget_ListMixin);
- _inherit(A.TextTrackList, A._TextTrackList_EventTarget_ListMixin_ImmutableListMixin);
- _inherit(A._TouchList_JavaScriptObject_ListMixin_ImmutableListMixin, A._TouchList_JavaScriptObject_ListMixin);
- _inherit(A.TouchList, A._TouchList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.__CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin, A.__CssRuleList_JavaScriptObject_ListMixin);
- _inherit(A._CssRuleList, A.__CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._DomRect, A.DomRectReadOnly);
- _inherit(A.__GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin, A.__GamepadList_JavaScriptObject_ListMixin);
- _inherit(A._GamepadList, A.__GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.__NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin, A.__NamedNodeMap_JavaScriptObject_ListMixin);
- _inherit(A._NamedNodeMap, A.__NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin, A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin);
- _inherit(A._SpeechRecognitionResultList, A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.__StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin, A.__StyleSheetList_JavaScriptObject_ListMixin);
- _inherit(A._StyleSheetList, A.__StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._EventStream, A.Stream);
- _inherit(A._EventStreamSubscription, A.StreamSubscription);
- _inherit(A._StructuredCloneDart2Js, A._StructuredClone);
- _inherit(A._AcceptStructuredCloneDart2Js, A._AcceptStructuredClone);
- _inherit(A._LengthList_JavaScriptObject_ListMixin_ImmutableListMixin, A._LengthList_JavaScriptObject_ListMixin);
- _inherit(A.LengthList, A._LengthList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._NumberList_JavaScriptObject_ListMixin_ImmutableListMixin, A._NumberList_JavaScriptObject_ListMixin);
- _inherit(A.NumberList, A._NumberList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._StringList_JavaScriptObject_ListMixin_ImmutableListMixin, A._StringList_JavaScriptObject_ListMixin);
- _inherit(A.StringList, A._StringList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A._TransformList_JavaScriptObject_ListMixin_ImmutableListMixin, A._TransformList_JavaScriptObject_ListMixin);
- _inherit(A.TransformList, A._TransformList_JavaScriptObject_ListMixin_ImmutableListMixin);
- _inherit(A.AudioParamMap, A._AudioParamMap_JavaScriptObject_MapMixin);
- _inherit(A.OfflineAudioContext, A.BaseAudioContext);
_inherit(A.CryptorError, A._Enum);
- _mixin(A.UnmodifiableListBase, A.UnmodifiableListMixin);
- _mixin(A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin, A.ListMixin);
+ _mixin(A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin, A.ListBase);
_mixin(A._NativeTypedArrayOfDouble_NativeTypedArray_ListMixin_FixedLengthListMixin, A.FixedLengthListMixin);
- _mixin(A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin, A.ListMixin);
+ _mixin(A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin, A.ListBase);
_mixin(A._NativeTypedArrayOfInt_NativeTypedArray_ListMixin_FixedLengthListMixin, A.FixedLengthListMixin);
- _mixin(A._ListBase_Object_ListMixin, A.ListMixin);
_mixin(A._UnmodifiableMapView_MapView__UnmodifiableMapMixin, A._UnmodifiableMapMixin);
- _mixin(A._CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase, A.CssStyleDeclarationBase);
- _mixin(A._DomRectList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._DomRectList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._DomStringList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._DomStringList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._FileList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._FileList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._HtmlCollection_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._HtmlCollection_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._MidiInputMap_JavaScriptObject_MapMixin, A.MapMixin);
- _mixin(A._MidiOutputMap_JavaScriptObject_MapMixin, A.MapMixin);
- _mixin(A._MimeTypeArray_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._MimeTypeArray_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._NodeList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._NodeList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._PluginArray_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._PluginArray_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._RtcStatsReport_JavaScriptObject_MapMixin, A.MapMixin);
- _mixin(A._SourceBufferList_EventTarget_ListMixin, A.ListMixin);
- _mixin(A._SourceBufferList_EventTarget_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._SpeechGrammarList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._SpeechGrammarList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._Storage_JavaScriptObject_MapMixin, A.MapMixin);
- _mixin(A._TextTrackCueList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._TextTrackCueList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._TextTrackList_EventTarget_ListMixin, A.ListMixin);
- _mixin(A._TextTrackList_EventTarget_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._TouchList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._TouchList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A.__CssRuleList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A.__CssRuleList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A.__GamepadList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A.__GamepadList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A.__NamedNodeMap_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A.__NamedNodeMap_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A.__StyleSheetList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A.__StyleSheetList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._LengthList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._LengthList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._NumberList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._NumberList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._StringList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._StringList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._TransformList_JavaScriptObject_ListMixin, A.ListMixin);
- _mixin(A._TransformList_JavaScriptObject_ListMixin_ImmutableListMixin, A.ImmutableListMixin);
- _mixin(A._AudioParamMap_JavaScriptObject_MapMixin, A.MapMixin);
})();
var init = {
typeUniverse: {eC: new Map(), tR: {}, eT: {}, tPV: {}, sEA: []},
- mangledGlobalNames: {int: "int", double: "double", num: "num", String: "String", bool: "bool", Null: "Null", List: "List"},
+ mangledGlobalNames: {int: "int", double: "double", num: "num", String: "String", bool: "bool", Null: "Null", List: "List", Object: "Object", Map: "Map"},
mangledNames: {},
- types: ["~()", "bool(Cryptor)", "~(String,@)", "Null(@)", "~(@)", "~(~())", "Null()", "Future<~>(RTCEncodedFrame,TransformStreamDefaultController)", "@(@)", "@(@,String)", "@(String)", "Null(~())", "Null(@,StackTrace)", "~(int,@)", "Null(Object,StackTrace)", "_Future<@>(@)", "~(Object?,Object?)", "~(Symbol0,@)", "~(String,String)", "~(Event)", "~(@,@)", "Null(@,@)", "@(@,@)", "Object?(Object?)", "Null(CryptoKey)", "Null(KeySet)", "Null(~)", "~(MessageEvent)", "Future(~)"],
+ types: ["~()", "bool(FrameCryptor)", "Null(@)", "~(@)", "~(~())", "Null()", "~(Object,StackTrace)", "Null(Object,StackTrace)", "Object?(Object?)", "Future<~>(JSObject,JSObject)", "Future<~>()", "Null(JSObject)", "~(String,@)", "@(@)", "@(@,String)", "@(String)", "Null(~())", "Null(@,StackTrace)", "~(int,@)", "~(Object?,Object?)", "~(Symbol0,@)", "~(LogRecord)", "Future(JSObject)", "Logger()"],
interceptorsByTag: null,
leafTags: null,
arrayRti: Symbol("$ti")
};
- A._Universe_addRules(init.typeUniverse, JSON.parse('{"PlainJavaScriptObject":"LegacyJavaScriptObject","UnknownJavaScriptObject":"LegacyJavaScriptObject","JavaScriptFunction":"LegacyJavaScriptObject","WritableStream":"LegacyJavaScriptObject","ReadableStream":"LegacyJavaScriptObject","TransformStreamDefaultController":"LegacyJavaScriptObject","RTCEncodedFrame":"LegacyJavaScriptObject","TransformStream":"LegacyJavaScriptObject","EncodedStreams":"LegacyJavaScriptObject","RTCEncodedAudioFrame":"LegacyJavaScriptObject","RTCEncodedVideoFrame":"LegacyJavaScriptObject","RTCEncodedFrameMetadata":"LegacyJavaScriptObject","RTCEncodedAudioFrameMetadata":"LegacyJavaScriptObject","RTCEncodedVideoFrameMetadata":"LegacyJavaScriptObject","RTCTransformEvent":"LegacyJavaScriptObject","RTCRtpScriptTransformer":"LegacyJavaScriptObject","RTCRtpScriptTransform":"LegacyJavaScriptObject","Promise":"LegacyJavaScriptObject","Algorithm":"LegacyJavaScriptObject","AesGcmParams":"LegacyJavaScriptObject","TransformMessage":"LegacyJavaScriptObject","EnableTransformMessage":"LegacyJavaScriptObject","RemoveTransformMessage":"LegacyJavaScriptObject","KeyframeEffect":"JavaScriptObject","KeyframeEffectReadOnly":"JavaScriptObject","AnimationEffectReadOnly":"JavaScriptObject","AbortPaymentEvent":"Event","ExtendableEvent":"Event","AudioContext":"BaseAudioContext","AbsoluteOrientationSensor":"EventTarget","OrientationSensor":"EventTarget","Sensor":"EventTarget","MathMLElement":"Element","AudioElement":"HtmlElement","MediaElement":"HtmlElement","HtmlDocument":"Node","Document":"Node","VttCue":"TextTrackCue","ServiceWorkerGlobalScope":"WorkerGlobalScope","CDataSection":"CharacterData","Text":"CharacterData","HtmlFormControlsCollection":"HtmlCollection","CssCharsetRule":"CssRule","CssMatrixComponent":"CssTransformComponent","CssStyleSheet":"StyleSheet","CssurlImageValue":"CssStyleValue","CssImageValue":"CssStyleValue","CssResourceValue":"CssStyleValue","CanvasCaptureMediaStreamTrack":"MediaStreamTrack","NativeFloat32List":"NativeTypedArrayOfDouble","JSBool":{"bool":[]},"JSNull":{"Null":[]},"LegacyJavaScriptObject":{"JavaScriptObject":[],"JSObject":[],"WritableStream":[],"ReadableStream":[],"TransformStreamDefaultController":[],"RTCEncodedFrame":[],"RTCTransformEvent":[],"Algorithm":[]},"JSArray":{"List":["1"],"EfficientLengthIterable":["1"],"Iterable":["1"],"JSIndexable":["1"]},"JSUnmodifiableArray":{"JSArray":["1"],"List":["1"],"EfficientLengthIterable":["1"],"Iterable":["1"],"JSIndexable":["1"]},"ArrayIterator":{"Iterator":["1"]},"JSNumber":{"double":[],"num":[]},"JSInt":{"double":[],"int":[],"num":[]},"JSNumNotInt":{"double":[],"num":[]},"JSString":{"String":[],"JSIndexable":["@"]},"LateError":{"Error":[]},"CodeUnits":{"ListMixin":["int"],"UnmodifiableListMixin":["int"],"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"],"ListMixin.E":"int","UnmodifiableListMixin.E":"int"},"EfficientLengthIterable":{"Iterable":["1"]},"ListIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"]},"SubListIterable":{"ListIterable":["1"],"EfficientLengthIterable":["1"],"Iterable":["1"],"Iterable.E":"1","ListIterable.E":"1"},"ListIterator":{"Iterator":["1"]},"MappedIterable":{"Iterable":["2"],"Iterable.E":"2"},"EfficientLengthMappedIterable":{"MappedIterable":["1","2"],"EfficientLengthIterable":["2"],"Iterable":["2"],"Iterable.E":"2"},"MappedIterator":{"Iterator":["2"]},"MappedListIterable":{"ListIterable":["2"],"EfficientLengthIterable":["2"],"Iterable":["2"],"Iterable.E":"2","ListIterable.E":"2"},"WhereIterable":{"Iterable":["1"],"Iterable.E":"1"},"WhereIterator":{"Iterator":["1"]},"UnmodifiableListBase":{"ListMixin":["1"],"UnmodifiableListMixin":["1"],"List":["1"],"EfficientLengthIterable":["1"],"Iterable":["1"]},"Symbol":{"Symbol0":[]},"ConstantMapView":{"UnmodifiableMapView":["1","2"],"_UnmodifiableMapView_MapView__UnmodifiableMapMixin":["1","2"],"MapView":["1","2"],"_UnmodifiableMapMixin":["1","2"],"Map":["1","2"]},"ConstantMap":{"Map":["1","2"]},"ConstantStringMap":{"ConstantMap":["1","2"],"Map":["1","2"]},"_ConstantMapKeyIterable":{"Iterable":["1"],"Iterable.E":"1"},"JSInvocationMirror":{"Invocation":[]},"NullError":{"TypeError":[],"Error":[]},"JsNoSuchMethodError":{"Error":[]},"UnknownJsTypeError":{"Error":[]},"_StackTrace":{"StackTrace":[]},"Closure":{"Function":[]},"Closure0Args":{"Function":[]},"Closure2Args":{"Function":[]},"TearOffClosure":{"Function":[]},"StaticClosure":{"Function":[]},"BoundClosure":{"Function":[]},"RuntimeError":{"Error":[]},"_AssertionError":{"Error":[]},"JsLinkedHashMap":{"MapMixin":["1","2"],"LinkedHashMap":["1","2"],"Map":["1","2"],"MapMixin.K":"1","MapMixin.V":"2"},"LinkedHashMapKeyIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"],"Iterable.E":"1"},"LinkedHashMapKeyIterator":{"Iterator":["1"]},"NativeByteBuffer":{"ByteBuffer":[]},"NativeByteData":{"NativeTypedData":[],"ByteData":[]},"NativeTypedArray":{"JavaScriptIndexingBehavior":["1"],"NativeTypedData":[],"JSIndexable":["1"]},"NativeTypedArrayOfDouble":{"NativeTypedArray":["double"],"ListMixin":["double"],"JavaScriptIndexingBehavior":["double"],"List":["double"],"NativeTypedData":[],"EfficientLengthIterable":["double"],"JSIndexable":["double"],"Iterable":["double"],"FixedLengthListMixin":["double"],"ListMixin.E":"double"},"NativeTypedArrayOfInt":{"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"]},"NativeInt16List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeInt32List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeInt8List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeUint16List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeUint32List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeUint8ClampedList":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"NativeUint8List":{"NativeTypedArrayOfInt":[],"NativeTypedArray":["int"],"ListMixin":["int"],"Uint8List":[],"JavaScriptIndexingBehavior":["int"],"List":["int"],"NativeTypedData":[],"EfficientLengthIterable":["int"],"JSIndexable":["int"],"Iterable":["int"],"FixedLengthListMixin":["int"],"ListMixin.E":"int"},"_Error":{"Error":[]},"_TypeError":{"TypeError":[],"Error":[]},"_Future":{"Future":["1"]},"_AsyncAwaitCompleter":{"Completer":["1"]},"AsyncError":{"Error":[]},"_Completer":{"Completer":["1"]},"_AsyncCompleter":{"_Completer":["1"],"Completer":["1"]},"_Zone":{"Zone":[]},"_RootZone":{"_Zone":[],"Zone":[]},"_HashMap":{"MapMixin":["1","2"],"Map":["1","2"]},"_IdentityHashMap":{"_HashMap":["1","2"],"MapMixin":["1","2"],"Map":["1","2"],"MapMixin.K":"1","MapMixin.V":"2"},"_HashMapKeyIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"],"Iterable.E":"1"},"_HashMapKeyIterator":{"Iterator":["1"]},"ListBase":{"ListMixin":["1"],"List":["1"],"EfficientLengthIterable":["1"],"Iterable":["1"]},"MapBase":{"MapMixin":["1","2"],"Map":["1","2"]},"MapMixin":{"Map":["1","2"]},"MapView":{"Map":["1","2"]},"UnmodifiableMapView":{"_UnmodifiableMapView_MapView__UnmodifiableMapMixin":["1","2"],"MapView":["1","2"],"_UnmodifiableMapMixin":["1","2"],"Map":["1","2"]},"Base64Codec":{"Codec":["List","String"],"Codec.S":"List"},"double":{"num":[]},"int":{"num":[]},"List":{"EfficientLengthIterable":["1"],"Iterable":["1"]},"AssertionError":{"Error":[]},"TypeError":{"Error":[]},"NullThrownError":{"TypeError":[],"Error":[]},"ArgumentError":{"Error":[]},"RangeError":{"Error":[]},"IndexError":{"Error":[]},"NoSuchMethodError":{"Error":[]},"UnsupportedError":{"Error":[]},"UnimplementedError":{"Error":[]},"StateError":{"Error":[]},"ConcurrentModificationError":{"Error":[]},"OutOfMemoryError":{"Error":[]},"StackOverflowError":{"Error":[]},"CyclicInitializationError":{"Error":[]},"_StringStackTrace":{"StackTrace":[]},"CryptoKey":{"JavaScriptObject":[]},"CssRule":{"JavaScriptObject":[]},"Event":{"JavaScriptObject":[]},"File":{"Blob":[],"JavaScriptObject":[]},"Gamepad":{"JavaScriptObject":[]},"MessageEvent":{"Event":[],"JavaScriptObject":[]},"MimeType":{"JavaScriptObject":[]},"Node":{"EventTarget":[],"JavaScriptObject":[]},"Plugin":{"JavaScriptObject":[]},"SourceBuffer":{"EventTarget":[],"JavaScriptObject":[]},"SpeechGrammar":{"JavaScriptObject":[]},"SpeechRecognitionResult":{"JavaScriptObject":[]},"StyleSheet":{"JavaScriptObject":[]},"TextTrack":{"EventTarget":[],"JavaScriptObject":[]},"TextTrackCue":{"EventTarget":[],"JavaScriptObject":[]},"Touch":{"JavaScriptObject":[]},"HtmlElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"AccessibleNodeList":{"JavaScriptObject":[]},"AnchorElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"AreaElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"Blob":{"JavaScriptObject":[]},"CharacterData":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"CssPerspective":{"JavaScriptObject":[]},"CssStyleDeclaration":{"JavaScriptObject":[]},"CssStyleValue":{"JavaScriptObject":[]},"CssTransformComponent":{"JavaScriptObject":[]},"CssTransformValue":{"JavaScriptObject":[]},"CssUnparsedValue":{"JavaScriptObject":[]},"DataTransferItem":{"JavaScriptObject":[]},"DataTransferItemList":{"JavaScriptObject":[]},"DedicatedWorkerGlobalScope":{"EventTarget":[],"JavaScriptObject":[]},"DomException":{"JavaScriptObject":[]},"DomRectList":{"ListMixin":["Rectangle"],"ImmutableListMixin":["Rectangle"],"List":["Rectangle"],"JavaScriptIndexingBehavior":["Rectangle"],"JavaScriptObject":[],"EfficientLengthIterable":["Rectangle"],"Iterable":["Rectangle"],"JSIndexable":["Rectangle"],"ImmutableListMixin.E":"Rectangle","ListMixin.E":"Rectangle"},"DomRectReadOnly":{"JavaScriptObject":[],"Rectangle":["num"]},"DomStringList":{"ListMixin":["String"],"ImmutableListMixin":["String"],"List":["String"],"JavaScriptIndexingBehavior":["String"],"JavaScriptObject":[],"EfficientLengthIterable":["String"],"Iterable":["String"],"JSIndexable":["String"],"ImmutableListMixin.E":"String","ListMixin.E":"String"},"DomTokenList":{"JavaScriptObject":[]},"Element":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"EventTarget":{"JavaScriptObject":[]},"FileList":{"ListMixin":["File"],"ImmutableListMixin":["File"],"List":["File"],"JavaScriptIndexingBehavior":["File"],"JavaScriptObject":[],"EfficientLengthIterable":["File"],"Iterable":["File"],"JSIndexable":["File"],"ImmutableListMixin.E":"File","ListMixin.E":"File"},"FileWriter":{"EventTarget":[],"JavaScriptObject":[]},"FormElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"History":{"JavaScriptObject":[]},"HtmlCollection":{"ListMixin":["Node"],"ImmutableListMixin":["Node"],"List":["Node"],"JavaScriptIndexingBehavior":["Node"],"JavaScriptObject":[],"EfficientLengthIterable":["Node"],"Iterable":["Node"],"JSIndexable":["Node"],"ImmutableListMixin.E":"Node","ListMixin.E":"Node"},"ImageData":{"JavaScriptObject":[]},"Location":{"JavaScriptObject":[]},"MediaDeviceInfo":{"JavaScriptObject":[]},"MediaList":{"JavaScriptObject":[]},"MediaStreamTrack":{"EventTarget":[],"JavaScriptObject":[]},"MessagePort":{"EventTarget":[],"JavaScriptObject":[]},"MidiInputMap":{"JavaScriptObject":[],"MapMixin":["String","@"],"Map":["String","@"],"MapMixin.K":"String","MapMixin.V":"@"},"MidiOutputMap":{"JavaScriptObject":[],"MapMixin":["String","@"],"Map":["String","@"],"MapMixin.K":"String","MapMixin.V":"@"},"MimeTypeArray":{"ListMixin":["MimeType"],"ImmutableListMixin":["MimeType"],"List":["MimeType"],"JavaScriptIndexingBehavior":["MimeType"],"JavaScriptObject":[],"EfficientLengthIterable":["MimeType"],"Iterable":["MimeType"],"JSIndexable":["MimeType"],"ImmutableListMixin.E":"MimeType","ListMixin.E":"MimeType"},"NodeList":{"ListMixin":["Node"],"ImmutableListMixin":["Node"],"List":["Node"],"JavaScriptIndexingBehavior":["Node"],"JavaScriptObject":[],"EfficientLengthIterable":["Node"],"Iterable":["Node"],"JSIndexable":["Node"],"ImmutableListMixin.E":"Node","ListMixin.E":"Node"},"PluginArray":{"ListMixin":["Plugin"],"ImmutableListMixin":["Plugin"],"List":["Plugin"],"JavaScriptIndexingBehavior":["Plugin"],"JavaScriptObject":[],"EfficientLengthIterable":["Plugin"],"Iterable":["Plugin"],"JSIndexable":["Plugin"],"ImmutableListMixin.E":"Plugin","ListMixin.E":"Plugin"},"RtcStatsReport":{"JavaScriptObject":[],"MapMixin":["String","@"],"Map":["String","@"],"MapMixin.K":"String","MapMixin.V":"@"},"SelectElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"SharedArrayBuffer":{"JavaScriptObject":[]},"SourceBufferList":{"ListMixin":["SourceBuffer"],"ImmutableListMixin":["SourceBuffer"],"EventTarget":[],"List":["SourceBuffer"],"JavaScriptIndexingBehavior":["SourceBuffer"],"JavaScriptObject":[],"EfficientLengthIterable":["SourceBuffer"],"Iterable":["SourceBuffer"],"JSIndexable":["SourceBuffer"],"ImmutableListMixin.E":"SourceBuffer","ListMixin.E":"SourceBuffer"},"SpeechGrammarList":{"ListMixin":["SpeechGrammar"],"ImmutableListMixin":["SpeechGrammar"],"List":["SpeechGrammar"],"JavaScriptIndexingBehavior":["SpeechGrammar"],"JavaScriptObject":[],"EfficientLengthIterable":["SpeechGrammar"],"Iterable":["SpeechGrammar"],"JSIndexable":["SpeechGrammar"],"ImmutableListMixin.E":"SpeechGrammar","ListMixin.E":"SpeechGrammar"},"Storage":{"JavaScriptObject":[],"MapMixin":["String","String"],"Map":["String","String"],"MapMixin.K":"String","MapMixin.V":"String"},"TextTrackCueList":{"ListMixin":["TextTrackCue"],"ImmutableListMixin":["TextTrackCue"],"List":["TextTrackCue"],"JavaScriptIndexingBehavior":["TextTrackCue"],"JavaScriptObject":[],"EfficientLengthIterable":["TextTrackCue"],"Iterable":["TextTrackCue"],"JSIndexable":["TextTrackCue"],"ImmutableListMixin.E":"TextTrackCue","ListMixin.E":"TextTrackCue"},"TextTrackList":{"ListMixin":["TextTrack"],"ImmutableListMixin":["TextTrack"],"EventTarget":[],"List":["TextTrack"],"JavaScriptIndexingBehavior":["TextTrack"],"JavaScriptObject":[],"EfficientLengthIterable":["TextTrack"],"Iterable":["TextTrack"],"JSIndexable":["TextTrack"],"ImmutableListMixin.E":"TextTrack","ListMixin.E":"TextTrack"},"TimeRanges":{"JavaScriptObject":[]},"TouchList":{"ListMixin":["Touch"],"ImmutableListMixin":["Touch"],"List":["Touch"],"JavaScriptIndexingBehavior":["Touch"],"JavaScriptObject":[],"EfficientLengthIterable":["Touch"],"Iterable":["Touch"],"JSIndexable":["Touch"],"ImmutableListMixin.E":"Touch","ListMixin.E":"Touch"},"TrackDefaultList":{"JavaScriptObject":[]},"TrackElement":{"Node":[],"EventTarget":[],"JavaScriptObject":[]},"Url":{"JavaScriptObject":[]},"VideoTrack":{"JavaScriptObject":[]},"VideoTrackList":{"EventTarget":[],"JavaScriptObject":[]},"WorkerGlobalScope":{"EventTarget":[],"JavaScriptObject":[]},"_CssRuleList":{"ListMixin":["CssRule"],"ImmutableListMixin":["CssRule"],"List":["CssRule"],"JavaScriptIndexingBehavior":["CssRule"],"JavaScriptObject":[],"EfficientLengthIterable":["CssRule"],"Iterable":["CssRule"],"JSIndexable":["CssRule"],"ImmutableListMixin.E":"CssRule","ListMixin.E":"CssRule"},"_DomRect":{"JavaScriptObject":[],"Rectangle":["num"]},"_GamepadList":{"ListMixin":["Gamepad?"],"ImmutableListMixin":["Gamepad?"],"List":["Gamepad?"],"JavaScriptIndexingBehavior":["Gamepad?"],"JavaScriptObject":[],"EfficientLengthIterable":["Gamepad?"],"Iterable":["Gamepad?"],"JSIndexable":["Gamepad?"],"ImmutableListMixin.E":"Gamepad?","ListMixin.E":"Gamepad?"},"_NamedNodeMap":{"ListMixin":["Node"],"ImmutableListMixin":["Node"],"List":["Node"],"JavaScriptIndexingBehavior":["Node"],"JavaScriptObject":[],"EfficientLengthIterable":["Node"],"Iterable":["Node"],"JSIndexable":["Node"],"ImmutableListMixin.E":"Node","ListMixin.E":"Node"},"_SpeechRecognitionResultList":{"ListMixin":["SpeechRecognitionResult"],"ImmutableListMixin":["SpeechRecognitionResult"],"List":["SpeechRecognitionResult"],"JavaScriptIndexingBehavior":["SpeechRecognitionResult"],"JavaScriptObject":[],"EfficientLengthIterable":["SpeechRecognitionResult"],"Iterable":["SpeechRecognitionResult"],"JSIndexable":["SpeechRecognitionResult"],"ImmutableListMixin.E":"SpeechRecognitionResult","ListMixin.E":"SpeechRecognitionResult"},"_StyleSheetList":{"ListMixin":["StyleSheet"],"ImmutableListMixin":["StyleSheet"],"List":["StyleSheet"],"JavaScriptIndexingBehavior":["StyleSheet"],"JavaScriptObject":[],"EfficientLengthIterable":["StyleSheet"],"Iterable":["StyleSheet"],"JSIndexable":["StyleSheet"],"ImmutableListMixin.E":"StyleSheet","ListMixin.E":"StyleSheet"},"_EventStream":{"Stream":["1"]},"_EventStreamSubscription":{"StreamSubscription":["1"]},"FixedSizeListIterator":{"Iterator":["1"]},"Length":{"JavaScriptObject":[]},"Number":{"JavaScriptObject":[]},"Transform":{"JavaScriptObject":[]},"LengthList":{"ListMixin":["Length"],"ImmutableListMixin":["Length"],"List":["Length"],"JavaScriptObject":[],"EfficientLengthIterable":["Length"],"Iterable":["Length"],"ImmutableListMixin.E":"Length","ListMixin.E":"Length"},"NumberList":{"ListMixin":["Number"],"ImmutableListMixin":["Number"],"List":["Number"],"JavaScriptObject":[],"EfficientLengthIterable":["Number"],"Iterable":["Number"],"ImmutableListMixin.E":"Number","ListMixin.E":"Number"},"PointList":{"JavaScriptObject":[]},"StringList":{"ListMixin":["String"],"ImmutableListMixin":["String"],"List":["String"],"JavaScriptObject":[],"EfficientLengthIterable":["String"],"Iterable":["String"],"ImmutableListMixin.E":"String","ListMixin.E":"String"},"TransformList":{"ListMixin":["Transform"],"ImmutableListMixin":["Transform"],"List":["Transform"],"JavaScriptObject":[],"EfficientLengthIterable":["Transform"],"Iterable":["Transform"],"ImmutableListMixin.E":"Transform","ListMixin.E":"Transform"},"AudioBuffer":{"JavaScriptObject":[]},"AudioParamMap":{"JavaScriptObject":[],"MapMixin":["String","@"],"Map":["String","@"],"MapMixin.K":"String","MapMixin.V":"@"},"AudioTrack":{"JavaScriptObject":[]},"AudioTrackList":{"EventTarget":[],"JavaScriptObject":[]},"BaseAudioContext":{"EventTarget":[],"JavaScriptObject":[]},"OfflineAudioContext":{"EventTarget":[],"JavaScriptObject":[]},"Uint8List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]}}'));
- A._Universe_addErasedTypes(init.typeUniverse, JSON.parse('{"EfficientLengthIterable":1,"UnmodifiableListBase":1,"NativeTypedArray":1,"StreamTransformerBase":2,"ListBase":1,"MapBase":2,"_ListBase_Object_ListMixin":1,"Converter":2,"Promise":1}'));
+ A._Universe_addRules(init.typeUniverse, JSON.parse('{"JavaScriptFunction":"LegacyJavaScriptObject","PlainJavaScriptObject":"LegacyJavaScriptObject","UnknownJavaScriptObject":"LegacyJavaScriptObject","JSBool":{"bool":[],"TrustedGetRuntimeType":[]},"JSNull":{"Null":[],"TrustedGetRuntimeType":[]},"JavaScriptObject":{"JSObject":[]},"LegacyJavaScriptObject":{"JSObject":[]},"JSArray":{"List":["1"],"EfficientLengthIterable":["1"],"JSObject":[],"Iterable":["1"]},"JSUnmodifiableArray":{"JSArray":["1"],"List":["1"],"EfficientLengthIterable":["1"],"JSObject":[],"Iterable":["1"]},"ArrayIterator":{"Iterator":["1"]},"JSNumber":{"double":[],"num":[]},"JSInt":{"double":[],"int":[],"num":[],"TrustedGetRuntimeType":[]},"JSNumNotInt":{"double":[],"num":[],"TrustedGetRuntimeType":[]},"JSString":{"String":[],"Pattern":[],"TrustedGetRuntimeType":[]},"_CopyingBytesBuilder":{"BytesBuilder":[]},"LateError":{"Error":[]},"EfficientLengthIterable":{"Iterable":["1"]},"ListIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"]},"ListIterator":{"Iterator":["1"]},"MappedIterable":{"Iterable":["2"],"Iterable.E":"2"},"EfficientLengthMappedIterable":{"MappedIterable":["1","2"],"EfficientLengthIterable":["2"],"Iterable":["2"],"Iterable.E":"2"},"MappedIterator":{"Iterator":["2"]},"MappedListIterable":{"ListIterable":["2"],"EfficientLengthIterable":["2"],"Iterable":["2"],"Iterable.E":"2","ListIterable.E":"2"},"WhereIterable":{"Iterable":["1"],"Iterable.E":"1"},"WhereIterator":{"Iterator":["1"]},"Symbol":{"Symbol0":[]},"ConstantMapView":{"UnmodifiableMapView":["1","2"],"_UnmodifiableMapView_MapView__UnmodifiableMapMixin":["1","2"],"MapView":["1","2"],"_UnmodifiableMapMixin":["1","2"],"Map":["1","2"]},"ConstantMap":{"Map":["1","2"]},"ConstantStringMap":{"ConstantMap":["1","2"],"Map":["1","2"]},"_KeysOrValues":{"Iterable":["1"],"Iterable.E":"1"},"_KeysOrValuesOrElementsIterator":{"Iterator":["1"]},"JSInvocationMirror":{"Invocation":[]},"NullError":{"TypeError":[],"Error":[]},"JsNoSuchMethodError":{"Error":[]},"UnknownJsTypeError":{"Error":[]},"_StackTrace":{"StackTrace":[]},"Closure":{"Function":[]},"Closure0Args":{"Function":[]},"Closure2Args":{"Function":[]},"TearOffClosure":{"Function":[]},"StaticClosure":{"Function":[]},"BoundClosure":{"Function":[]},"_CyclicInitializationError":{"Error":[]},"RuntimeError":{"Error":[]},"_AssertionError":{"Error":[]},"JsLinkedHashMap":{"MapBase":["1","2"],"LinkedHashMap":["1","2"],"Map":["1","2"]},"LinkedHashMapKeysIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"],"Iterable.E":"1"},"LinkedHashMapKeyIterator":{"Iterator":["1"]},"NativeByteBuffer":{"JSObject":[],"ByteBuffer":[],"TrustedGetRuntimeType":[]},"NativeTypedData":{"JSObject":[]},"_UnmodifiableNativeByteBufferView":{"ByteBuffer":[]},"NativeByteData":{"ByteData":[],"JSObject":[],"TrustedGetRuntimeType":[]},"NativeTypedArray":{"JavaScriptIndexingBehavior":["1"],"JSObject":[]},"NativeTypedArrayOfDouble":{"ListBase":["double"],"NativeTypedArray":["double"],"List":["double"],"JavaScriptIndexingBehavior":["double"],"EfficientLengthIterable":["double"],"JSObject":[],"Iterable":["double"],"FixedLengthListMixin":["double"]},"NativeTypedArrayOfInt":{"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"]},"NativeFloat32List":{"Float32List":[],"ListBase":["double"],"NativeTypedArray":["double"],"List":["double"],"JavaScriptIndexingBehavior":["double"],"EfficientLengthIterable":["double"],"JSObject":[],"Iterable":["double"],"FixedLengthListMixin":["double"],"TrustedGetRuntimeType":[],"ListBase.E":"double"},"NativeFloat64List":{"Float64List":[],"ListBase":["double"],"NativeTypedArray":["double"],"List":["double"],"JavaScriptIndexingBehavior":["double"],"EfficientLengthIterable":["double"],"JSObject":[],"Iterable":["double"],"FixedLengthListMixin":["double"],"TrustedGetRuntimeType":[],"ListBase.E":"double"},"NativeInt16List":{"Int16List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeInt32List":{"Int32List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeInt8List":{"Int8List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeUint16List":{"Uint16List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeUint32List":{"Uint32List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeUint8ClampedList":{"Uint8ClampedList":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"NativeUint8List":{"Uint8List":[],"ListBase":["int"],"NativeTypedArray":["int"],"List":["int"],"JavaScriptIndexingBehavior":["int"],"EfficientLengthIterable":["int"],"JSObject":[],"Iterable":["int"],"FixedLengthListMixin":["int"],"TrustedGetRuntimeType":[],"ListBase.E":"int"},"_Error":{"Error":[]},"_TypeError":{"TypeError":[],"Error":[]},"_BufferingStreamSubscription":{"StreamSubscription":["1"],"_EventDispatch":["1"]},"AsyncError":{"Error":[]},"_BroadcastStream":{"_ControllerStream":["1"],"_StreamImpl":["1"],"Stream":["1"]},"_BroadcastSubscription":{"_ControllerSubscription":["1"],"_BufferingStreamSubscription":["1"],"StreamSubscription":["1"],"_EventDispatch":["1"]},"_BroadcastStreamController":{"StreamController":["1"],"_StreamControllerLifecycle":["1"],"_EventDispatch":["1"]},"_SyncBroadcastStreamController":{"_BroadcastStreamController":["1"],"StreamController":["1"],"_StreamControllerLifecycle":["1"],"_EventDispatch":["1"]},"_AsyncCompleter":{"_Completer":["1"]},"_Future":{"Future":["1"]},"_ControllerStream":{"_StreamImpl":["1"],"Stream":["1"]},"_ControllerSubscription":{"_BufferingStreamSubscription":["1"],"StreamSubscription":["1"],"_EventDispatch":["1"]},"_StreamImpl":{"Stream":["1"]},"_DelayedData":{"_DelayedEvent":["1"]},"_DoneStreamSubscription":{"StreamSubscription":["1"]},"_Zone":{"Zone":[]},"_RootZone":{"_Zone":[],"Zone":[]},"_HashMap":{"MapBase":["1","2"],"Map":["1","2"]},"_IdentityHashMap":{"_HashMap":["1","2"],"MapBase":["1","2"],"Map":["1","2"]},"_HashMapKeyIterable":{"EfficientLengthIterable":["1"],"Iterable":["1"],"Iterable.E":"1"},"_HashMapKeyIterator":{"Iterator":["1"]},"MapBase":{"Map":["1","2"]},"MapView":{"Map":["1","2"]},"UnmodifiableMapView":{"_UnmodifiableMapView_MapView__UnmodifiableMapMixin":["1","2"],"MapView":["1","2"],"_UnmodifiableMapMixin":["1","2"],"Map":["1","2"]},"Base64Codec":{"Codec":["List","String"],"Codec.S":"List"},"double":{"num":[]},"int":{"num":[]},"List":{"EfficientLengthIterable":["1"],"Iterable":["1"]},"String":{"Pattern":[]},"AssertionError":{"Error":[]},"TypeError":{"Error":[]},"ArgumentError":{"Error":[]},"RangeError":{"Error":[]},"IndexError":{"Error":[]},"NoSuchMethodError":{"Error":[]},"UnsupportedError":{"Error":[]},"UnimplementedError":{"Error":[]},"StateError":{"Error":[]},"ConcurrentModificationError":{"Error":[]},"OutOfMemoryError":{"Error":[]},"StackOverflowError":{"Error":[]},"_StringStackTrace":{"StackTrace":[]},"Int8List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Uint8List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Uint8ClampedList":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Int16List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Uint16List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Int32List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Uint32List":{"List":["int"],"EfficientLengthIterable":["int"],"Iterable":["int"]},"Float32List":{"List":["double"],"EfficientLengthIterable":["double"],"Iterable":["double"]},"Float64List":{"List":["double"],"EfficientLengthIterable":["double"],"Iterable":["double"]}}'));
+ A._Universe_addErasedTypes(init.typeUniverse, JSON.parse('{"EfficientLengthIterable":1,"NativeTypedArray":1,"_DelayedEvent":1,"Converter":2}'));
var string$ = {
- Error_: "Error handler must accept one Object or one Object and a StackTrace as arguments, and return a value of the returned future's type"
+ Cannot: "Cannot fire new event. Controller is already firing an event",
+ Error_: "Error handler must accept one Object or one Object and a StackTrace as arguments, and return a value of the returned future's type",
+ ___las: "]: lastError != CryptorError.kOk, reset state to kNew",
+ decode: "decodeFunction::decryptFrameInternal: decrypted: "
};
var type$ = (function rtii() {
var findType = A.findType;
return {
- Algorithm: findType("Algorithm"),
+ $env_1_1_void: findType("@<~>"),
AsyncError: findType("AsyncError"),
Base64Codec: findType("Base64Codec"),
- Blob: findType("Blob"),
ByteBuffer: findType("ByteBuffer"),
+ ByteData: findType("ByteData"),
ConstantMapView_Symbol_dynamic: findType("ConstantMapView"),
- CryptoKey: findType("CryptoKey"),
- Cryptor: findType("Cryptor"),
- CssRule: findType("CssRule"),
EfficientLengthIterable_dynamic: findType("EfficientLengthIterable<@>"),
Error: findType("Error"),
- Event: findType("Event"),
- File: findType("File"),
- FileList: findType("FileList"),
+ Float32List: findType("Float32List"),
+ Float64List: findType("Float64List"),
+ FrameCryptor: findType("FrameCryptor"),
Function: findType("Function"),
- FutureOr_CryptoKey: findType("CryptoKey/"),
Future_dynamic: findType("Future<@>"),
- Future_void_Function_RTCEncodedFrame_TransformStreamDefaultController: findType("Future<~>(RTCEncodedFrame,TransformStreamDefaultController)"),
- ImageData: findType("ImageData"),
+ Future_void_Function_JSObject_JSObject: findType("Future<~>(JSObject,JSObject)"),
+ Int16List: findType("Int16List"),
+ Int32List: findType("Int32List"),
+ Int8List: findType("Int8List"),
Invocation: findType("Invocation"),
Iterable_dynamic: findType("Iterable<@>"),
Iterable_int: findType("Iterable"),
+ Iterable_nullable_Object: findType("Iterable