diff --git a/OAT.xml b/OAT.xml index 8d705bcbd7dd9331a487cd3a0ec36d94e4290635..6c97f87cc99d3191bec3ea358eb97e1856f8ce62 100644 --- a/OAT.xml +++ b/OAT.xml @@ -59,6 +59,22 @@ name="Hunan OpenValley Digital Industry Development Co., Ltd." path=".*" rule="may" + type="copyright"/> + + - - + + @@ -240,6 +256,7 @@ + @@ -285,14 +302,31 @@ + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index afd2f437b29c1187617ad2329826a5283f218041..def2ce2e63bd893825441fb587ad6f818542953b 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,236 @@ ## OpenHarmony平台已兼容库 -| 仓库名 | 依赖路径 | 类型 | -| ----- | --------------------------------------------- | ----- | -| pigeon | packages/pigeons | 工具库 | -| file_selector | packages/file_selector/file_selector | 插件 | -| image_picker | packages/image_picker/image_picker | 插件 | -| animations | packages/animations | 新增示例 | -| url_launcher | packages/url_launcher/url_launcher | 插件 | -| shared_preferences | packages/shared_preferences/shared_preferences | 插件 | -| path_provuder | packages/path_provuder/path_provuder | 插件 | -| local_auth | packages/local_auth/local_auth | 插件 | - +| 序号 | 原库名 | 原库基线版本 | 仓库名 | 状态 | +| -------- | ---- | ---- | ---- | -------- | +| 1 | [pigeon](https://pub.dev/packages/pigeon) | 14.0.0 | [pigeon](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/pigeon) | 已适配 | +| 2 | [file_selector](https://pub.dev/packages/file_selector) | 1.0.1 | [file_selector](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/file_selector) | 已适配 | +| 3 | [image_picker](https://pub.dev/packages/image_picker) | 1.0.4 | [image_picker](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/image_picker) | 已适配 | +| 4 | [animations](https://pub.dev/packages/animations) | 2.0.8 | [animations](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/animations) | 已适配 | +| 5 | [url_launcher](https://pub.dev/packages/url_launcher) | 6.1.11 | [url_launcher](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/url_launcher) | 已适配 | +| 6 | [shared_preferences](https://pub.dev/packages/shared_preferences) | 2.2.2 | [shared_preferences](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/shared_preferences) | 已适配 | +| 7 | [path_provider](https://pub.dev/packages/path_provider) | 2.1.1 | [path_provider](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/path_provider) | 已适配 | +| 8 | [local_auth](https://pub.dev/packages/local_auth) | 2.1.6 | [local_auth](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/local_auth) | 已适配 | +| 9 | [sqflite](https://pub.dev/packages/sqflite) | 2.2.8+4 | [flutter_sqflite](https://gitee.com/openharmony-sig/flutter_sqflite) | 已适配 | +| 10 | [permission_handler](https://pub.dev/packages/permission_handler) | 11.3.1 | [flutter_permission_handler](https://gitee.com/openharmony-sig/flutter_permission_handler) | 已适配 | +| 11 | [fluttertoast](https://pub.dev/packages/fluttertoast) | 8.2.8 | [flutter_fluttertoast](https://gitee.com/openharmony-sig/flutter_fluttertoast) | 已适配 | +| 12 | [camera](https://pub.dev/packages/camera) | 0.10.5+5 | [camera](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/camera) | 已适配 | +| 13 | [video_player](https://pub.dev/packages/video_player) | 2.7.2 | [video_player](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/video_player) | 已适配 | +| 14 | [webview_flutter](https://pub.dev/packages/webview_flutter) | 4.4.2 | [webview_flutter](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/webview_flutter) | 已适配 | +| 15 | [webview_flutter-v4.4.4](https://pub.dev/packages/webview_flutter) | 4.4.4 | [webview_flutter-v4.4.4](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/webview_flutter-v4.4.4) | 已适配 | +| 16 | [connectivity_plus](https://pub.dev/packages/connectivity_plus) | 5.0.2 | [connectivity_plus](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/connectivity_plus) | 已适配 | +| 17 | [device_info_plus](https://pub.dev/packages/device_info_plus) | 9.1.2 | [device_info_plus](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/device_info_plus) | 已适配 | +| 18 | [package_info_plus](https://pub.dev/packages/package_info_plus) | 4.2.0 | [package_info_plus](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/package_info_plus) | 已适配 | +| 19 | [connectivity](https://pub.dev/packages/connectivity) | 3.0.6 | [connectivity](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/connectivity) | 已适配 | +| 20 | [package_info](https://pub.dev/packages/package_info) | 2.0.2 | [package_info_plus](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/package_info_plus) | 已适配 | +| 21 | [share_plus](https://pub.dev/packages/share_plus) | 7.2.2 | [share_plus](https://gitee.com/openharmony-sig/flutter_plus_plugins/tree/master/packages/share_plus) | 已适配 | +| 22 | [audio_session](https://pub.dev/packages/audio_session) | 0.1.21 | [flutter_audio_session](https://gitee.com/openharmony-sig/flutter_audio_session) | 已适配 | +| 23 | [flutter_native_image](https://pub.dev/packages/flutter_native_image) | 0.0.6+1 | [flutter_native_image](https://gitee.com/openharmony-sig/flutter_native_image) | 已适配 | +| 24 | [flutter_sound](https://pub.dev/packages/flutter_sound) | 9.2.13 | [flutter_sound](https://gitee.com/openharmony-sig/flutter_sound/tree/master/flutter_sound) | 已适配 | +| 25 | [image_gallery_saver](https://pub.dev/packages/image_gallery_saver) | 2.0.3 | [flutter_image_gallery_saver](https://gitee.com/openharmony-sig/flutter_image_gallery_saver) | 已适配 | +| 26 | [location](https://pub.dev/packages/location) | 5.0.3 | [location](https://gitee.com/openharmony-sig/flutter_location/tree/master/packages/location) | 已适配 | +| 27 | [power_image](https://pub.dev/packages/power_image) | 0.1.0-pre.2 | [flutter_power_image](https://gitee.com/openharmony-sig/flutter_power_image) | 已适配 | +| 28 | [wakelock](https://pub.dev/packages/wakelock) | 0.6.2 | [wakelock](https://gitee.com/openharmony-sig/flutter_wakelock/tree/master/wakelock) | 已适配 | +| 29 | [flutter_console](https://pub.dev/packages/flutter_console) | 0.0.4 | [flutter_console](https://gitee.com/openharmony-sig/flutter_console) | 已适配 | +| 30 | [audioplayers](https://pub.dev/packages/audioplayers) | 4.1.0 | [flutter_audioplayers](https://gitee.com/openharmony-sig/flutter_audioplayers/tree/master/packages) | 已适配 | +| 31 | [gpu_image](https://pub.dev/packages/gpu_image) | 1.0.0 | [flutter_gpu_image](https://gitee.com/openharmony-sig/flutter_gpu_image) | 已适配 | +| 32 | [image_crop](https://pub.dev/packages/image_crop) | 0.4.1 | [flutter_image_crop](https://gitee.com/openharmony-sig/flutter_image_crop) | 已适配 | +| 33 | [bitmap](https://pub.dev/packages/bitmap) | 0.1.3 | [flutter_bitmap](https://gitee.com/openharmony-sig/flutter_bitmap) | 已适配 | +| 34 | [leak_detector](https://pub.dev/packages/leak_detector) | 1.1.0 | [flutter_leak_detector](https://gitee.com/openharmony-sig/flutter_leak_detector) | 已适配 | +| 35 | [flutter_math_fork](https://pub.dev/packages/flutter_math_fork) | 0.6.3+1 | [flutter_math_fork](https://gitee.com/openharmony-sig/flutter_math_fork/tree/master/example) | 已适配 | +| 36 | [flutter_contacts](https://pub.dev/packages/flutter_contacts) | 1.1.9+2 | [flutter_contacts](https://gitee.com/openharmony-sig/flutter_contacts/tree/master/example) | 已适配 | +| 37 | [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) | 6.0.0 | [flutter_inappwebview](https://gitee.com/openharmony-sig/flutter_inappwebview) | 已适配 | +| 38 | [flutter_keyboard_visibility](https://pub.dev/packages/flutter_keyboard_visibility) | 6.0.0 | [flutter_keyboard_visibility](https://gitee.com/openharmony-sig/flutter_keyboard_visibility/tree/master/flutter_keyboard_visibility) | 已适配 | +| 39 | [flutter_widget_from_html](https://pub.dev/packages/flutter_widget_from_html) | 0.14.11 | [flutter_widget_from_html](https://gitee.com/openharmony-sig/flutter_widget_from_html) | 已适配 | +| 40 | [mobile_scanner](https://pub.dev/packages/mobile_scanner) | 3.5.7 | [fluttertpc_mobile_scanner](https://gitee.com/openharmony-sig/fluttertpc_mobile_scanner) | 已适配 | +| 41 | [device_util](https://pub.dev/packages/device_util) | 1.0.7 | [fluttertpc_device_util](https://gitee.com/openharmony-sig/fluttertpc_device_util) | 已适配 | +| 42 | [export_video_frame](https://pub.dev/packages/export_video_frame) | 0.0.7 | [fluttertpc_export_video_frame](https://gitee.com/openharmony-sig/fluttertpc_export_video_frame) | 已适配 | +| 43 | [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) | 17.2.2 | [fluttertpc_flutter_local_notifications](https://gitee.com/openharmony-sig/fluttertpc_flutter_local_notifications) | 已适配 | +| 44 | [flutter_phone_direct_caller](https://pub.dev/packages/flutter_phone_direct_caller) | 2.2.1 | [fluttertpc_flutter_phone_direct_caller](https://gitee.com/openharmony-sig/fluttertpc_flutter_phone_direct_caller) | 已适配 | +| 45 | [flutter_screenshot_callback](https://pub.dev/packages/flutter_screenshot_callback) | 0.0.9 | [fluttertpc_screenshot_callback](https://gitee.com/openharmony-sig/fluttertpc_screenshot_callback) | 已适配 | +| 46 | [flutter_sms](https://pub.dev/packages/flutter_sms) | 2.3.3 | [fluttertpc_flutter_sms](https://gitee.com/openharmony-sig/fluttertpc_flutter_sms) | 已适配 | +| 47 | [media_info](https://pub.dev/packages/media_info) | 0.12.0+2 | [fluttertpc_media_info](https://gitee.com/openharmony-sig/fluttertpc_media_info) | 已适配 | +| 48 | [orientation](https://pub.dev/packages/orientation) | 1.3.0 | [fluttertpc_orientation](https://gitee.com/openharmony-sig/fluttertpc_orientation) | 已适配 | +| 49 | [recognition_qrcode](https://pub.dev/packages/recognition_qrcode) | 2.0.2 | [fluttertpc_recognition_qrcode](https://gitee.com/openharmony-sig/fluttertpc_recognition_qrcode) | 已适配 | +| 50 | [video_compress](https://pub.dev/packages/video_compress) | 3.1.2 | [fluttertpc_video_compress](https://gitee.com/openharmony-sig/fluttertpc_video_compress) | 已适配 | +| 51 | [share_extend](https://pub.dev/packages/share_extend) | 2.0.0 | [fluttertpc_share_extend](https://gitee.com/openharmony-sig/fluttertpc_share_extend) | 已适配 | +| 52 | [catcher](https://pub.dev/packages/catcher) | 0.8.0 | [fluttertpc_catcher](https://gitee.com/openharmony-sig/fluttertpc_catcher) | 已适配 | +| 53 | [flutter_mailer](https://pub.dev/packages/flutter_mailer) | 2.1.2 | [fluttertpc_flutter_mailer](https://gitee.com/openharmony-sig/fluttertpc_flutter_mailer) | 已适配 | +| 54 | [gallery_saver](https://pub.dev/packages/gallery_saver) | 2.3.2 | [fluttertpc_gallery_saver](https://gitee.com/openharmony-sig/fluttertpc_gallery_saver) | 已适配 | +| 55 | [flutter_localization](https://pub.dev/packages/flutter_localization) | 0.2.2 | [flutter_localization](https://gitee.com/openharmony-sig/flutter_localization) | 已适配 | +| 56 | [keyboard_actions](https://pub.dev/packages/keyboard_actions) | 4.2.0 | [fluttertpc_keyboard_actions](https://gitee.com/openharmony-sig/fluttertpc_keyboard_actions) | 已适配 | +| 57 | [native_device_orientation](https://pub.dev/packages/native_device_orientation) | 1.2.1 | [fluttertpc_native_device_orientation](https://gitee.com/openharmony-sig/fluttertpc_native_device_orientation) | 已适配 | +| 58 | [screen](https://pub.dev/packages/screen) | 0.0.5 | [fluttertpc_screen](https://gitee.com/openharmony-sig/fluttertpc_screen) | 已适配 | +| 59 | [pdf_render](https://pub.dev/packages/pdf_render) | 1.4.12 | [fluttertpc_pdf_render](https://gitee.com/openharmony-sig/fluttertpc_pdf_render) | 已适配 | +| 60 | [pdf_viewer_plugin](https://pub.dev/packages/pdf_viewer_plugin) | 2.0.1 | [fluttertpc_pdf_viewer_plugin](https://gitee.com/openharmony-sig/fluttertpc_pdf_viewer_plugin/) | 已适配 | +| 61 | [r_scan](https://pub.dev/packages/r_scan) | 0.1.6+1 | [fluttertpc_r_scan](https://gitee.com/openharmony-sig/fluttertpc_r_scan/) | 已适配 | +| 62 | [r_upgrade](https://pub.dev/packages/r_upgrade) | 0.4.2 | [fluttertpc_r_upgrade](https://gitee.com/openharmony-sig/fluttertpc_r_upgrade/) | 已适配 | +| 63 | [scan](https://pub.dev/packages/scan) | 1.6.0 | [fluttertpc_scan](https://gitee.com/openharmony-sig/fluttertpc_scan/) | 已适配 | +| 64 | [open_app_settings](https://pub.dev/packages/open_app_settings) | 2.0.1 | [fluttertpc_open_app_settings](https://gitee.com/openharmony-sig/fluttertpc_open_app_settings/) | 已适配 | +| 65 | [audio_service](https://pub.dev/packages/audio_service) | 0.18.15 | [fluttertpc_audio_service](https://gitee.com/openharmony-sig/fluttertpc_audio_service/) | 已适配 | +| 66 | [open_filex](https://pub.dev/packages/open_filex) | 4.5.0 | [fluttertpc_open_filex](https://gitee.com/openharmony-sig/fluttertpc_open_filex/) | 已适配 | +| 67 | [auto_orientation](https://pub.dev/packages/auto_orientation) | 2.3.1 | [fluttertpc_auto_orientation](https://gitee.com/openharmony-sig/fluttertpc_auto_orientation/) | 已适配 | +| 68 | [tobias](https://pub.dev/packages/tobias) | 4.0.0 | [fluttertpc_tobias](https://gitee.com/openharmony-sig/fluttertpc_tobias/) | 已适配 | +| 69 | [in_app_purchase](https://pub.dev/packages/in_app_purchase) | 3.1.11 | [in_app_purchase](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/in_app_purchase) | 开发中 | +| 70 | [quick_actions](https://pub.dev/packages/quick_actions) | 1.0.6 | [quick_actions](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/quick_actions) | 开发中 | +| 71 | [dart_native](https://pub.dev/packages/dart_native) | 0.7.11 | - | 开发中 | +| 72 | [media_kit_video](https://pub.dev/packages/media_kit_video) | 1.2.5 | - | 开发中 | +| 73 | [flutter_filereader](https://pub.dev/packages/flutter_filereader) | 3.0.0 | - | 开发中 | +| 74 | [quick_actions](https://pub.dev/packages/quick_actions) | 1.0.6 | - | 开发中 | +| 75 | [flutter_document_picker](https://pub.dev/packages/flutter_document_picker) | 5.2.3 | - | 开发中 | +| 76 | [flutter_keychain](https://pub.dev/packages/flutter_keychain) | 2.5.0 | - | 开发中 | +| 77 | [flutter_udid](https://pub.dev/packages/flutter_udid) | 2.0.1 | - | 开发中 | +| 78 | [in_app_purchase](https://pub.dev/packages/in_app_purchase) | 3.1.11 | - | 开发中 | +| 79 | [flutter_yfree](https://pub.dev/packages/flutter_yfree) | 2.2.11 | - | 开发中 | +| 80 | [media_kit_libs_video](https://pub.dev/packages/media_kit_libs_video) | 1.0.5 | - | 开发中 | +| 81 | [flutter_custom_cursor](https://pub.dev/packages/flutter_custom_cursor) | 0.0.4 | - | 开发中 | +| 82 | [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) | 5.0.0 | - | 开发中 | +| 83 | [flutter_downloader](https://pub.dev/packages/flutter_downloader) | 1.10.5 | - | 开发中 | +| 84 | [flutter_qr_reader](https://pub.dev/packages/flutter_qr_reader) | 1.0.5 | - | 开发中 | +| 85 | [sqlite3_flutter_libs](https://pub.dev/packages/sqlite3_flutter_libs) | 0.5.24 | - | 开发中 | +| 86 | [fluwx](https://pub.dev/packages/fluwx) | 3.13.1 | - | 开发中 | +| 87 | [app_installer](https://pub.dev/packages/app_installer) | 1.2.0 | - | 开发中 | +| 88 | [appspector](https://pub.dev/packages/appspector) | 0.10.0 | - | 开发中 | +| 89 | [camerawesome](https://pub.dev/packages/camerawesome) | 1.4.0 | - | 开发中 | +| 90 | [file_picker](https://pub.dev/packages/file_picker) | 8.0.7 | - | 开发中 | +| 91 | [fk_user_agent](https://pub.dev/packages/fk_user_agent) | 2.1.0 | - | 开发中 | +| 92 | [flutter_pdfview](https://pub.dev/packages/flutter_pdfview) | 1.3.2 | - | 开发中 | +| 93 | [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage) | 9.2.2 | - | 开发中 | +| 94 | [flutter_statusbarcolor_ns](https://pub.dev/packages/flutter_statusbarcolor_ns) | 0.5.0 | - | 开发中 | +| 95 | [geocoding](https://pub.dev/packages/geocoding) | 3.0.0 | - | 开发中 | +| 96 | [image_cropper](https://pub.dev/packages/image_cropper) | 6.0.0 | - | 开发中 | +| 97 | [light_compressor](https://pub.dev/packages/light_compressor) | 2.0.1 | - | 开发中 | +| 98 | [map_launcher](https://pub.dev/packages/map_launcher) | 3.2.0 | - | 开发中 | +| 99 | [photo_manager](https://pub.dev/packages/photo_manager) | 3.3.0 | - | 开发中 | +| 100 | [qr_code_scanner](https://pub.dev/packages/qr_code_scanner) | 1.0.1 | - | 开发中 | +| 101 | [record_mp3](https://pub.dev/packages/record_mp3) | 3.0.0 | - | 开发中 | +| 102 | [saver_gallery](https://pub.dev/packages/saver_gallery) | 3.0.6 | - | 开发中 | +| 103 | [simple_circular_progress_bar](https://pub.dev/packages/simple_circular_progress_bar) | 1.0.2 | - | 开发中 | +| 104 | [uni_links](https://pub.dev/packages/uni_links) | 0.5.1 | - | 开发中 | +| 105 | [wakelock_plus](https://pub.dev/packages/wakelock_plus) | 1.1.6 | - | 开发中 | +| 106 | [system_boot_time](https://pub.dev/packages/system_boot_time) | 0.0.1 | - | 开发中 | +| 107 | [fast_rsa](https://pub.dev/packages/fast_rsa) | 3.6.3 | - | 开发中 | +| 108 | [install_plugin](https://pub.dev/packages/install_plugin) | 2.1.0 | - | 开发中 | +| 109 | [flutter_native_splash](https://pub.dev/packages/flutter_native_splash) | 2.3.13 | - | 开发中 | +| 110 | [geolocator](https://pub.dev/packages/geolocator) | 13.0.1 | - | 开发中 | +| 111 | [just_audio](https://pub.dev/packages/just_audio) | 0.9.37 | - | 开发中 | +| 112 | [printing](https://pub.dev/packages/printing) | 5.10.4 | - | 开发中 | +| 113 | [flutter_barcode_scanner](https://pub.dev/packages/flutter_barcode_scanner) | 2.0.0 | - | 开发中 | +| 114 | [open_file](https://pub.dev/packages/open_file) | 3.5.3 | - | 开发中 | +| 115 | [flutter_app_badger](https://pub.dev/packages/flutter_app_badger) | 1.5.0 | - | 开发中 | +| 116 | [flutter_blue_plus](https://pub.dev/packages/flutter_blue_plus) | 1.32.12 | - | 开发中 | +| 117 | [sensors_plus](https://pub.dev/packages/sensors_plus) | 4.0.2 | - | 开发中 | +| 118 | [sms_autofill](https://pub.dev/packages/sms_autofill) | 2.4.0 | - | 开发中 | +| 119 | [vibration](https://pub.dev/packages/vibration) | 2.0.0 | - | 开发中 | +| 120 | [network_info_plus](https://pub.dev/packages/network_info_plus) | 6.0.1 | - | 开发中 | +| 121 | [record](https://pub.dev/packages/record) | 5.0.5 | - | 开发中 | +| 122 | [video_thumbnail](https://pub.dev/packages/video_thumbnail) | 0.5.3 | - | 开发中 | +| 123 | [flutter_isolate](https://pub.dev/packages/flutter_isolate) | 2.0.4 | - | 开发中 | +| 124 | [flutter_jsbridge_plugin](https://pub.dev/packages/flutter_jsbridge_plugin) | 0.0.5 | - | 开发中 | +| 125 | [flutter_vibrate](https://pub.dev/packages/flutter_vibrate) | 1.3.0 | - | 开发中 | +| 126 | [app_settings](https://pub.dev/packages/app_settings) | 5.1.1 | - | 开发中 | +| 127 | [qrcode_flutter](https://pub.dev/packages/qrcode_flutter) | 3.0.0 | - | 开发中 | +| 128 | [cryptography_flutter](https://pub.dev/packages/cryptography_flutter) | 2.3.0 | - | 开发中 | +| 129 | [pdfx](https://pub.dev/packages/pdfx) | 2.3.0 | - | 开发中 | +| 130 | [connectivity_for_web](https://pub.dev/packages/connectivity_for_web) | 0.4.0+1 | - | 未适配 | +| 131 | [connectivity_macos](https://pub.dev/packages/connectivity_macos) | 0.2.1+2 | - | 未适配 | +| 132 | [css_colors](https://pub.dev/packages/css_colors) | 1.1.3 | [css_colors](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/css_colors) | 未适配 | +| 133 | [espresso](https://pub.dev/packages/espresso) | 0.3.0+6 | [espresso](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/espresso) | 未适配 | +| 134 | [extension_google_sign_ in_as_googleapis_auth](https://pub.dev/packages/extension_google_sign_in_as_googleapis_auth) | 2.0.11 | [extension_google_sign_ in_as_googleapis_auth](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/extension_google_sign_in_as_googleapis_auth) | 未适配 | +| 135 | [flutter_adaptive_scaffold](https://pub.dev/packages/flutter_adaptive_scaffold) | 0.1.4 | [flutter_adaptive_scaffold](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_adaptive_scaffold) | 未适配 | +| 136 | [flutter_image](https://pub.dev/packages/flutter_image) | 4.1.9 | [flutter_image](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_image) | 未适配 | +| 137 | [flutter_lints](https://pub.dev/packages/flutter_lints) | 2.0.3 | [flutter_lints](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_lints) | 未适配 | +| 138 | [flutter_markdown](https://pub.dev/packages/flutter_markdown) | 0.6.15 | [flutter_markdown](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_markdown) | 未适配 | +| 139 | [flutter_migrate](https://pub.dev/packages/flutter_migrate) | 0.1.0 | [flutter_migrate](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_migrate) | 未适配 | +| 140 | [flutter_plugin_android_lifecycle](https://pub.dev/packages/flutter_plugin_android_lifecycle) | 2.0.17 | [flutter_plugin_android_lifecycle](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_plugin_android_lifecycle) | 未适配 | +| 141 | [flutter_template_images](https://pub.dev/packages/flutter_template_images) | 4.2.1 | [flutter_template_images](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/flutter_template_images) | 未适配 | +| 142 | [go_router](https://pub.dev/packages/go_router) | 12.1.1 | [go_router](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/go_router) | 未适配 | +| 143 | [go_router_builder](https://pub.dev/packages/go_router_builder) | 2.3.4 | [go_router_builder](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/go_router_builder) | 未适配 | +| 144 | [google_identity_services_web](https://pub.dev/packages/google_identity_services_web) | 0.2.2 | [google_identity_services_web](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/google_identity_services_web) | 未适配 | +| 145 | [google_maps_flutter](https://pub.dev/packages/google_maps_flutter) | 2.3.0 | [google_maps_flutter](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/google_maps_flutter) | 未适配 | +| 146 | [google_sign_in](https://pub.dev/packages/google_sign_in) | 6.1.6 | [google_sign_in](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/google_sign_in) | 未适配 | +| 147 | [ios_platform_images](https://pub.dev/packages/ios_platform_images) | 0.2.3 | [ios_platform_images](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/ios_platform_images) | 未适配 | +| 148 | [metrics_center](https://pub.dev/packages/metrics_center) | 1.0.12 | [metrics_center](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/metrics_center) | 未适配 | +| 149 | [multicast_dns](https://pub.dev/packages/multicast_dns) | 0.3.2+4 | [multicast_dns](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/multicast_dns) | 未适配 | +| 150 | [palette_generator](https://pub.dev/packages/palette_generator) | 0.3.3+3 | [palette_generator](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/palette_generator) | 未适配 | +| 151 | [pointer_interceptor](https://pub.dev/packages/pointer_interceptor) | 0.9.3+5 | [pointer_interceptor](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/pointer_interceptor) | 未适配 | +| 152 | [rfw](https://pub.dev/packages/rfw) | 1.0.9 | [rfw](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/rfw) | 未适配 | +| 153 | [standard_message_codec](https://pub.dev/packages/standard_message_codec) | 0.0.1+4 | [standard_message_codec](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/standard_message_codec) | 未适配 | +| 154 | [two_dimensional_scrollables](https://pub.dev/packages/two_dimensional_scrollables) | - | [two_dimensional_scrollables](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/two_dimensional_scrollables) | 未适配 | +| 155 | [web_benchmarks](https://pub.dev/packages/web_benchmarks) | 0.1.0+8 | [web_benchmarks](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/web_benchmarks) | 未适配 | +| 156 | [webview_flutter_platform_interface](https://pub.dev/packages/webview_flutter_platform_interface) | 2.6.0 | [webview_flutter_platform_interface](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/webview_flutter_platform_interface-v2.10.0) | 未适配 | +| 157 | [xdg_directories](https://pub.dev/packages/xdg_directories) | 1.0.3 | [xdg_directories](https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/xdg_directories) | 未适配 | +| 158 | [stack_trace](https://pub.dev/packages/stack_trace) | 1.11.1 | - | 无需适配 | +| 159 | [vector_math](https://pub.dev/packages/vector_math) | 2.1.4 | - | 无需适配 | +| 160 | [collection](https://pub.dev/packages/collection) | 1.18.0 | - | 无需适配 | +| 161 | [source_span](https://pub.dev/packages/source_span) | 1.10.0 | - | 无需适配 | +| 162 | [characters](https://pub.dev/packages/characters) | 1.3.0 | - | 无需适配 | +| 163 | [path](https://pub.dev/packages/path) | 1.8.3 | - | 无需适配 | +| 164 | [ffi](https://pub.dev/packages/ffi) | 2.0.2 | - | 无需适配 | +| 165 | [intl](https://pub.dev/packages/intl) | 0.18.1 | - | 无需适配 | +| 166 | [archive](https://pub.dev/packages/archive) | 3.4.10 | - | 无需适配 | +| 167 | [file](https://pub.dev/packages/file) | 6.1.4 | - | 无需适配 | +| 168 | [provider](https://pub.dev/packages/provider) | 6.1.2 | - | 无需适配 | +| 169 | [typed_data](https://pub.dev/packages/typed_data) | 1.3.2 | - | 无需适配 | +| 170 | [term_glyph](https://pub.dev/packages/term_glyph) | 1.2.1 | - | 无需适配 | +| 171 | [nested](https://pub.dev/packages/nested) | 1.0.0 | - | 无需适配 | +| 172 | [lottie](https://pub.dev/packages/lottie) | 2.3.2 | - | 无需适配 | +| 173 | [crypto](https://pub.dev/packages/crypto) | 3.0.3 | - | 无需适配 | +| 174 | [http_parser](https://pub.dev/packages/http_parser) | 4.0.2 | - | 无需适配 | +| 175 | [uuid](https://pub.dev/packages/uuid) | 4.2.2 | - | 无需适配 | +| 176 | [dio](https://pub.dev/packages/dio) | 5.7.0 | - | 无需适配 | +| 177 | [clock](https://pub.dev/packages/clock) | 1.1.1 | - | 无需适配 | +| 178 | [http](https://pub.dev/packages/http) | 0.13.6 | - | 无需适配 | +| 179 | [string_scanner](https://pub.dev/packages/string_scanner) | 1.2.0 | - | 无需适配 | +| 180 | [event_bus](https://pub.dev/packages/event_bus) | 2.0.0 | - | 无需适配 | +| 181 | [rxdart](https://pub.dev/packages/rxdart) | 0.28.0 | - | 无需适配 | +| 182 | [platform](https://pub.dev/packages/platform) | 3.1.3 | - | 无需适配 | +| 183 | [logging](https://pub.dev/packages/logging) | 1.2.0 | - | 无需适配 | +| 184 | [tuple](https://pub.dev/packages/tuple) | 2.0.2 | - | 无需适配 | +| 185 | [async](https://pub.dev/packages/async) | 2.11.0 | - | 无需适配 | +| 186 | [path_drawing](https://pub.dev/packages/path_drawing) | 1.0.1 | - | 无需适配 | +| 187 | [quiver](https://pub.dev/packages/quiver) | 3.2.2 | - | 无需适配 | +| 188 | [flutter_cache_manager](https://pub.dev/packages/flutter_cache_manager) | 3.3.2 | - | 无需适配 | +| 189 | [sqflite_common](https://pub.dev/packages/sqflite_common) | 2.4.5+1 | - | 无需适配 | +| 190 | [visibility_detector](https://pub.dev/packages/visibility_detector) | 0.4.0+2 | - | 无需适配 | +| 191 | [octo_image](https://pub.dev/packages/octo_image) | 2.0.0 | - | 无需适配 | +| 192 | [synchronized](https://pub.dev/packages/synchronized) | 3.1.0 | - | 无需适配 | +| 193 | [convert](https://pub.dev/packages/convert) | 3.1.1 | - | 无需适配 | +| 194 | [cached_network_image](https://pub.dev/packages/cached_network_image) | 3.2.3 | - | 无需适配 | +| 195 | [xml](https://pub.dev/packages/xml) | 6.3.0 | - | 无需适配 | +| 196 | [path_parsing](https://pub.dev/packages/path_parsing) | 1.0.1 | - | 无需适配 | +| 197 | [flutter_svg](https://pub.dev/packages/flutter_svg) | 2.0.10+1 | - | 无需适配 | +| 198 | [petitparser](https://pub.dev/packages/petitparser) | 5.4.0 | - | 无需适配 | +| 199 | [photo_view](https://pub.dev/packages/photo_view) | 0.15.0 | - | 无需适配 | +| 201 | [flutter_swiper_null_safety](https://pub.dev/packages/flutter_swiper_null_safety) | 1.0.2 | - | 无需适配 | +| 202 | [scrollable_positioned_list](https://pub.dev/packages/scrollable_positioned_list) | 0.3.8 | - | 无需适配 | +| 203 | [flare_flutter](https://pub.dev/packages/flare_flutter) | 3.0.2 | - | 无需适配 | +| 204 | [table_calendar](https://pub.dev/packages/table_calendar) | 3.0.9 | - | 无需适配 | +| 205 | [flutter_bloc](https://pub.dev/packages/flutter_bloc) | 8.1.6 | - | 无需适配 | +| 206 | [pull_to_refresh](https://pub.dev/packages/pull_to_refresh) | 2.0.0 | - | 无需适配 | +| 207 | [qr_flutter](https://pub.dev/packages/qr_flutter) | 4.1.0 | - | 无需适配 | +| 208 | [qr](https://pub.dev/packages/qr) | 3.0.1 | - | 无需适配 | +| 209 | [fl_chart](https://pub.dev/packages/fl_chart) | 0.62.0 | - | 无需适配 | +| 210 | [date_format](https://pub.dev/packages/date_format) | 2.0.9 | - | 无需适配 | +| 211 | [auto_size_text](https://pub.dev/packages/auto_size_text) | 3.0.0 | - | 无需适配 | +| 212 | [bloc](https://pub.dev/packages/bloc) | 8.1.4 | - | 无需适配 | +| 213 | [plume](https://pub.dev/packages/plume) | 0.1.4 | - | 无需适配 | +| 214 | [card_swiper](https://pub.dev/packages/card_swiper) | 3.0.1 | - | 无需适配 | +| 215 | [dotted_border](https://pub.dev/packages/dotted_border) | 2.1.0 | - | 无需适配 | +| 216 | [equatable](https://pub.dev/packages/equatable) | 2.0.5 | - | 无需适配 | +| 217 | [rational](https://pub.dev/packages/rational) | 2.2.3 | - | 无需适配 | +| 218 | [executor](https://pub.dev/packages/executor) | 2.2.3 | - | 无需适配 | +| 219 | [safemap](https://pub.dev/packages/safemap) | 2.1.0 | - | 无需适配 | +| 220 | [decimal](https://pub.dev/packages/decimal) | 3.0.2 | - | 无需适配 | +| 221 | [simple_gesture_detector](https://pub.dev/packages/simple_gesture_detector) | 0.2.1 | - | 无需适配 | +| 222 | [plugin_platform_interface](https://pub.dev/packages/plugin_platform_interface) | 2.1.6 | - | 无需适配 | +| 223 | [animations](https://pub.dev/packages/animations) | 2.0.8 | - | 无需适配 | +| 224 | [cross_file](https://pub.dev/packages/cross_file) | 0.3.3+6 | - | 无需适配 | +| 225 | [flutter_blurhash](https://pub.dev/packages/flutter_blurhash) | 0.7.0 | - | 无需适配 | +| 226 | [globbing](https://pub.dev/packages/globbing) | 0.3.1 | - | 无需适配 | +| 227 | [graphs](https://pub.dev/packages/graphs) | 2.3.1 | - | 无需适配 | + + ## 如何引用这些库 ### 一、工具库pigeon使用 @@ -55,7 +274,7 @@ dependencies: 示例:在某个Flutter兼容OpenHarmony项目中加入支持OpenHarmony平台的path_provider库依赖; -可参考示例:https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/pictures_provider_demo。 +可参考示例:https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/pictures_provider_demo ## FAQ diff --git a/packages/animations/.gitignore b/packages/animations/.gitignore index f3c205341e7dbb11f1dfecee67a1cd1f84660a22..75cf5484e571b4d19dc5f9caf736424d6e411e7f 100644 --- a/packages/animations/.gitignore +++ b/packages/animations/.gitignore @@ -42,3 +42,10 @@ app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 diff --git a/packages/animations/example/ohos/build-profile.json5 b/packages/animations/example/ohos/build-profile.json5 index 0575650de7357d581ca594d92ab9eea77d12dad8..cde2069de4f9d27b83a2bddc456a7666459b70df 100644 --- a/packages/animations/example/ohos/build-profile.json5 +++ b/packages/animations/example/ohos/build-profile.json5 @@ -1,17 +1,3 @@ -/* - * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ { "app": { "signingConfigs": [], @@ -19,9 +5,8 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", - "runtimeOS": "HarmonyOS", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" } ], "buildModeSet": [ diff --git a/packages/animations/example/ohos/hvigor/hvigor-config.json5 b/packages/animations/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/animations/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/animations/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/animations/example/ohos/hvigor/hvigor-wrapper.js b/packages/animations/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/animations/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/animations/example/ohos/hvigorw b/packages/animations/example/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/animations/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/animations/example/ohos/hvigorw.bat b/packages/animations/example/ohos/hvigorw.bat deleted file mode 100644 index 015ad7171d03a3c644d8ca0202c6d72313ba2a34..0000000000000000000000000000000000000000 --- a/packages/animations/example/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/animations/example/ohos/oh-package.json5 b/packages/animations/example/ohos/oh-package.json5 index a2408ea9cb7b309e6ad95e27a4c8b88985ae57c6..8b0a0be108647f00bf48aa1f04f65471ee8513df 100644 --- a/packages/animations/example/ohos/oh-package.json5 +++ b/packages/animations/example/ohos/oh-package.json5 @@ -1,19 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", @@ -25,4 +11,4 @@ "devDependencies": { "@ohos/hypium": "1.0.6" } -} +} \ No newline at end of file diff --git a/packages/camera/camera/lib/src/camera_preview.dart b/packages/camera/camera/lib/src/camera_preview.dart index 53f9034dc858850fbe977d4d673936bb10e9ea87..a5e04283669f3cdc401e3adb9c7762e32aa72a2e 100644 --- a/packages/camera/camera/lib/src/camera_preview.dart +++ b/packages/camera/camera/lib/src/camera_preview.dart @@ -44,7 +44,9 @@ class CameraPreview extends StatelessWidget { } Widget _wrapInRotatedBox({required Widget child}) { - if (kIsWeb || defaultTargetPlatform != TargetPlatform.android) { + if (kIsWeb || + (defaultTargetPlatform != TargetPlatform.android && + defaultTargetPlatform != TargetPlatform.ohos)) { return child; } diff --git a/packages/camera/camera_ohos/.gitignore b/packages/camera/camera_ohos/.gitignore index 24476c5d1eb55824c76d8b01a3965f94abad1ef8..7ec225305d1580562b9856e4c9e0488a2ea19b63 100644 --- a/packages/camera/camera_ohos/.gitignore +++ b/packages/camera/camera_ohos/.gitignore @@ -42,3 +42,10 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/lib/camera_preview.dart b/packages/camera/camera_ohos/example/lib/camera_preview.dart index 3240dbd67f7d3a976c232e99018cbc847e601b15..710f15a3494f80e38589a7ad32fd0e783e1c179e 100644 --- a/packages/camera/camera_ohos/example/lib/camera_preview.dart +++ b/packages/camera/camera_ohos/example/lib/camera_preview.dart @@ -23,38 +23,29 @@ class CameraPreview extends StatelessWidget { @override Widget build(BuildContext context) { - var _angle = 0.0; - if (controller.description.lensDirection == CameraLensDirection.back) { - _angle = 90 * math.pi / 180; - } else { - _angle = -90 * math.pi / 180; - } return controller.value.isInitialized ? ValueListenableBuilder( - valueListenable: controller, - builder: (BuildContext context, Object? value, Widget? child) { - final double cameraAspectRatio = - controller.value.previewSize!.height / - controller.value.previewSize!.width; - return AspectRatio( - aspectRatio: _isLandscape() - ? cameraAspectRatio - : (1 / cameraAspectRatio), - child: Transform.rotate( - angle: _angle, - child: Stack( - fit: StackFit.expand, - children: [ - _wrapInRotatedBox(child: controller.buildPreview()), - child ?? Container(), - ], - ), - ), - ); - }, - child: child, - ) + valueListenable: controller, + builder: (BuildContext context, Object? value, Widget? child) { + final double cameraAspectRatio = + controller.value.previewSize!.width / + controller.value.previewSize!.height; + return AspectRatio( + aspectRatio: _isLandscape() + ? cameraAspectRatio + : (1 / cameraAspectRatio), + child: Stack( + fit: StackFit.expand, + children: [ + _wrapInRotatedBox(child: controller.buildPreview()), + child ?? Container(), + ], + ), + ); + }, + child: child, + ) : Container(); } @@ -90,7 +81,7 @@ class CameraPreview extends StatelessWidget { return controller.value.isRecordingVideo ? controller.value.recordingOrientation! : (controller.value.previewPauseOrientation ?? - controller.value.lockedCaptureOrientation ?? - controller.value.deviceOrientation); + controller.value.lockedCaptureOrientation ?? + controller.value.deviceOrientation); } } diff --git a/packages/camera/camera_ohos/example/ohos/build-profile.json5 b/packages/camera/camera_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..26bea001ac6999860a2890121e380c122e6b601b 100644 --- a/packages/camera/camera_ohos/example/ohos/build-profile.json5 +++ b/packages/camera/camera_ohos/example/ohos/build-profile.json5 @@ -1,12 +1,12 @@ { "app": { - "signingConfigs": [], + "signingConfigs": [ + ], "products": [ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz b/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz deleted file mode 100644 index 65b0d24f94d2aecc1099f8f8220beec695bfb779..0000000000000000000000000000000000000000 Binary files a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz and /dev/null differ diff --git a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz b/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz deleted file mode 100644 index 233a449cbfef6be702d861744254dd89ce633fb7..0000000000000000000000000000000000000000 Binary files a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz and /dev/null differ diff --git a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz b/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz deleted file mode 100644 index e2e499e18dfcd05e1e275579d11697640eb80323..0000000000000000000000000000000000000000 Binary files a/packages/camera/camera_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz and /dev/null differ diff --git a/packages/camera/camera_ohos/example/ohos/dependencies/rollup.tgz b/packages/camera/camera_ohos/example/ohos/dependencies/rollup.tgz deleted file mode 100644 index b224a37a5f69fd22f58c7a28151742eafe7e6317..0000000000000000000000000000000000000000 Binary files a/packages/camera/camera_ohos/example/ohos/dependencies/rollup.tgz and /dev/null differ diff --git a/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 b/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 index dcb7708a5ca01a1a770663b20cc3df74023888f2..32f7e89e53a02b5562c5f0b1e0dd0399ab124c3b 100644 --- a/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 +++ b/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 @@ -6,9 +6,9 @@ "author": "", "license": "", "dependencies": { - "integration_test": "file:../har/integration_test.har", - "camera_ohos": "file:../har/camera_ohos.har", - "path_provider_ohos": "file:../har/path_provider_ohos.har", - "video_player_ohos": "file:../har/video_player_ohos.har" + "integration_test": "file:..\\har\\integration_test.har", + "camera_ohos": "file:..\\har\\camera_ohos.har", + "path_provider_ohos": "file:..\\har\\path_provider_ohos.har", + "video_player_ohos": "file:..\\har\\video_player_ohos.har" } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/ohos/entry/src/main/module.json5 b/packages/camera/camera_ohos/example/ohos/entry/src/main/module.json5 index 789d91670f7b8782f2a4af98e12d70f4e2b06147..9757bb40a17d2807cd8df4a889bbae28ffa5a68a 100644 --- a/packages/camera/camera_ohos/example/ohos/entry/src/main/module.json5 +++ b/packages/camera/camera_ohos/example/ohos/entry/src/main/module.json5 @@ -28,7 +28,6 @@ { "name": "EntryAbility", "srcEntry": "./ets/entryability/EntryAbility.ets", - "orientation": "auto_rotation", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label", @@ -78,49 +77,6 @@ "when": "inuse" } }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "FormAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "FormAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.READ_IMAGEVIDEO", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "FormAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.WRITE_IMAGEVIDEO", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "FormAbility" - ], - "when": "inuse" - } - }, - // { - // "name": "ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO" - // } ] } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-config.json5 index c5ca790dec67268ab35add6cd4b64d29d8e5cf9e..2a565d5d6997609c23b7091ab738ed6c7b67137d 100644 --- a/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -13,9 +13,8 @@ * limitations under the License. */ -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100644 index 9ac59757797142402334df54d615a3c4bc3a0d89..0000000000000000000000000000000000000000 --- a/packages/camera/camera_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,16 +0,0 @@ -/** -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),d=require("net"),D=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={},E={},m=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(E,"__esModule",{value:!0}),E.maxPathLength=E.isMac=E.isLinux=E.isWindows=void 0;const y=m(t),C="Windows_NT",F="Darwin";function g(){return y.default.type()===C}function A(){return y.default.type()===F}E.isWindows=g,E.isLinux=function(){return"Linux"===y.default.type()},E.isMac=A,E.maxPathLength=function(){return A()?1016:g()?259:4095},Object.defineProperty(h,"__esModule",{value:!0}),h.LOG_LEVEL=h.ANALYZE=h.PARALLEL=h.INCREMENTAL=h.DAEMON=h.DOT=h.PROPERTIES=h.HVIGOR_ARK_COMPILE_MAX_SIZE=h.HVIGOR_POOL_CACHE_TTL=h.HVIGOR_POOL_CACHE_CAPACITY=h.HVIGOR_POOL_MAX_CORE_SIZE=h.HVIGOR_POOL_MAX_SIZE=h.ENABLE_SIGN_TASK_KEY=h.HVIGOR_CACHE_DIR_KEY=h.WORK_SPACE=h.PROJECT_CACHES=h.HVIGOR_USER_HOME_DIR_NAME=h.DEFAULT_PACKAGE_JSON=h.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=h.PNPM=h.HVIGOR=h.NPM_TOOL=h.PNPM_TOOL=h.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const v=E;h.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",h.PNPM_TOOL=(0,v.isWindows)()?"pnpm.cmd":"pnpm",h.NPM_TOOL=(0,v.isWindows)()?"npm.cmd":"npm",h.HVIGOR="hvigor",h.PNPM="pnpm",h.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",h.DEFAULT_PACKAGE_JSON="package.json",h.HVIGOR_USER_HOME_DIR_NAME=".hvigor",h.PROJECT_CACHES="project_caches";var S=h.WORK_SPACE="workspace";h.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",h.ENABLE_SIGN_TASK_KEY="enableSignTask",h.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",h.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",h.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",h.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",h.HVIGOR_ARK_COMPILE_MAX_SIZE="hvigor.arkCompile.maxSize",h.PROPERTIES="properties",h.DOT=".",h.DAEMON="daemon",h.INCREMENTAL="incremental",h.PARALLEL="typeCheck",h.ANALYZE="analyze",h.LOG_LEVEL="logLevel";var w={},O={};Object.defineProperty(O,"__esModule",{value:!0}),O.logError=O.logInfo=O.logErrorAndExit=void 0,O.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},O.logInfo=function(e){console.log(e)},O.logError=function(e){console.error(e)};var _=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),b=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),B=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&_(t,e,n);return b(t,e),t};Object.defineProperty(w,"__esModule",{value:!0});var P=w.executeBuild=void 0;const k=B(n),I=B(e),x=O,N=r;P=w.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=k.realpathSync(t),n=process.argv.slice(2),r=(0,N.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var R,T,M,L,j,$={},H={},G={exports:{}},V={exports:{}};function U(){if(T)return R;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return R=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function J(){if(L)return M;return L=1,M=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),K={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function te(){return Y||(Y=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=ee();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=J()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(X,X.exports)),X.exports}Z=G,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Z.exports=(j||(j=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=J()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(V,V.exports)),V.exports):Z.exports=te();var ne=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=re(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=re(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,ae=e=>e&&"object"==typeof e&&!Array.isArray(e),le=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ue.inspect(e,{depth:5})}) - ${n}`)}))};var fe={configure:e=>{oe("New configuration to be validated: ",e),le(e,ce(ae(e)),"must be an object."),oe(`Calling pre-processing listeners (${ie.length})`),ie.forEach((t=>t(e))),oe("Configuration pre-processing finished."),oe(`Calling configuration listeners (${se.length})`),se.forEach((t=>t(e))),oe("Configuration finished.")},addListener:e=>{se.push(e),oe(`Added listener, now ${se.length} listeners`)},addPreProcessingListener:e=>{ie.push(e),oe(`Added pre-processing listener, now ${ie.length} listeners`)},throwExceptionIf:le,anObject:ae,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ce},de={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(de);const De=de.exports,pe=t,he=i,Ee=e,me=s,ye=G.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function Fe(e){return e?`[${Ce[e][0]}m`:""}function ge(e){return e?`[${Ce[e][1]}m`:""}function Ae(e,t){return n=he.format("[%s] [%s] %s - ",De.asString(e.startTime),e.level.toString(),e.categoryName),Fe(r=t)+n+ge(r);var n,r}function ve(e){return Ae(e)+he.format(...e.data)}function Se(e){return Ae(e,e.level.colour)+he.format(...e.data)}function we(e){return he.format(...e.data)}function Oe(e){return e.data[0]}function _e(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(Ee.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthwe,basic:()=>ve,colored:()=>Se,coloured:()=>Se,pattern:e=>_e(e&&e.pattern,e&&e.tokens),dummy:()=>Oe};var Be={basicLayout:ve,messagePassThroughLayout:we,patternLayout:_e,colouredLayout:Se,coloredLayout:Se,dummyLayout:Oe,addLayout(e,t){be[e]=t},layout:(e,t)=>be[e]&&be[e](t)};const Pe=fe,ke=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),Pe.addListener((e=>{const t=e.levels;if(t){Pe.throwExceptionIf(e,Pe.not(Pe.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{Pe.throwExceptionIf(e,Pe.not(Pe.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),Pe.throwExceptionIf(e,Pe.not(Pe.anObject(t[n])),`level "${n}" must be an object`),Pe.throwExceptionIf(e,Pe.not(t[n].value),`level "${n}" must have a 'value' property`),Pe.throwExceptionIf(e,Pe.not(Pe.anInteger(t[n].value)),`level "${n}".value must have an integer value`),Pe.throwExceptionIf(e,Pe.not(t[n].colour),`level "${n}" must have a 'colour' property`),Pe.throwExceptionIf(e,Pe.not(ke.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${ke.join(", ")}`)}))}})),Pe.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Ne={exports:{}},Re={};const{parse:Te,stringify:Me}=JSON,{keys:Le}=Object,je=String,$e="string",He={},Ge="object",Ve=(e,t)=>t,Ue=e=>e instanceof je?je(e):e,Je=(e,t)=>typeof t===$e?new je(t):t,We=(e,t,n,r)=>{const u=[];for(let o=Le(n),{length:i}=o,s=0;s{const r=je(t.push(n)-1);return e.set(n,r),r},Ke=(e,t)=>{const n=Te(e,Je).map(Ue),r=n[0],u=t||Ve,o=typeof r===Ge&&r?We(n,new Set,r,u):r;return u.call({"":o},"",o)};Re.parse=Ke;const qe=(e,t,n)=>{const r=t&&typeof t===Ge?(e,n)=>""===e||-1Te(qe(e));Re.fromJSON=e=>Ke(Me(e));const Ye=Re,Ze=xe;const Xe=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Qe=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ye.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Xe.serialise(t))))}static deserialise(e){let t;try{const n=Ye.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Xe.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Qe(n.categoryName,Ze.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Qe("log4js",Ze.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var et=Qe;const tt=G.exports("log4js:clustering"),nt=et,rt=fe;let ut=!1,ot=null;try{ot=require("cluster")}catch(e){tt("cluster module not present"),ut=!0}const it=[];let st=!1,ct="NODE_APP_INSTANCE";const at=()=>st&&"0"===process.env[ct],lt=()=>ut||ot&&ot.isMaster||at(),ft=e=>{it.forEach((t=>t(e)))},dt=(e,t)=>{if(tt("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){tt("received message: ",t.data);const e=nt.deserialise(t.data);ft(e)}};ut||rt.addListener((e=>{it.length=0,({pm2:st,disableClustering:ut,pm2InstanceVar:ct="NODE_APP_INSTANCE"}=e),tt(`clustering disabled ? ${ut}`),tt(`cluster.isMaster ? ${ot&&ot.isMaster}`),tt(`pm2 enabled ? ${st}`),tt(`pm2InstanceVar = ${ct}`),tt(`process.env[${ct}] = ${process.env[ct]}`),st&&process.removeListener("message",dt),ot&&ot.removeListener&&ot.removeListener("message",dt),ut||e.disableClustering?tt("Not listening for cluster messages, because clustering disabled."):at()?(tt("listening for PM2 broadcast messages"),process.on("message",dt)):ot&&ot.isMaster?(tt("listening for cluster messages"),ot.on("message",dt)):tt("not listening for messages, because we are not a master process")}));var Dt={onlyOnMaster:(e,t)=>lt()?e():t,isMaster:lt,send:e=>{lt()?ft(e):(st||(e.cluster={workerId:ot.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{it.push(e)}},pt={};function ht(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function Et(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:ht},e)}const mt={dateFile:Et,file:Et,fileSync:Et};pt.modifyConfig=e=>mt[e.type]?mt[e.type](e):e;var yt={};const Ct=console.log.bind(console);yt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var gt={};gt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var At={};At.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var vt={};const St=G.exports("log4js:categoryFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{St(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={};const Ot=G.exports("log4js:noLogFilter");wt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{Ot(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(Ot("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var _t={},bt={exports:{}},Bt={},Pt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},kt=c,It=process.cwd,xt=null,Nt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Rt=process.chdir;process.chdir=function(e){xt=null,Rt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Rt)}var Tt=function(e){kt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,kt.O_WRONLY|kt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,kt.O_WRONLY|kt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){kt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,kt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,kt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Nt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var Mt=a.Stream,Lt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);Mt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);Mt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var jt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:$t(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},$t=Object.getPrototypeOf||function(e){return e.__proto__};var Ht,Gt,Vt=n,Ut=Tt,Jt=Lt,Wt=jt,zt=i;function Kt(e,t){Object.defineProperty(e,Ht,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(Ht=Symbol.for("graceful-fs.queue"),Gt=Symbol.for("graceful-fs.previous")):(Ht="___graceful-fs.queue",Gt="___graceful-fs.previous");var qt=function(){};if(zt.debuglog?qt=zt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(qt=function(){var e=zt.format.apply(zt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Vt[Ht]){var Yt=p[Ht]||[];Kt(Vt,Yt),Vt.close=function(e){function t(t,n){return e.call(Vt,t,(function(e){e||tn(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Gt,{value:e}),t}(Vt.close),Vt.closeSync=function(e){function t(t){e.apply(Vt,arguments),tn()}return Object.defineProperty(t,Gt,{value:e}),t}(Vt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){qt(Vt[Ht]),l.equal(Vt[Ht].length,0)}))}p[Ht]||Kt(p,Vt[Ht]);var Zt,Xt=Qt(Wt(Vt));function Qt(e){Ut(e),e.gracefulify=Qt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):en([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):en([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):en([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):en([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):en([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Jt(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;h(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;h(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function h(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):en([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=h,e}function en(e){qt("ENQUEUE",e[0].name,e[1]),Vt[Ht].push(e),nn()}function tn(){for(var e=Date.now(),t=0;t2&&(Vt[Ht][t][3]=e,Vt[Ht][t][4]=e);nn()}function nn(){if(clearTimeout(Zt),Zt=void 0,0!==Vt[Ht].length){var e=Vt[Ht].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)qt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){qt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(qt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Vt[Ht].push(e)}void 0===Zt&&(Zt=setTimeout(nn,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Vt.__patched&&(Xt=Qt(Vt),Vt.__patched=!0),function(e){const t=Pt.fromCallback,n=Xt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(Bt);const rn=e;function un(e){return(e=rn.normalize(rn.resolve(e)).split(rn.sep)).length>0?e[0]:null}const on=/[<>:"|?*]/;var sn=function(e){const t=un(e);return e=e.replace(t,""),on.test(e)};const cn=Xt,an=e,ln=sn,fn=parseInt("0777",8);var dn=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&ln(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||cn;void 0===o&&(o=fn&~process.umask()),u||(u=null),r=r||function(){},t=an.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(an.dirname(t)===t)return r(o);e(an.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const Dn=Xt,pn=e,hn=sn,En=parseInt("0777",8);var mn=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||Dn;if("win32"===process.platform&&hn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=En&~process.umask()),r||(r=null),t=pn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(pn.dirname(t)===t)throw u;r=e(pn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const yn=(0,Pt.fromCallback)(dn);var Cn={mkdirs:yn,mkdirsSync:mn,mkdirp:yn,mkdirpSync:mn,ensureDir:yn,ensureDirSync:mn};const Fn=Xt;var gn=function(e,t,n,r){Fn.open(e,"r+",((e,u)=>{if(e)return r(e);Fn.futimes(u,t,n,(e=>{Fn.close(u,(t=>{r&&r(e||t)}))}))}))},An=function(e,t,n){const r=Fn.openSync(e,"r+");return Fn.futimesSync(r,t,n),Fn.closeSync(r)};const vn=Xt,Sn=e,wn=10,On=5,_n=0,bn=process.versions.node.split("."),Bn=Number.parseInt(bn[0],10),Pn=Number.parseInt(bn[1],10),kn=Number.parseInt(bn[2],10);function In(){if(Bn>wn)return!0;if(Bn===wn){if(Pn>On)return!0;if(Pn===On&&kn>=_n)return!0}return!1}function xn(e,t){const n=Sn.resolve(e).split(Sn.sep).filter((e=>e)),r=Sn.resolve(t).split(Sn.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Nn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Rn,Tn,Mn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?vn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);vn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):vn.stat(e,((e,r)=>{if(e)return n(e);vn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Nn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?vn.statSync(e,{bigint:!0}):vn.statSync(e);try{r=In()?vn.statSync(t,{bigint:!0}):vn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Nn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=Sn.resolve(Sn.dirname(t)),s=Sn.resolve(Sn.dirname(r));if(s===i||s===Sn.parse(s).root)return o();In()?vn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Nn(t,r,u))):e(t,n,s,u,o))):vn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Nn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Sn.resolve(Sn.dirname(t)),i=Sn.resolve(Sn.dirname(r));if(i===o||i===Sn.parse(i).root)return;let s;try{s=In()?vn.statSync(i,{bigint:!0}):vn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Nn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Ln=Xt,jn=e,$n=Cn.mkdirsSync,Hn=An,Gn=Mn;function Vn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Ln.statSync:Ln.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Ln.mkdirSync(n),Jn(t,n,r),Ln.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Jn(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Ln.unlinkSync(n),Un(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Un(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Ln.readlinkSync(t);r.dereference&&(u=jn.resolve(process.cwd(),u));if(e){let e;try{e=Ln.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Ln.symlinkSync(u,n);throw e}if(r.dereference&&(e=jn.resolve(process.cwd(),e)),Gn.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Ln.statSync(n).isDirectory()&&Gn.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Ln.unlinkSync(t),Ln.symlinkSync(e,t)}(u,n)}return Ln.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Un(e,t,n,r){return"function"==typeof Ln.copyFileSync?(Ln.copyFileSync(t,n),Ln.chmodSync(n,e.mode),r.preserveTimestamps?Hn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Rn:(Tn=1,Rn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Ln.openSync(t,"r"),s=Ln.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=jn.join(t,e),o=jn.join(n,e),{destStat:i}=Gn.checkPathsSync(u,o,"copy");return Vn(i,u,o,r)}(r,e,t,n)))}var Wn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Gn.checkPathsSync(e,t,"copy");return Gn.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=jn.dirname(n);Ln.existsSync(u)||$n(u);return Vn(e,t,n,r)}(u,e,t,n)},zn={copySync:Wn};const Kn=Pt.fromPromise,qn=Bt;var Yn={pathExists:Kn((function(e){return qn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:qn.existsSync};const Zn=Xt,Xn=e,Qn=Cn.mkdirs,er=Yn.pathExists,tr=gn,nr=Mn;function rr(e,t,n,r,u){const o=Xn.dirname(n);er(o,((i,s)=>i?u(i):s?or(e,t,n,r,u):void Qn(o,(o=>o?u(o):or(e,t,n,r,u)))))}function ur(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function or(e,t,n,r,u){return r.filter?ur(ir,e,t,n,r,u):ir(e,t,n,r,u)}function ir(e,t,n,r,u){(r.dereference?Zn.stat:Zn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){Zn.mkdir(n,(o=>{if(o)return u(o);ar(t,n,r,(t=>t?u(t):Zn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return ar(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();Zn.unlink(n,(o=>o?u(o):sr(e,t,n,r,u)))}(e,n,r,u,o):sr(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){Zn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Xn.resolve(process.cwd(),o)),e?void Zn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?Zn.symlink(o,n,u):u(t):(r.dereference&&(i=Xn.resolve(process.cwd(),i)),nr.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&nr.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){Zn.unlink(t,(r=>r?n(r):Zn.symlink(e,t,n)))}(o,n,u)))):Zn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function sr(e,t,n,r,u){return"function"==typeof Zn.copyFile?Zn.copyFile(t,n,(t=>t?u(t):cr(e,n,r,u))):function(e,t,n,r,u){const o=Zn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=Zn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>cr(e,n,r,u)))}))}(e,t,n,r,u)}function cr(e,t,n,r){Zn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?tr(t,e.atime,e.mtime,r):r()))}function ar(e,t,n,r){Zn.readdir(e,((u,o)=>u?r(u):lr(o,e,t,n,r)))}function lr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Xn.join(n,t),s=Xn.join(r,t);nr.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;or(a,i,s,u,(t=>t?o(t):lr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var fr=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),nr.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;nr.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ur(rr,s,e,t,n,r):rr(s,e,t,n,r)))}))};var dr={copy:(0,Pt.fromCallback)(fr)};const Dr=Xt,pr=e,hr=l,Er="win32"===process.platform;function mr(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||Dr[t],e[t+="Sync"]=e[t]||Dr[t]})),e.maxBusyTries=e.maxBusyTries||3}function yr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),hr(e,"rimraf: missing path"),hr.strictEqual(typeof e,"string","rimraf: path should be a string"),hr.strictEqual(typeof n,"function","rimraf: callback function required"),hr(t,"rimraf: invalid options argument provided"),hr.strictEqual(typeof t,"object","rimraf: options should be object"),mr(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){hr(e),hr(t),hr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Er?Fr(e,t,r,n):u&&u.isDirectory()?Ar(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Er?Fr(e,t,r,n):Ar(e,t,r,n);if("EISDIR"===r.code)return Ar(e,t,r,n)}return n(r)}))))}function Fr(e,t,n,r){hr(e),hr(t),hr("function"==typeof r),n&&hr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Ar(e,t,n,r):t.unlink(e,r)}))}))}function gr(e,t,n){let r;hr(e),hr(t),n&&hr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Sr(e,t,n):t.unlinkSync(e)}function Ar(e,t,n,r){hr(e),hr(t),n&&hr(n instanceof Error),hr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){hr(e),hr(t),hr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{yr(pr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function vr(e,t){let n;mr(t=t||{}),hr(e,"rimraf: missing path"),hr.strictEqual(typeof e,"string","rimraf: path should be a string"),hr(t,"rimraf: missing options"),hr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Er&&gr(e,t,n)}try{n&&n.isDirectory()?Sr(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Er?gr(e,t,n):Sr(e,t,n);if("EISDIR"!==n.code)throw n;Sr(e,t,n)}}function Sr(e,t,n){hr(e),hr(t),n&&hr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(hr(e),hr(t),t.readdirSync(e).forEach((n=>vr(pr.join(e,n),t))),!Er){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var wr=yr;yr.sync=vr;const Or=wr;var _r={remove:(0,Pt.fromCallback)(Or),removeSync:Or.sync};const br=Pt.fromCallback,Br=Xt,Pr=e,kr=Cn,Ir=_r,xr=br((function(e,t){t=t||function(){},Br.readdir(e,((n,r)=>{if(n)return kr.mkdirs(e,t);r=r.map((t=>Pr.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Nr(e){let t;try{t=Br.readdirSync(e)}catch(t){return kr.mkdirsSync(e)}t.forEach((t=>{t=Pr.join(e,t),Ir.removeSync(t)}))}var Rr={emptyDirSync:Nr,emptydirSync:Nr,emptyDir:xr,emptydir:xr};const Tr=Pt.fromCallback,Mr=e,Lr=Xt,jr=Cn,$r=Yn.pathExists;var Hr={createFile:Tr((function(e,t){function n(){Lr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Lr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Mr.dirname(e);$r(o,((e,r)=>e?t(e):r?n():void jr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Lr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Mr.dirname(e);Lr.existsSync(n)||jr.mkdirsSync(n),Lr.writeFileSync(e,"")}};const Gr=Pt.fromCallback,Vr=e,Ur=Xt,Jr=Cn,Wr=Yn.pathExists;var zr={createLink:Gr((function(e,t,n){function r(e,t){Ur.link(e,t,(e=>{if(e)return n(e);n(null)}))}Wr(t,((u,o)=>u?n(u):o?n(null):void Ur.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Vr.dirname(t);Wr(o,((u,i)=>u?n(u):i?r(e,t):void Jr.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Ur.existsSync(t))return;try{Ur.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Vr.dirname(t);return Ur.existsSync(n)||Jr.mkdirsSync(n),Ur.linkSync(e,t)}};const Kr=e,qr=Xt,Yr=Yn.pathExists;var Zr={symlinkPaths:function(e,t,n){if(Kr.isAbsolute(e))return qr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Kr.dirname(t),u=Kr.join(r,e);return Yr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):qr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Kr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Kr.isAbsolute(e)){if(n=qr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Kr.dirname(t),u=Kr.join(r,e);if(n=qr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=qr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Kr.relative(r,e)}}}};const Xr=Xt;var Qr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Xr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Xr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const eu=Pt.fromCallback,tu=e,nu=Xt,ru=Cn.mkdirs,uu=Cn.mkdirsSync,ou=Zr.symlinkPaths,iu=Zr.symlinkPathsSync,su=Qr.symlinkType,cu=Qr.symlinkTypeSync,au=Yn.pathExists;var lu={createSymlink:eu((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,au(t,((u,o)=>u?r(u):o?r(null):void ou(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,su(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=tu.dirname(t);au(o,((n,i)=>n?r(n):i?nu.symlink(e,t,u,r):void ru(o,(n=>{if(n)return r(n);nu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(nu.existsSync(t))return;const r=iu(e,t);e=r.toDst,n=cu(r.toCwd,n);const u=tu.dirname(t);return nu.existsSync(u)||uu(u),nu.symlinkSync(e,t,n)}};var fu,du={createFile:Hr.createFile,createFileSync:Hr.createFileSync,ensureFile:Hr.createFile,ensureFileSync:Hr.createFileSync,createLink:zr.createLink,createLinkSync:zr.createLinkSync,ensureLink:zr.createLink,ensureLinkSync:zr.createLinkSync,createSymlink:lu.createSymlink,createSymlinkSync:lu.createSymlinkSync,ensureSymlink:lu.createSymlink,ensureSymlinkSync:lu.createSymlinkSync};try{fu=Xt}catch(e){fu=n}function Du(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function pu(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var hu={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||fu,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=pu(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||fu,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=pu(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||fu,o="";try{o=Du(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||fu,u=Du(t,n);return r.writeFileSync(e,u,n)}},Eu=hu;const mu=Pt.fromCallback,yu=Eu;var Cu={readJson:mu(yu.readFile),readJsonSync:yu.readFileSync,writeJson:mu(yu.writeFile),writeJsonSync:yu.writeFileSync};const Fu=e,gu=Cn,Au=Yn.pathExists,vu=Cu;var Su=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Fu.dirname(e);Au(u,((o,i)=>o?r(o):i?vu.writeJson(e,t,n,r):void gu.mkdirs(u,(u=>{if(u)return r(u);vu.writeJson(e,t,n,r)}))))};const wu=Xt,Ou=e,_u=Cn,bu=Cu;var Bu=function(e,t,n){const r=Ou.dirname(e);wu.existsSync(r)||_u.mkdirsSync(r),bu.writeJsonSync(e,t,n)};const Pu=Pt.fromCallback,ku=Cu;ku.outputJson=Pu(Su),ku.outputJsonSync=Bu,ku.outputJSON=ku.outputJson,ku.outputJSONSync=ku.outputJsonSync,ku.writeJSON=ku.writeJson,ku.writeJSONSync=ku.writeJsonSync,ku.readJSON=ku.readJson,ku.readJSONSync=ku.readJsonSync;var Iu=ku;const xu=Xt,Nu=e,Ru=zn.copySync,Tu=_r.removeSync,Mu=Cn.mkdirpSync,Lu=Mn;function ju(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ru(e,t,r),Tu(e)}(e,t,n)}}var $u=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Lu.checkPathsSync(e,t,"move");return Lu.checkParentPathsSync(e,u,t,"move"),Mu(Nu.dirname(t)),function(e,t,n){if(n)return Tu(t),ju(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return ju(e,t,n)}(e,t,r)},Hu={moveSync:$u};const Gu=Xt,Vu=e,Uu=dr.copy,Ju=_r.remove,Wu=Cn.mkdirp,zu=Yn.pathExists,Ku=Mn;function qu(e,t,n,r){Gu.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Uu(e,t,u,(t=>t?r(t):Ju(e,r)))}(e,t,n,r):r()))}var Yu=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Ku.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Ku.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Wu(Vu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Ju(t,(u=>u?r(u):qu(e,t,n,r)));zu(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):qu(e,t,n,r)))}(e,t,u,r)))}))}))};var Zu={move:(0,Pt.fromCallback)(Yu)};const Xu=Pt.fromCallback,Qu=Xt,eo=e,to=Cn,no=Yn.pathExists;var ro={outputFile:Xu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=eo.dirname(e);no(u,((o,i)=>o?r(o):i?Qu.writeFile(e,t,n,r):void to.mkdirs(u,(u=>{if(u)return r(u);Qu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=eo.dirname(e);if(Qu.existsSync(n))return Qu.writeFileSync(e,...t);to.mkdirsSync(n),Qu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},Bt,zn,dr,Rr,du,Iu,Cn,Hu,Zu,ro,Yn,_r);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(bt);const uo=G.exports("streamroller:fileNameFormatter"),oo=e;const io=G.exports("streamroller:fileNameParser"),so=de.exports;const co=G.exports("streamroller:moveAndMaybeCompressFile"),ao=bt.exports,lo=f;var fo=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return co(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await ao.pathExists(e))if(co(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=ao.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=ao.createReadStream(e).on("open",(()=>{t.pipe(lo.createGzip()).pipe(i)})).on("error",(t=>{co(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{co(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),ao.unlink(e).then(r).catch((t=>{co(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),ao.truncate(e).then(r).catch((t=>{co(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(co(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),ao.unlink(t).then((()=>{u(e)})).catch((e=>{co(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(co(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{co(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await ao.move(e,t,{overwrite:!0})}catch(n){if(co(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){co("moveAndMaybeCompressFile: trying copy+truncate instead");try{await ao.copy(e,t,{overwrite:!0}),await ao.truncate(e)}catch(e){co("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else co("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const Do=G.exports("streamroller:RollingFileWriteStream"),po=bt.exports,ho=e,Eo=t,mo=()=>new Date,yo=de.exports,{Writable:Co}=a,Fo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=oo.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(uo(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},go=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(io("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(io("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(io("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];io("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),io(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=so.parse(n,i,new Date(0,0));return so.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return io(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(io("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Ao=fo;var vo=class extends Co{constructor(e,t){if(Do(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(ho.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${ho.sep}`)&&(e=e.replace("~",Eo.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=ho.parse(e),""===this.fileObject.dir&&(this.fileObject=ho.parse(ho.join(process.cwd(),e))),this.fileFormatter=Fo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return Do(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{Do(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(Do(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==yo(this.options.pattern,mo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Do("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){Do(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Ao(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?yo(this.options.pattern,mo()):null,Do(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await po.readdir(this.fileObject.dir).catch((()=>[]));Do(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:mo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return po.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(ho.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(po.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;po.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=po.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(Do(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),Do("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>ho.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,Do(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>po.unlink(e).catch((t=>{Do(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const So=vo;var wo=class extends So{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const Oo=vo;var _o={RollingFileWriteStream:vo,RollingFileStream:wo,DateRollingFileStream:class extends Oo{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const bo=G.exports("log4js:file"),Bo=e,Po=_o,ko=t,Io=ko.EOL;let xo=!1;const No=new Set;function Ro(){No.forEach((e=>{e.sighupHandler()}))}_t.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bo.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new Po.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${Bo.sep}.+)`),ko.homedir()),e=Bo.normalize(e),bo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){bo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){No.delete(c),0===No.size&&xo&&(process.removeListener("SIGHUP",Ro),xo=!1),s.end("","utf-8",e)},No.add(c),xo||(process.on("SIGHUP",Ro),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const Mo=_o,Lo=t.EOL;function jo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Mo.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Lo,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,jo(e.filename,e.pattern,n,e,e.timezoneOffset)};var $o={};const Ho=G.exports("log4js:fileSync"),Go=e,Vo=n,Uo=t,Jo=Uo.EOL;function Wo(e,t){const n=e=>{try{return Vo.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n(Go.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Vo.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n(Go.dirname(e)),Vo.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class zo{constructor(e,t,n,r){if(Ho("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Vo.statSync(e).size}catch(t){Wo(e,r)}return t}(this.filename)}shouldRoll(){return Ho("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${Go.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${Go.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(Ho(`Index of ${n} is ${r}`),0===t.backups)Vo.truncateSync(e,0);else if(r ${e}.${r+1}`),Vo.renameSync(Go.join(Go.dirname(e),n),`${e}.${r+1}`)}}Ho("Rolling, rolling, rolling"),Ho("Renaming the old files"),Vo.readdirSync(Go.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;Ho("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),Ho("writing the chunk to the file"),n.currentSize+=e.length,Vo.appendFileSync(n.filename,e)}}$o.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Go.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${Go.sep}.+)`),Uo.homedir()),e=Go.normalize(e),Ho("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new zo(e,t,n,u):(Wo(o=e,u),r={write(e){Vo.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Jo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Ko={};const qo=G.exports("log4js:tcp"),Yo=d;Ko.configure=function(e,t){qo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){qo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(qo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(qo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){qo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Yo.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{qo("socket connected"),c(),n=!0})),u.on("drain",(()=>{qo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{qo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){qo("shutdown called"),r.length&&o?(qo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const Zo=e,Xo=G.exports("log4js:appenders"),Qo=fe,ei=Dt,ti=xe,ni=Be,ri=pt,ui=new Map;ui.set("console",yt),ui.set("stdout",Ft),ui.set("stderr",gt),ui.set("logLevelFilter",At),ui.set("categoryFilter",vt),ui.set("noLogFilter",wt),ui.set("file",_t),ui.set("dateFile",To),ui.set("fileSync",$o),ui.set("tcp",Ko);const oi=new Map,ii=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Xo("Loading module from ",t)}catch(t){n=e,Xo("Loading module from ",e)}try{return require(n)}catch(n){return void Qo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},si=new Set,ci=(e,t)=>{if(oi.has(e))return oi.get(e);if(!t.appenders[e])return!1;if(si.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);si.add(e),Xo(`Creating appender ${e}`);const n=ai(e,t);return si.delete(e),oi.set(e,n),n},ai=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ui.get(e)||ii(`./${e}`,t)||ii(e,t)||require.main&&require.main.filename&&ii(Zo.join(Zo.dirname(require.main.filename),e),t)||ii(Zo.join(process.cwd(),e),t))(n.type,t);return Qo.throwExceptionIf(t,Qo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Xo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Xo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Xo(`${e}: clustering.isMaster ? ${ei.isMaster()}`),Xo(`${e}: appenderModule is ${i.inspect(r)}`),ei.onlyOnMaster((()=>(Xo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ri.modifyConfig(n),ni,(e=>ci(e,t)),ti))),(()=>{}))},li=e=>{if(oi.clear(),si.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ci(n,e)}))},fi=()=>{li()};fi(),Qo.addListener((e=>{Qo.throwExceptionIf(e,Qo.not(Qo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Qo.throwExceptionIf(e,Qo.not(t.length),"must define at least one appender."),t.forEach((t=>{Qo.throwExceptionIf(e,Qo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Qo.addListener(li),Ne.exports=oi,Ne.exports.init=fi;var di={exports:{}};!function(e){const t=G.exports("log4js:categories"),n=fe,r=xe,u=Ne.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(di);const Di=G.exports("log4js:logger"),pi=et,hi=xe,Ei=Dt,mi=di.exports,yi=fe,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Fi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let gi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=Fi,Di(`Logger created (${this.category}, ${this.level})`)}get level(){return hi.getLevel(mi.getLevelForCategory(this.category),hi.OFF)}set level(e){mi.setLevelForCategory(this.category,hi.getLevel(e,this.level))}get useCallStack(){return mi.getEnableCallStackForCategory(this.category)}set useCallStack(e){mi.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=hi.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):yi.validIdentifier(e)&&t.length>0?(this.log(hi.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(hi.INFO,`[${e}]`,...t)):this.log(hi.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Di(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new pi(this.category,e,t,this.context,r,n);Ei.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=Fi}}};function Ai(e){const t=hi.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);gi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},gi.prototype[n]=function(...e){this.log(t,...e)}}hi.levels.forEach(Ai),yi.addListener((()=>{hi.levels.forEach(Ai)}));var vi=gi;const Si=xe;function wi(e){return e.originalUrl||e.url}function Oi(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Si.INFO,o.statusCode>=300&&(r=Si.WARN),o.statusCode>=400&&(r=Si.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Si.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:wi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eOi(e,s)));t&&n.log(r,t)}else n.log(r,Oi(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Vi=ki;let Ui=!1;function Ji(e){if(!Ui)return;Ii("Received log event ",e);ji.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Wi(e){Ui&&zi();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ri.configure(Ni(t)),Hi.onMessage(Ji),Ui=!0,Ki}function zi(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Ui=!1;const t=Array.from(Li.values());Li.init(),ji.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Ki={getLogger:function(e){return Ui||Wi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new $i(e||"default")},configure:Wi,shutdown:zi,connectLogger:Gi,levels:Mi,addLayout:Ti.addLayout,recording:function(){return Vi}};var qi=Ki;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=qi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){let n=e.hvigorTrace.CUSTOM_TASKS??[];n.length>0&&(n=n.filter((e=>e.NAME!==t.NAME))),n.push(t),e.hvigorTrace.CUSTOM_TASKS=n},e.addCustomPlugin=function(t){let n=e.hvigorTrace.CUSTOM_PLUGINS??[];n.length>0&&(n=n.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),n.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=n}}(H);var Yi,Zi={};Yi=Zi,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.isCI=void 0,Yi.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Yi.name))};var Xi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(D),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Xi);var Qi={},es={},ts={};Object.defineProperty(ts,"__esModule",{value:!0}),ts.Unicode=void 0;class ns{}ts.Unicode=ns,ns.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ns.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ns.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(es,"__esModule",{value:!0}),es.JudgeUtil=void 0;const rs=ts;es.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&rs.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||rs.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||rs.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var us=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.parseJsonText=Qi.parseJsonFile=void 0;const os=us(n),is=us(t),ss=us(e),cs=es;var as;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(as||(as={}));let ls,fs,ds,Ds,ps,hs,Es="start",ms=[],ys=0,Cs=1,Fs=0,gs=!1,As="default",vs="'",Ss=1;function ws(e,t=!1){fs=String(e),Es="start",ms=[],ys=0,Cs=1,Fs=0,Ds=void 0,gs=t;do{ls=Os(),xs[Es]()}while("eof"!==ls.type);return Ds}function Os(){for(As="default",ps="",vs="'",Ss=1;;){hs=_s();const e=Bs[As]();if(e)return e}}function _s(){if(fs[ys])return String.fromCodePoint(fs.codePointAt(ys))}function bs(){const e=_s();return"\n"===e?(Cs++,Fs=0):e?Fs+=e.length:Fs++,e&&(ys+=e.length),e}Qi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=os.default.readFileSync(ss.default.resolve(e),{encoding:n});try{return ws(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${is.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Qi.parseJsonText=ws;const Bs={default(){switch(hs){case"/":return bs(),void(As="comment");case void 0:return bs(),Ps("eof")}if(!cs.JudgeUtil.isIgnoreChar(hs)&&!cs.JudgeUtil.isSpaceSeparator(hs))return Bs[Es]();bs()},start(){As="value"},beforePropertyName(){switch(hs){case"$":case"_":return ps=bs(),void(As="identifierName");case"\\":return bs(),void(As="identifierNameStartEscape");case"}":return Ps("punctuator",bs());case'"':case"'":return vs=hs,bs(),void(As="string")}if(cs.JudgeUtil.isIdStartChar(hs))return ps+=bs(),void(As="identifierName");throw Ms(as.Char,bs())},afterPropertyName(){if(":"===hs)return Ps("punctuator",bs());throw Ms(as.Char,bs())},beforePropertyValue(){As="value"},afterPropertyValue(){switch(hs){case",":case"}":return Ps("punctuator",bs())}throw Ms(as.Char,bs())},beforeArrayValue(){if("]"===hs)return Ps("punctuator",bs());As="value"},afterArrayValue(){switch(hs){case",":case"]":return Ps("punctuator",bs())}throw Ms(as.Char,bs())},end(){throw Ms(as.Char,bs())},comment(){switch(hs){case"*":return bs(),void(As="multiLineComment");case"/":return bs(),void(As="singleLineComment")}throw Ms(as.Char,bs())},multiLineComment(){switch(hs){case"*":return bs(),void(As="multiLineCommentAsterisk");case void 0:throw Ms(as.Char,bs())}bs()},multiLineCommentAsterisk(){switch(hs){case"*":return void bs();case"/":return bs(),void(As="default");case void 0:throw Ms(as.Char,bs())}bs(),As="multiLineComment"},singleLineComment(){switch(hs){case"\n":case"\r":case"\u2028":case"\u2029":return bs(),void(As="default");case void 0:return bs(),Ps("eof")}bs()},value(){switch(hs){case"{":case"[":return Ps("punctuator",bs());case"n":return bs(),ks("ull"),Ps("null",null);case"t":return bs(),ks("rue"),Ps("boolean",!0);case"f":return bs(),ks("alse"),Ps("boolean",!1);case"-":case"+":return"-"===bs()&&(Ss=-1),void(As="numerical");case".":case"0":case"I":case"N":return void(As="numerical");case'"':case"'":return vs=hs,bs(),ps="",void(As="string")}if(void 0===hs||!cs.JudgeUtil.isDigitWithoutZero(hs))throw Ms(as.Char,bs());As="numerical"},numerical(){switch(hs){case".":return ps=bs(),void(As="decimalPointLeading");case"0":return ps=bs(),void(As="zero");case"I":return bs(),ks("nfinity"),Ps("numeric",Ss*(1/0));case"N":return bs(),ks("aN"),Ps("numeric",NaN)}if(void 0!==hs&&cs.JudgeUtil.isDigitWithoutZero(hs))return ps=bs(),void(As="decimalInteger");throw Ms(as.Char,bs())},zero(){switch(hs){case".":case"e":case"E":return void(As="decimal");case"x":case"X":return ps+=bs(),void(As="hexadecimal")}return Ps("numeric",0)},decimalInteger(){switch(hs){case".":case"e":case"E":return void(As="decimal")}if(!cs.JudgeUtil.isDigit(hs))return Ps("numeric",Ss*Number(ps));ps+=bs()},decimal(){switch(hs){case".":ps+=bs(),As="decimalFraction";break;case"e":case"E":ps+=bs(),As="decimalExponent"}},decimalPointLeading(){if(cs.JudgeUtil.isDigit(hs))return ps+=bs(),void(As="decimalFraction");throw Ms(as.Char,bs())},decimalFraction(){switch(hs){case"e":case"E":return ps+=bs(),void(As="decimalExponent")}if(!cs.JudgeUtil.isDigit(hs))return Ps("numeric",Ss*Number(ps));ps+=bs()},decimalExponent(){switch(hs){case"+":case"-":return ps+=bs(),void(As="decimalExponentSign")}if(cs.JudgeUtil.isDigit(hs))return ps+=bs(),void(As="decimalExponentInteger");throw Ms(as.Char,bs())},decimalExponentSign(){if(cs.JudgeUtil.isDigit(hs))return ps+=bs(),void(As="decimalExponentInteger");throw Ms(as.Char,bs())},decimalExponentInteger(){if(!cs.JudgeUtil.isDigit(hs))return Ps("numeric",Ss*Number(ps));ps+=bs()},hexadecimal(){if(cs.JudgeUtil.isHexDigit(hs))return ps+=bs(),void(As="hexadecimalInteger");throw Ms(as.Char,bs())},hexadecimalInteger(){if(!cs.JudgeUtil.isHexDigit(hs))return Ps("numeric",Ss*Number(ps));ps+=bs()},identifierNameStartEscape(){if("u"!==hs)throw Ms(as.Char,bs());bs();const e=Is();switch(e){case"$":case"_":break;default:if(!cs.JudgeUtil.isIdStartChar(e))throw Ms(as.Identifier)}ps+=e,As="identifierName"},identifierName(){switch(hs){case"$":case"_":case"‌":case"‍":return void(ps+=bs());case"\\":return bs(),void(As="identifierNameEscape")}if(!cs.JudgeUtil.isIdContinueChar(hs))return Ps("identifier",ps);ps+=bs()},identifierNameEscape(){if("u"!==hs)throw Ms(as.Char,bs());bs();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!cs.JudgeUtil.isIdContinueChar(e))throw Ms(as.Identifier)}ps+=e,As="identifierName"},string(){switch(hs){case"\\":return bs(),void(ps+=function(){const e=_s(),t=function(){switch(_s()){case"b":return bs(),"\b";case"f":return bs(),"\f";case"n":return bs(),"\n";case"r":return bs(),"\r";case"t":return bs(),"\t";case"v":return bs(),"\v"}return}();if(t)return t;switch(e){case"0":if(bs(),cs.JudgeUtil.isDigit(_s()))throw Ms(as.Char,bs());return"\0";case"x":return bs(),function(){let e="",t=_s();if(!cs.JudgeUtil.isHexDigit(t))throw Ms(as.Char,bs());if(e+=bs(),t=_s(),!cs.JudgeUtil.isHexDigit(t))throw Ms(as.Char,bs());return e+=bs(),String.fromCodePoint(parseInt(e,16))}();case"u":return bs(),Is();case"\n":case"\u2028":case"\u2029":return bs(),"";case"\r":return bs(),"\n"===_s()&&bs(),""}if(void 0===e||cs.JudgeUtil.isDigitWithoutZero(e))throw Ms(as.Char,bs());return bs()}());case'"':case"'":if(hs===vs){const e=Ps("string",ps);return bs(),e}return void(ps+=bs());case"\n":case"\r":case void 0:throw Ms(as.Char,bs());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(hs)}ps+=bs()}};function Ps(e,t){return{type:e,value:t,line:Cs,column:Fs}}function ks(e){for(const t of e){if(_s()!==t)throw Ms(as.Char,bs());bs()}}function Is(){let e="",t=4;for(;t-- >0;){const t=_s();if(!cs.JudgeUtil.isHexDigit(t))throw Ms(as.Char,bs());e+=bs()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===ls.type)throw Ms(as.EOF);Ns()},beforePropertyName(){switch(ls.type){case"identifier":case"string":return ds=ls.value,void(Es="afterPropertyName");case"punctuator":return void Rs();case"eof":throw Ms(as.EOF)}},afterPropertyName(){if("eof"===ls.type)throw Ms(as.EOF);Es="beforePropertyValue"},beforePropertyValue(){if("eof"===ls.type)throw Ms(as.EOF);Ns()},afterPropertyValue(){if("eof"===ls.type)throw Ms(as.EOF);switch(ls.value){case",":return void(Es="beforePropertyName");case"}":Rs()}},beforeArrayValue(){if("eof"===ls.type)throw Ms(as.EOF);"punctuator"!==ls.type||"]"!==ls.value?Ns():Rs()},afterArrayValue(){if("eof"===ls.type)throw Ms(as.EOF);switch(ls.value){case",":return void(Es="beforeArrayValue");case"]":Rs()}},end(){}};function Ns(){const e=function(){let e;switch(ls.type){case"punctuator":switch(ls.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=ls.value}return e}();if(gs&&"object"==typeof e&&(e._line=Cs,e._column=Fs),void 0===Ds)Ds=e;else{const t=ms[ms.length-1];Array.isArray(t)?gs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:Fs}):t.push(e):t[ds]=gs&&"object"!=typeof e?{value:e,_line:Cs,_column:Fs}:e}!function(e){if(e&&"object"==typeof e)ms.push(e),Es=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=ms[ms.length-1];Es=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Rs(){ms.pop();const e=ms[ms.length-1];Es=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function Ms(e,t){let n="";switch(e){case as.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${Fs}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${Fs}`;break;case as.EOF:n=`JSON5: invalid end of input at ${Cs}:${Fs}`;break;case as.Identifier:Fs-=5,n=`JSON5: invalid identifier character at ${Cs}:${Fs}`}const r=new Ls(n);return r.lineNumber=Cs,r.columnNumber=Fs,r}class Ls extends SyntaxError{}var js={},$s={},Hs={},Gs={},Vs={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{t.push(((e,t)=>null!=e?r(e):n(t))),e.apply(this,t)}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);t.pop(),e.apply(this,t).then((e=>n(null,e)),n)}),"name",{value:e.name})}};!function(e){const t=Vs.fromCallback,n=Xt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},e.readv=function(e,t,...r){return"function"==typeof r[r.length-1]?n.readv(e,t,...r):new Promise(((u,o)=>{n.readv(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesRead:t,buffers:n})}))}))},e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))},"function"==typeof n.realpath.native?e.realpath.native=t(n.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(Gs);var Us={},Js={};const Ws=e;Js.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(Ws.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const zs=Gs,{checkPath:Ks}=Js,qs=e=>"number"==typeof e?e:{mode:511,...e}.mode;Us.makeDir=async(e,t)=>(Ks(e),zs.mkdir(e,{mode:qs(t),recursive:!0})),Us.makeDirSync=(e,t)=>(Ks(e),zs.mkdirSync(e,{mode:qs(t),recursive:!0}));const Ys=Vs.fromPromise,{makeDir:Zs,makeDirSync:Xs}=Us,Qs=Ys(Zs);var ec={mkdirs:Qs,mkdirsSync:Xs,mkdirp:Qs,mkdirpSync:Xs,ensureDir:Qs,ensureDirSync:Xs};const tc=Vs.fromPromise,nc=Gs;var rc={pathExists:tc((function(e){return nc.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:nc.existsSync};const uc=Xt;var oc=function(e,t,n,r){uc.open(e,"r+",((e,u)=>{if(e)return r(e);uc.futimes(u,t,n,(e=>{uc.close(u,(t=>{r&&r(e||t)}))}))}))},ic=function(e,t,n){const r=uc.openSync(e,"r+");return uc.futimesSync(r,t,n),uc.closeSync(r)};const sc=Gs,cc=e,ac=i;function lc(e,t,n){const r=n.dereference?e=>sc.stat(e,{bigint:!0}):e=>sc.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function fc(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function dc(e,t){const n=cc.resolve(e).split(cc.sep).filter((e=>e)),r=cc.resolve(t).split(cc.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Dc(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var pc={checkPaths:function(e,t,n,r,u){ac.callbackify(lc)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(fc(i,s)){const r=cc.basename(e),o=cc.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&dc(e,t)?u(new Error(Dc(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>sc.statSync(e,{bigint:!0}):e=>sc.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(fc(u,o)){const r=cc.basename(e),i=cc.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&dc(e,t))throw new Error(Dc(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=cc.resolve(cc.dirname(t)),s=cc.resolve(cc.dirname(r));if(s===i||s===cc.parse(s).root)return o();sc.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):fc(n,c)?o(new Error(Dc(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=cc.resolve(cc.dirname(t)),i=cc.resolve(cc.dirname(r));if(i===o||i===cc.parse(i).root)return;let s;try{s=sc.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(fc(n,s))throw new Error(Dc(t,r,u));return e(t,n,i,u)},isSrcSubdir:dc,areIdentical:fc};const hc=Xt,Ec=e,mc=ec.mkdirs,yc=rc.pathExists,Cc=oc,Fc=pc;function gc(e,t,n,r){if(!n.filter)return r(null,!0);Promise.resolve(n.filter(e,t)).then((e=>r(null,e)),(e=>r(e)))}function Ac(e,t,n,r,u){(r.dereference?hc.stat:hc.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Oc(n,r,u,o):function(e,t,n,r,u){hc.mkdir(n,(o=>{if(o)return u(o);Oc(t,n,r,(t=>t?u(t):wc(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();hc.unlink(n,(o=>o?u(o):vc(e,t,n,r,u)))}(e,n,r,u,o):vc(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){hc.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Ec.resolve(process.cwd(),o)),e?void hc.readlink(n,((e,t)=>e?"EINVAL"===e.code||"UNKNOWN"===e.code?hc.symlink(o,n,u):u(e):(r.dereference&&(t=Ec.resolve(process.cwd(),t)),Fc.isSrcSubdir(o,t)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${t}'.`)):Fc.isSrcSubdir(t,o)?u(new Error(`Cannot overwrite '${t}' with '${o}'.`)):function(e,t,n){hc.unlink(t,(r=>r?n(r):hc.symlink(e,t,n)))}(o,n,u)))):hc.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function vc(e,t,n,r,u){hc.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return wc(e,128|t,n)}(n,e,(u=>u?r(u):Sc(e,t,n,r)));return Sc(e,t,n,r)}(e.mode,t,n,u):wc(n,e.mode,u)))}function Sc(e,t,n,r){!function(e,t,n){hc.stat(e,((e,r)=>e?n(e):Cc(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):wc(n,e,r)))}function wc(e,t,n){return hc.chmod(e,t,n)}function Oc(e,t,n,r){hc.readdir(e,((u,o)=>u?r(u):_c(o,e,t,n,r)))}function _c(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Ec.join(n,t),s=Ec.join(r,t);gc(i,s,u,((t,c)=>t?o(t):c?void Fc.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;Ac(a,i,s,u,(t=>t?o(t):_c(e,n,r,u,o)))})):_c(e,n,r,u,o)))}(e,o,t,n,r,u):u()}var bc=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001"),Fc.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;Fc.checkParentPaths(e,i,t,"copy",(u=>{if(u)return r(u);gc(e,t,n,((u,o)=>u?r(u):o?void function(e,t,n,r,u){const o=Ec.dirname(n);yc(o,((i,s)=>i?u(i):s?Ac(e,t,n,r,u):void mc(o,(o=>o?u(o):Ac(e,t,n,r,u)))))}(s,e,t,n,r):r()))}))}))};const Bc=Xt,Pc=e,kc=ec.mkdirsSync,Ic=ic,xc=pc;function Nc(e,t,n,r){const u=(r.dereference?Bc.statSync:Bc.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?Mc(n,r,u):function(e,t,n,r){return Bc.mkdirSync(n),Mc(t,n,r),Tc(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Bc.unlinkSync(n),Rc(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Rc(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=Bc.readlinkSync(t);r.dereference&&(u=Pc.resolve(process.cwd(),u));if(e){let e;try{e=Bc.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Bc.symlinkSync(u,n);throw e}if(r.dereference&&(e=Pc.resolve(process.cwd(),e)),xc.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(xc.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Bc.unlinkSync(t),Bc.symlinkSync(e,t)}(u,n)}return Bc.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function Rc(e,t,n,r){return Bc.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){Tc(e,128|t)}(n,e);(function(e,t){const n=Bc.statSync(e);Ic(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),Tc(n,e.mode)}function Tc(e,t){return Bc.chmodSync(e,t)}function Mc(e,t,n){Bc.readdirSync(e).forEach((r=>function(e,t,n,r){const u=Pc.join(t,e),o=Pc.join(n,e);if(r.filter&&!r.filter(u,o))return;const{destStat:i}=xc.checkPathsSync(u,o,"copy",r);return Nc(i,u,o,r)}(r,e,t,n)))}var Lc=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:r,destStat:u}=xc.checkPathsSync(e,t,"copy",n);if(xc.checkParentPathsSync(e,r,t,"copy"),n.filter&&!n.filter(e,t))return;const o=Pc.dirname(t);return Bc.existsSync(o)||kc(o),Nc(u,e,t,n)};var jc={copy:(0,Vs.fromCallback)(bc),copySync:Lc};const $c=Xt;var Hc={remove:(0,Vs.fromCallback)((function(e,t){$c.rm(e,{recursive:!0,force:!0},t)})),removeSync:function(e){$c.rmSync(e,{recursive:!0,force:!0})}};const Gc=Vs.fromPromise,Vc=Gs,Uc=e,Jc=ec,Wc=Hc,zc=Gc((async function(e){let t;try{t=await Vc.readdir(e)}catch{return Jc.mkdirs(e)}return Promise.all(t.map((t=>Wc.remove(Uc.join(e,t)))))}));function Kc(e){let t;try{t=Vc.readdirSync(e)}catch{return Jc.mkdirsSync(e)}t.forEach((t=>{t=Uc.join(e,t),Wc.removeSync(t)}))}var qc={emptyDirSync:Kc,emptydirSync:Kc,emptyDir:zc,emptydir:zc};const Yc=Vs.fromCallback,Zc=e,Xc=Xt,Qc=ec;var ea={createFile:Yc((function(e,t){function n(){Xc.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Xc.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zc.dirname(e);Xc.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?Qc.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():Xc.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=Xc.statSync(e)}catch{}if(t&&t.isFile())return;const n=Zc.dirname(e);try{Xc.statSync(n).isDirectory()||Xc.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;Qc.mkdirsSync(n)}Xc.writeFileSync(e,"")}};const ta=Vs.fromCallback,na=e,ra=Xt,ua=ec,oa=rc.pathExists,{areIdentical:ia}=pc;var sa={createLink:ta((function(e,t,n){function r(e,t){ra.link(e,t,(e=>{if(e)return n(e);n(null)}))}ra.lstat(t,((u,o)=>{ra.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&ia(i,o))return n(null);const s=na.dirname(t);oa(s,((u,o)=>u?n(u):o?r(e,t):void ua.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=ra.lstatSync(t)}catch{}try{const t=ra.lstatSync(e);if(n&&ia(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=na.dirname(t);return ra.existsSync(r)||ua.mkdirsSync(r),ra.linkSync(e,t)}};const ca=e,aa=Xt,la=rc.pathExists;var fa={symlinkPaths:function(e,t,n){if(ca.isAbsolute(e))return aa.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=ca.dirname(t),u=ca.join(r,e);return la(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):aa.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:ca.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(ca.isAbsolute(e)){if(n=aa.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=ca.dirname(t),u=ca.join(r,e);if(n=aa.existsSync(u),n)return{toCwd:u,toDst:e};if(n=aa.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:ca.relative(r,e)}}}};const da=Xt;var Da={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);da.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=da.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const pa=Vs.fromCallback,ha=e,Ea=Gs,ma=ec.mkdirs,ya=ec.mkdirsSync,Ca=fa.symlinkPaths,Fa=fa.symlinkPathsSync,ga=Da.symlinkType,Aa=Da.symlinkTypeSync,va=rc.pathExists,{areIdentical:Sa}=pc;function wa(e,t,n,r){Ca(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ga(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ha.dirname(t);va(o,((n,i)=>n?r(n):i?Ea.symlink(e,t,u,r):void ma(o,(n=>{if(n)return r(n);Ea.symlink(e,t,u,r)}))))}))}))}var Oa={createSymlink:pa((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ea.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Ea.stat(e),Ea.stat(t)]).then((([u,o])=>{if(Sa(u,o))return r(null);wa(e,t,n,r)})):wa(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Ea.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Ea.statSync(e),r=Ea.statSync(t);if(Sa(n,r))return}const u=Fa(e,t);e=u.toDst,n=Aa(u.toCwd,n);const o=ha.dirname(t);return Ea.existsSync(o)||ya(o),Ea.symlinkSync(e,t,n)}};const{createFile:_a,createFileSync:ba}=ea,{createLink:Ba,createLinkSync:Pa}=sa,{createSymlink:ka,createSymlinkSync:Ia}=Oa;var xa={createFile:_a,createFileSync:ba,ensureFile:_a,ensureFileSync:ba,createLink:Ba,createLinkSync:Pa,ensureLink:Ba,ensureLinkSync:Pa,createSymlink:ka,createSymlinkSync:Ia,ensureSymlink:ka,ensureSymlinkSync:Ia};var Na={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ra;try{Ra=Xt}catch(e){Ra=n}const Ta=Vs,{stringify:Ma,stripBom:La}=Na;const ja=Ta.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ra,r=!("throws"in t)||t.throws;let u,o=await Ta.fromCallback(n.readFile)(e,t);o=La(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const $a=Ta.fromPromise((async function(e,t,n={}){const r=n.fs||Ra,u=Ma(t,n);await Ta.fromCallback(r.writeFile)(e,u,n)}));const Ha={readFile:ja,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ra,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=La(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:$a,writeFileSync:function(e,t,n={}){const r=n.fs||Ra,u=Ma(t,n);return r.writeFileSync(e,u,n)}};var Ga={readJson:Ha.readFile,readJsonSync:Ha.readFileSync,writeJson:Ha.writeFile,writeJsonSync:Ha.writeFileSync};const Va=Vs.fromCallback,Ua=Xt,Ja=e,Wa=ec,za=rc.pathExists;var Ka={outputFile:Va((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ja.dirname(e);za(u,((o,i)=>o?r(o):i?Ua.writeFile(e,t,n,r):void Wa.mkdirs(u,(u=>{if(u)return r(u);Ua.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ja.dirname(e);if(Ua.existsSync(n))return Ua.writeFileSync(e,...t);Wa.mkdirsSync(n),Ua.writeFileSync(e,...t)}};const{stringify:qa}=Na,{outputFile:Ya}=Ka;var Za=async function(e,t,n={}){const r=qa(t,n);await Ya(e,r,n)};const{stringify:Xa}=Na,{outputFileSync:Qa}=Ka;var el=function(e,t,n){const r=Xa(t,n);Qa(e,r,n)};const tl=Vs.fromPromise,nl=Ga;nl.outputJson=tl(Za),nl.outputJsonSync=el,nl.outputJSON=nl.outputJson,nl.outputJSONSync=nl.outputJsonSync,nl.writeJSON=nl.writeJson,nl.writeJSONSync=nl.writeJsonSync,nl.readJSON=nl.readJson,nl.readJSONSync=nl.readJsonSync;var rl=nl;const ul=Xt,ol=e,il=jc.copy,sl=Hc.remove,cl=ec.mkdirp,al=rc.pathExists,ll=pc;function fl(e,t,n,r,u){return r?dl(e,t,n,u):n?sl(t,(r=>r?u(r):dl(e,t,n,u))):void al(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):dl(e,t,n,u)))}function dl(e,t,n,r){ul.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};il(e,t,u,(t=>t?r(t):sl(e,r)))}(e,t,n,r):r()))}var Dl=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=(n=n||{}).overwrite||n.clobber||!1;ll.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;ll.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=ol.dirname(e);return ol.parse(t).root===t}(t)?fl(e,t,u,s,r):void cl(ol.dirname(t),(n=>n?r(n):fl(e,t,u,s,r)))))}))};const pl=Xt,hl=e,El=jc.copySync,ml=Hc.removeSync,yl=ec.mkdirpSync,Cl=pc;function Fl(e,t,n){try{pl.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return El(e,t,r),ml(e)}(e,t,n)}}var gl=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Cl.checkPathsSync(e,t,"move",n);return Cl.checkParentPathsSync(e,u,t,"move"),function(e){const t=hl.dirname(e);return hl.parse(t).root===t}(t)||yl(hl.dirname(t)),function(e,t,n,r){if(r)return Fl(e,t,n);if(n)return ml(t),Fl(e,t,n);if(pl.existsSync(t))throw new Error("dest already exists.");return Fl(e,t,n)}(e,t,r,o)};var Al={move:(0,Vs.fromCallback)(Dl),moveSync:gl},vl={...Gs,...jc,...qc,...xa,...rl,...ec,...Al,...Ka,...rc,...Hc},Sl=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.getHvigorUserHomeCacheDir=void 0;const wl=Sl(vl),Ol=Sl(t),_l=Sl(e),bl=h;Hs.getHvigorUserHomeCacheDir=function(){const e=_l.default.resolve(Ol.default.homedir(),bl.HVIGOR_USER_HOME_DIR_NAME),t=process.env.HVIGOR_USER_HOME;return void 0!==t&&_l.default.isAbsolute(t)?(wl.default.ensureDirSync(t),t):e},function(t){var n=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HVIGOR_PROJECT_WRAPPER_HOME=t.HVIGOR_PROJECT_ROOT_DIR=t.HVIGOR_PROJECT_CACHES_HOME=t.HVIGOR_PNPM_STORE_PATH=t.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=t.HVIGOR_WRAPPER_TOOLS_HOME=t.HVIGOR_USER_HOME=void 0;const r=n(e),u=Hs,o=h;t.HVIGOR_USER_HOME=(0,u.getHvigorUserHomeCacheDir)(),t.HVIGOR_WRAPPER_TOOLS_HOME=r.default.resolve(t.HVIGOR_USER_HOME,"wrapper","tools"),t.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=r.default.resolve(t.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",o.PNPM_TOOL),t.HVIGOR_PNPM_STORE_PATH=r.default.resolve(t.HVIGOR_USER_HOME,"caches"),t.HVIGOR_PROJECT_CACHES_HOME=r.default.resolve(t.HVIGOR_USER_HOME,o.PROJECT_CACHES),t.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),t.HVIGOR_PROJECT_WRAPPER_HOME=r.default.resolve(t.HVIGOR_PROJECT_ROOT_DIR,o.HVIGOR)}($s);var Bl={},Pl=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),kl=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Il=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Pl(t,e,n);return kl(t,e),t},xl=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.isFileExists=Bl.offlinePluginConversion=Bl.executeCommand=Bl.getNpmPath=Bl.hasNpmPackInPaths=void 0;const Nl=r,Rl=xl(n),Tl=Il(e),Ml=h,Ll=O;Bl.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Bl.getNpmPath=function(){const e=process.execPath;return Tl.join(Tl.dirname(e),Ml.NPM_TOOL)},Bl.executeCommand=function(e,t,n){0!==(0,Nl.spawnSync)(e,t,n).status&&(0,Ll.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Bl.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Tl.resolve(e,Ml.HVIGOR,t.replace("file:","")):t},Bl.isFileExists=function(e){return Rl.default.existsSync(e)&&Rl.default.statSync(e).isFile()},function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),d=s(e),D=h,E=$s,m=$s,y=O,C=Bl;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=d.resolve(E.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=d.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:E.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,y.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=d.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,y.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(m.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[m.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,y.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=d.resolve(m.HVIGOR_WRAPPER_TOOLS_HOME,D.DEFAULT_PACKAGE_JSON);try{l.existsSync(m.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(m.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[D.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,y.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:m.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,y.logInfo)("Pnpm install success.")}}(js);var jl={},$l={},Hl=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($l,"__esModule",{value:!0}),$l.getHvigorUserHomeCacheDir=void 0;const Gl=Hl(vl),Vl=Hl(t),Ul=Hl(e),Jl=h,Wl=O;let zl=!1;$l.getHvigorUserHomeCacheDir=function(){const e=Ul.default.resolve(Vl.default.homedir(),Jl.HVIGOR_USER_HOME_DIR_NAME),t=process.env.HVIGOR_USER_HOME;return void 0===t?e:Ul.default.isAbsolute(t)?Gl.default.existsSync(t)&&Gl.default.statSync(t).isFile()?((0,Wl.logInfo)(`File already exists: ${t}`),e):(Gl.default.ensureDirSync(t),t):(zl||((0,Wl.logInfo)(`Invalid custom userhome hvigor data dir:${t}`),zl=!0),e)},function(t){var n=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HVIGOR_PROJECT_WRAPPER_HOME=t.HVIGOR_PROJECT_ROOT_DIR=t.HVIGOR_PNPM_STORE_PATH=t.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=t.HVIGOR_WRAPPER_TOOLS_HOME=t.HVIGOR_USER_HOME=void 0;const r=n(e),u=h,o=$l;t.HVIGOR_USER_HOME=(0,o.getHvigorUserHomeCacheDir)(),t.HVIGOR_WRAPPER_TOOLS_HOME=r.default.resolve(t.HVIGOR_USER_HOME,"wrapper","tools"),t.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=r.default.resolve(t.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",u.PNPM_TOOL),t.HVIGOR_PNPM_STORE_PATH=r.default.resolve(t.HVIGOR_USER_HOME,"caches"),t.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),t.HVIGOR_PROJECT_WRAPPER_HOME=r.default.resolve(t.HVIGOR_PROJECT_ROOT_DIR,u.HVIGOR)}(jl);var Kl=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),ql=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Yl=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Kl(t,e,n);return ql(t,e),t},Zl=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($,"__esModule",{value:!0});var Xl=$.initProjectWorkSpace=void 0;const Ql=Yl(n),ef=Yl(e),tf=Zl(u),nf=H,rf=h,uf=Zi,of=Xi,sf=Qi,cf=O,af=js,lf=Bl,ff=jl;let df,Df,pf;function hf(e,t,n){return void 0!==n.dependencies&&(0,lf.offlinePluginConversion)(ff.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===ef.normalize(n.dependencies[e])}Xl=$.initProjectWorkSpace=function(){if(df=function(){const e=ef.resolve(ff.HVIGOR_PROJECT_WRAPPER_HOME,rf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Ql.existsSync(e)||(0,cf.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sf.parseJsonFile)(e)}(),pf=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=function(){const e=tf.default.argv.slice(2),t=/^(--config|-c).*/,n=/^(--config|-c)$/,r={};for(const[u,o]of e.entries())if(n.test(o)){const t=e[u+1].split("=");2===t.length&&(r[t[0]]=t[t.length-1])}else if(t.test(o)){const e=o.match(t);if(e&&e[0].length"2.5.0";return!1}(e)?function(e){let t=`${rf.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,of.hash)(t)}(e):(0,of.hash)(tf.default.cwd());return ef.resolve(ff.HVIGOR_USER_HOME,"project_caches",t)}(df),Df=function(){const e=ef.resolve(pf,rf.WORK_SPACE,rf.DEFAULT_PACKAGE_JSON);return Ql.existsSync(e)?(0,sf.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=ef.resolve(ff.HVIGOR_USER_HOME,rf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Ql.existsSync(e))(0,sf.parseJsonFile)(e)}(),!(0,lf.hasNpmPackInPaths)(rf.HVIGOR_ENGINE_PACKAGE_NAME,[ef.join(pf,rf.WORK_SPACE)])||(0,lf.offlinePluginConversion)(ff.HVIGOR_PROJECT_ROOT_DIR,df.hvigorVersion)!==Df.dependencies[rf.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(df),n=e(Df);if(t+1!==n)return!1;for(const e in null==df?void 0:df.dependencies)if(!(0,lf.hasNpmPackInPaths)(e,[ef.join(pf,rf.WORK_SPACE)])||!hf(e,df,Df))return!1;return!0}())try{const e=tf.default.hrtime();(0,af.checkNpmConifg)(),function(){(0,cf.logInfo)("Hvigor installing...");for(const e in df.dependencies)df.dependencies[e]&&(df.dependencies[e]=(0,lf.offlinePluginConversion)(ff.HVIGOR_PROJECT_ROOT_DIR,df.dependencies[e]));const e={dependencies:{...df.dependencies}};e.dependencies[rf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,lf.offlinePluginConversion)(ff.HVIGOR_PROJECT_ROOT_DIR,df.hvigorVersion);const t=ef.join(pf,rf.WORK_SPACE);try{Ql.mkdirSync(t,{recursive:!0});const n=ef.resolve(t,rf.DEFAULT_PACKAGE_JSON);Ql.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cf.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",ff.HVIGOR_PNPM_STORE_PATH],t={cwd:ef.join(pf,rf.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,lf.executeCommand)(ff.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,uf.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:ef.join(pf,rf.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,lf.executeCommand)(ff.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cf.logInfo)("Hvigor install success.")}();const t=tf.default.hrtime(e);nf.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=ef.join(pf,rf.WORK_SPACE);if((0,cf.logInfo)("Hvigor cleaning..."),!Ql.existsSync(e))return;const t=Ql.readdirSync(e);if(!t||0===t.length)return;const n=ef.resolve(pf,"node_modules","@ohos","hvigor","bin","hvigor.js");Ql.existsSync(n)&&(0,lf.executeCommand)(tf.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Ql.rmSync(ef.resolve(e,t),{recursive:!0})}))}catch(t){(0,cf.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return pf},function(){js.environmentHandler(),js.isPnpmInstalled()||(js.checkNpmConifg(),js.executeInstallPnpm());const t=Xl();P(e.join(t,S))}(); \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/ohos/hvigorw b/packages/camera/camera_ohos/example/ohos/hvigorw deleted file mode 100755 index 96ebdc7b26345d9aab53851b004dc3e4f860e33d..0000000000000000000000000000000000000000 --- a/packages/camera/camera_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/camera/camera_ohos/example/ohos/hvigorw.bat b/packages/camera/camera_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 688d3ed64e4f114c093165141e66a8b8cf3485ca..0000000000000000000000000000000000000000 --- a/packages/camera/camera_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -@rem Copyright (c) 2024 Huawei Device Co., Ltd. -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/camera/camera_ohos/example/ohos/oh-package.json5 b/packages/camera/camera_ohos/example/ohos/oh-package.json5 index e585e0e793f17b41162cf8a1244974da50b9e69e..4a28d3a1bb9c6631e48c6eab667f78e30f5ad08c 100644 --- a/packages/camera/camera_ohos/example/ohos/oh-package.json5 +++ b/packages/camera/camera_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", @@ -12,6 +13,11 @@ "@ohos/hypium": "1.0.6" }, "overrides": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har", + "integration_test": "file:./har/integration_test.har", + "camera_ohos": "file:./har/camera_ohos.har", + "path_provider_ohos": "file:./har/path_provider_ohos.har", + "video_player_ohos": "file:./har/video_player_ohos.har", + "@ohos/flutter_module": "file:./entry" } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/lib/src/type_conversion.dart b/packages/camera/camera_ohos/lib/src/type_conversion.dart index 9b5651451491750dcf2a007aa736cbdda6b9d424..8267637e96472c74370cdf319f9e4217246b64d7 100644 --- a/packages/camera/camera_ohos/lib/src/type_conversion.dart +++ b/packages/camera/camera_ohos/lib/src/type_conversion.dart @@ -13,13 +13,14 @@ CameraImageData cameraImageFromPlatformData(Map data) { format: _cameraImageFormatFromPlatformData(data['format']), height: data['height'] as int, width: data['width'] as int, - lensAperture: data['lensAperture'] as double?, + lensAperture: double.parse(data['lensAperture'].toString()), sensorExposureTime: data['sensorExposureTime'] as int?, - sensorSensitivity: data['sensorSensitivity'] as double?, + sensorSensitivity: double.parse(data['sensorSensitivity'].toString()), planes: List.unmodifiable( (data['planes'] as List).map( - (dynamic planeData) => _cameraImagePlaneFromPlatformData( - planeData as Map)))); + (dynamic planeData) => + _cameraImagePlaneFromPlatformData( + planeData as Map)))); } CameraImageFormat _cameraImageFormatFromPlatformData(dynamic data) { diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets index 55b102adc393560b46304a4a79fd7f1eb13bc965..909904bde45104f75cb611951c4518fce313eac6 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets @@ -38,7 +38,6 @@ import { ImageStreamReader } from './media/ImageStreamReader'; import { BusinessError } from '@kit.BasicServicesKit'; import { CameraState } from './CameraState'; import { AutoFocusFeature } from './features/autofocus/AutoFocusFeature'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; import fileIO from '@ohos.fileio'; import { DeviceOrientationManager } from './features/sensororientation/DeviceOrientationManager'; import { Point } from './features/Point'; @@ -72,7 +71,6 @@ export class Camera implements CameraCaptureStateListener { cameraFeatures: CameraFeatures; private imageFormatGroup: string | null = null; private videoRenderer: VideoRenderer | null = null; - // private initialCameraFacing: number; private flutterTexture: SurfaceTextureEntry; private resolutionPreset: ResolutionPreset; private enableAudio: boolean; @@ -82,20 +80,12 @@ export class Camera implements CameraCaptureStateListener { private cameraFeatureFactory: CameraFeatureFactory; private ability: Ability; private cameraCaptureCallback: CameraCaptureCallback; - // backgroundHandler: Function; - // private backgroundHandlerThread: Function; private cameraDevice: camera.CameraDevice | null = null; private cameraInput: camera.CameraInput | null = null; - // captureSession: CameraCaptureSession; private imageReceiver: image.ImageReceiver | null = null; imageStreamReader: ImageStreamReader | null = null; private previewOutput: camera.PreviewOutput | null = null; - // previewRequestBuilder: CaptureRequest.Builder; - // private mediaRecorder: MediaRecorder; - // recordingVideo: boolean; - /** True when the preview is paused. */ - private pausedPreview: boolean = false; - // private captureFile: File; + private pausedPreview: boolean = false; // 暂停预览 private captureTimeouts: CaptureTimeoutsWrapper; private captureProps: CameraCaptureProperties; private cameraManager: camera.CameraManager; @@ -105,26 +95,27 @@ export class Camera implements CameraCaptureStateListener { private captureFile: fs.File | null = null; private cameraOutputCapability: camera.CameraOutputCapability | null = null; private initialCameraFacing: number = 0; - private session: camera.PhotoSession | camera.VideoSession | null = null; - private videoSession: camera.VideoSession | null = null; + private photoSession: camera.PhotoSession | null = null; // 拍照模式 + private videoSession: camera.VideoSession | null = null; // 视频模式 private cameras: Array | null = null; private photoOutPut: camera.PhotoOutput | null = null; private fd: number = -1; - private isVideoMode: boolean = false; + private isVideoMode: boolean = false; // 视频模式 private aVRecorderProfile: media.AVRecorderProfile = { audioChannels: 2, audioCodec: media.CodecMimeType.AUDIO_AAC, audioBitrate: 48000, audioSampleRate: 48000, fileFormat: media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 - videoBitrate: 100000, // 视频比特率 - videoCodec: media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 - videoFrameWidth: 640, // 视频分辨率的宽 - videoFrameHeight: 480, // 视频分辨率的高 + videoBitrate: 100000000, // 视频比特率 + videoCodec: media.CodecMimeType.VIDEO_AVC, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth: 1920, // 视频分辨率的宽 + videoFrameHeight: 1080, // 视频分辨率的高 videoFrameRate: 30 // 视频帧率 }; private phAccessHelper: photoAccessHelper.PhotoAccessHelper; private videoPath: string | undefined = undefined; + private videoId: string | undefined = undefined; constructor( ability: UIAbility, @@ -158,7 +149,6 @@ export class Camera implements CameraCaptureStateListener { this.cameraCaptureCallback = CameraCaptureCallback.create(this, this.captureTimeouts, this.captureProps); this.phAccessHelper = photoAccessHelper.getPhotoAccessHelper(getContext(this)); - // startBackgroundThread(); } @@ -168,6 +158,11 @@ export class Camera implements CameraCaptureStateListener { public onPrecapture(): void { } + // 获取当前场景(拍照模式、视频模式)的Session实例 + getCurSession(): camera.PhotoSession | camera.VideoSession { + return this.isVideoMode ? this.videoSession! : this.photoSession!; + } + public async open(imageFormatGroup: string | null): Promise { this.imageFormatGroup = imageFormatGroup; const resolutionFeature: ResolutionFeature = this.cameraFeatures.getResolution(); @@ -241,7 +236,6 @@ export class Camera implements CameraCaptureStateListener { return this.cameraFeatures?.getSensorOrientation().getDeviceOrientationManager(); } - setFocusPoint(result: MethodResult, point: Point) { const focusPointFeature: FocusPointFeature = this.cameraFeatures.getFocusPoint(); focusPointFeature.setValue(point); @@ -249,7 +243,7 @@ export class Camera implements CameraCaptureStateListener { const focusPoint: camera.Point | null = (point.x == null || point.y == null) ? null : { x: point.x, y: point.y }; try { - this.session!.setFocusPoint(focusPoint); + this.getCurSession().setFocusPoint(focusPoint); result.success(null); } catch (error) { result.error("setFocusPointFailed", "Could not set focus point.", null); @@ -260,7 +254,8 @@ export class Camera implements CameraCaptureStateListener { let nowFocusMode: camera.FocusMode = camera.FocusMode.FOCUS_MODE_AUTO try { - nowFocusMode = this.session!.getFocusMode() + // 获取当前对焦模式 + nowFocusMode = this.getCurSession().getFocusMode(); if (nowFocusMode == camera.FocusMode.FOCUS_MODE_MANUAL) { nowFocusMode = camera.FocusMode.FOCUS_MODE_AUTO } else if (nowFocusMode == camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) { @@ -277,40 +272,21 @@ export class Camera implements CameraCaptureStateListener { const autoFocusFeature: AutoFocusFeature = this.cameraFeatures.getAutoFocus(); autoFocusFeature.setValue(newMode); - if (!this.pausedPreview) { - switch (newMode) { - case camera.FocusMode.FOCUS_MODE_LOCKED: - if (this.session == null) { - console.info("[unlockAutoFocus] captureSession null, returning"); - return; - } - this.lockAutoFocus(); - - // todo: - - break; - case camera.FocusMode.FOCUS_MODE_AUTO: - this.unlockAutoFocus(); - break; - } - } - try { - this.session!.setFocusMode(newMode) + this.getCurSession().setFocusMode(newMode) result?.success(null) } catch (error) { - result?.error("setFocusModeFailed", "Could not set focus point", null) + result?.success(null) } - } + // 设置曝光补偿 setExposureOffset(result: MethodResult, offset: number) { const exposureOffsetFeature: ExposureOffsetFeature = this.cameraFeatures.getExposureOffset(); - exposureOffsetFeature.setValue(offset, this.session!); + exposureOffsetFeature.setValue(offset, this.photoSession!); - // todo: 待完善,ohos文档需要判断补偿值是否在支持范围 try { - this.session!.setExposureBias(offset); + this.getCurSession().setExposureBias(offset); result.success(exposureOffsetFeature.getValue()); } catch (error) { result.error("setExposureOffsetFailed", "Could not set exposure offset.", null); @@ -318,26 +294,27 @@ export class Camera implements CameraCaptureStateListener { } public getMaxZoomLevel(): number { - return this.cameraFeatures.getZoomLevel().getMaximumZoomLevel(this.session!); + return this.cameraFeatures.getZoomLevel().getMaximumZoomLevel(this.getCurSession()); } public getMinZoomLevel(): number { - return this.cameraFeatures.getZoomLevel().getMinimumZoomLevel(this.session!); + return this.cameraFeatures.getZoomLevel().getMinimumZoomLevel(this.getCurSession()); } public setZoomLevel(result: MethodResult, zoom: number): void { const zoomLevel: ZoomLevelFeature = this.cameraFeatures.getZoomLevel(); - let maxZoom: number = zoomLevel.getMaximumZoomLevel(this.session!); - let minZoom: number = zoomLevel.getMinimumZoomLevel(this.session!); + let maxZoom: number = zoomLevel.getMaximumZoomLevel(this.getCurSession()); + let minZoom: number = zoomLevel.getMinimumZoomLevel(this.getCurSession()); if (zoom > maxZoom || zoom < minZoom) { - result.error("ZOOM_ERROR", "Zoom level out of bounds (zoom level should be between " + minZoom + " and " + maxZoom + ").", null); + result.error("ZOOM_ERROR", + "Zoom level out of bounds (zoom level should be between " + minZoom + " and " + maxZoom + ").", null); return; } zoomLevel.setValue(zoom); try { - this.session!.setZoomRatio(zoom); + this.getCurSession().setZoomRatio(zoom); } catch (error) { result.error("setZoomLevelFailed", "Could not set exposure point.", null); } @@ -351,16 +328,29 @@ export class Camera implements CameraCaptureStateListener { this.cameraFeatures.getSensorOrientation().unlockCaptureOrientation(); } - public pausePreview(): void { - // todo: + // 暂停预览 + public async pausePreview(result: MethodResult) { + try { + await this.previewOutput?.stop(); + } catch (e) { + } this.pausedPreview = true; + result.success(null); } - public resumePreview(): void { - // todo: + // 恢复预览 + public async resumePreview(result: MethodResult) { + try { + if (this.pausedPreview) { + await this.previewOutput?.start(); + } + } catch (e) { + } this.pausedPreview = false; + result.success(null); } + // 设置曝光区域中心点 setExposurePoint(result: MethodResult, point: Point) { const exposurePointFeature: ExposurePointFeature = this.cameraFeatures.getExposurePoint(); exposurePointFeature.setValue(point); @@ -369,7 +359,7 @@ export class Camera implements CameraCaptureStateListener { = (point.x == null || point.y == null) ? null : { x: point.x, y: point.y }; try { - this.session!.setMeteringPoint(exposurePoint); + this.getCurSession().setMeteringPoint(exposurePoint); result.success(null); } catch (error) { result.error("setExposurePointFailed", "Could not set exposure point.", null); @@ -379,7 +369,7 @@ export class Camera implements CameraCaptureStateListener { // 设置曝光模式。 // 进行设置之前,需要先检查设备是否支持指定的曝光模式,可使用方法isExposureModeSupported。 setExposureMode(result: MethodResult, newMode: camera.ExposureMode) { - // if (CameraUtils.isExposureModeSupported(this.session!, newMode)) { + // if (CameraUtils.isExposureModeSupported(this.photoSession!, newMode)) { // result.error("setExposureModeFailed", "The exposure mode is unsupported.", null); // return; // } @@ -400,10 +390,10 @@ export class Camera implements CameraCaptureStateListener { exposureLockFeature.setValue(newMode); try { - this.session!.setExposureMode(newMode); + this.getCurSession().setExposureMode(newMode); result.success(null) } catch (error) { - result.error("setExposureModeFailed", "The setExposureMode call failed", null); + result.success(null) } } @@ -412,12 +402,12 @@ export class Camera implements CameraCaptureStateListener { // 设备是否支持闪光灯,可使用方法hasFlash。 // 设备是否支持指定的闪光灯模式,可使用方法isFlashModeSupported。 setFlashMode(result: MethodResult, newMode: camera.FlashMode) { - if (!CameraUtils.hasFlash(this.session!)) { + if (!CameraUtils.hasFlash(this.getCurSession())) { result.error("setFlashModeFailed", "The camera device does not have flash.", null); return; } - if (!CameraUtils.isFlashModeSupported(this.session!, newMode)) { + if (!CameraUtils.isFlashModeSupported(this.getCurSession(), newMode)) { result.error("setFlashModeFailed", " The flash mode is unsupported.", null); return; } @@ -427,7 +417,7 @@ export class Camera implements CameraCaptureStateListener { flashFeature.setValue(newMode); try { - this.session!.setFlashMode(newMode); + this.getCurSession().setFlashMode(newMode); result.success(null); } catch (error) { result.error("setFlashModeFailed", "The setFlashMode call failed", null); @@ -435,15 +425,15 @@ export class Camera implements CameraCaptureStateListener { } getMinExposureOffset() { - return this.cameraFeatures.getExposureOffset().getMinExposureOffset(this.session!); + return this.cameraFeatures.getExposureOffset().getMinExposureOffset(this.getCurSession()); } getMaxExposureOffset() { - return this.cameraFeatures.getExposureOffset().getMaxExposureOffset(this.session!); + return this.cameraFeatures.getExposureOffset().getMaxExposureOffset(this.getCurSession()); } getExposureOffsetStepSize() { - return this.cameraFeatures.getExposureOffset().getExposureOffsetStepSize(this.session!); + return this.cameraFeatures.getExposureOffset().getExposureOffsetStepSize(this.getCurSession()); } async takePicture(result: MethodResult) { @@ -471,7 +461,6 @@ export class Camera implements CameraCaptureStateListener { return; } this.savePicture(buffer, _image).then((path: string) => { - this.cameraCaptureCallback.setCameraState(CameraState.STATE_PREVIEW); result.success(path); }); }) @@ -496,7 +485,7 @@ export class Camera implements CameraCaptureStateListener { } async lockAutoFocus(): Promise { - if (this.session == null) { + if (this.photoSession == null) { console.error(TAG, "[unlockAutoFocus] captureSession null, returning"); return; } @@ -517,6 +506,8 @@ export class Camera implements CameraCaptureStateListener { // 触发拍照 this.photoOutPut?.capture(settings, (err: BusinessError) => { + // 拍照完成,更新CameraState + this.cameraCaptureCallback.setCameraState(CameraState.STATE_PREVIEW); if (err) { console.error(`Failed to capture the photo ${err.code}`); this.dartMessenger.sendCameraErrorEvent(err.message); @@ -526,9 +517,8 @@ export class Camera implements CameraCaptureStateListener { }); } - // todo: unlockAutoFocus(): void { - if (this.session == null) { + if (this.photoSession == null) { console.info("[unlockAutoFocus] captureSession null, returning"); return; } @@ -547,7 +537,6 @@ export class Camera implements CameraCaptureStateListener { this.setStreamHandler(imageStreamChannel); } - // todo 初始摄像头朝向 ,待实现 this.initialCameraFacing = this.cameraProperties.getLensFacing(); this.recordingVideo = true; @@ -562,7 +551,6 @@ export class Camera implements CameraCaptureStateListener { } } - async stopVideoRecording(result: MethodResult) { if (!this.recordingVideo) { @@ -584,6 +572,8 @@ export class Camera implements CameraCaptureStateListener { fs.close(this.captureFile); result.success(this.videoPath); this.captureFile = null; + this.isVideoMode = false; + this.open(this.imageFormatGroup); }); } } catch (e) { @@ -594,14 +584,47 @@ export class Camera implements CameraCaptureStateListener { startPreview() { if (this.recordingVideo) { - this.startPreviewWithVideoRendererStream(); + this.startPreviewWithVideo(); + } else { + this.startPreviewWithPhoto(); + } + } + + // 开启录像预览 + async startPreviewWithVideo() { + this.cameraOutputCapability = + CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_VIDEO, + this.cameraManager); + let previewProfile = this.cameraOutputCapability?.previewProfiles[0]; + this.previewOutput = this.cameraManager.createPreviewOutput(previewProfile, this.flutterTexture.getSurfaceId() + .toString()); + let videoProfilesArray: Array = this.cameraOutputCapability?.videoProfiles; + let videoProfile: undefined | camera.VideoProfile = videoProfilesArray.find((profile: camera.VideoProfile) => { + return profile.size.width === this.aVRecorderProfile.videoFrameWidth && + profile.size.height === this.aVRecorderProfile.videoFrameHeight; + }) + this.videoOutput = this.cameraManager.createVideoOutput(videoProfile, this.videoId); + this.videoSession = this.cameraManager.createSession(camera.SceneMode.NORMAL_VIDEO) as camera.VideoSession; + this.videoSession?.beginConfig(); + this.videoSession?.addInput(this.cameraInput); + this.videoSession?.addOutput(this.previewOutput); + this.videoSession?.addOutput(this.videoOutput); + await this.videoSession?.commitConfig(); + await this.videoSession?.start(); + if (this.pausedPreview) { + this.previewOutput.stop(); + } + if (this.recordingVideo && this.avRecorder != undefined && this.avRecorder.state === 'paused') { + // 录像中且暂停状态 } else { - this.startRegularPreview(); + await this.videoOutput.start(); } } - async startRegularPreview() { - this.cameraOutputCapability = CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_PHOTO, this.cameraManager) + // 开启拍照预览 + async startPreviewWithPhoto() { + this.cameraOutputCapability = + CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_PHOTO, this.cameraManager) let captureSize: camera.Size = this.cameraFeatures.getResolution().getCaptureSize(); let previewProfile = this.cameraOutputCapability.previewProfiles.find((profile: camera.Profile) => { @@ -615,43 +638,19 @@ export class Camera implements CameraCaptureStateListener { let rSurfaceId = await this.imageReceiver!.getReceivingSurfaceId(); this.photoOutPut = this.cameraManager.createPhotoOutput(photoProfile, rSurfaceId); - this.session = this.cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; - this.session.beginConfig(); - this.session.addInput(this.cameraInput); - this.session.addOutput(this.previewOutput); - this.session.addOutput(this.photoOutPut); - await this.session.commitConfig(); - await this.session.start(); - } - - - startPreviewWithVideoRendererStream() { - // todo ohos无法实现videoRenderer,此方法是否需要 - if (this.videoRenderer == null) return; - - const lockedOrientation: DeviceOrientation | null = - this.cameraFeatures.getSensorOrientation().getLockedCaptureOrientation(); - let orientationManager: DeviceOrientationManager = - this.cameraFeatures.getSensorOrientation().getDeviceOrientationManager(); - - let rotation: number = 0; - if (orientationManager != null) { - rotation = - lockedOrientation == null - ? orientationManager.getVideoOrientation() - : orientationManager.getVideoOrientation(lockedOrientation); - } - - if (this.cameraProperties.getLensFacing() != this.initialCameraFacing) { - rotation = (rotation + 180) % 360; + this.photoSession = this.cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; + this.photoSession.beginConfig(); + this.photoSession.addInput(this.cameraInput); + this.photoSession.addOutput(this.previewOutput); + this.photoSession.addOutput(this.photoOutPut); + await this.photoSession.commitConfig(); + await this.photoSession.start(); + if (this.pausedPreview) { + await this.previewOutput.stop(); } - this.videoRenderer.setRotation(rotation); - - this.createCaptureSession(); } async pauseVideoRecording(result: MethodResult) { - if (!this.recordingVideo) { result.success(null); return; @@ -679,7 +678,7 @@ export class Camera implements CameraCaptureStateListener { try { if (this.avRecorder != undefined && this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 await this.videoOutput?.start(); // 启动相机出流 - await this.avRecorder.resume(); + await this.avRecorder?.resume(); } else { result.error( "videoRecordingFailed", "avRecorder state is not paused", null); @@ -694,50 +693,65 @@ export class Camera implements CameraCaptureStateListener { } startPreviewWithImageStream(imageStreamChannel: EventChannel) { - // todo: this.setStreamHandler(imageStreamChannel); - this.startCapture(false, true); - Log.i(TAG, "startPreviewWithImageStream"); - } - - async prepareMediaRecorder(cameraManager: camera.CameraManager, - cameraOutputCapability: camera.CameraOutputCapability, url: string) { - Log.i(TAG, "prepareMediaRecorder"); - if (this.avRecorder != null) { - this.avRecorder.release(); - } - - - } - - closeRenderer() { - - if (this.videoRenderer != null) { - this.videoRenderer.close(); - this.videoRenderer = null; - } - + this.startImageStream(); } - - async startCapture(record: boolean, stream: boolean) { - + async startImageStream() { try { - if (this.session != undefined && !this.isVideoMode) { - await this.session?.stop() - this.isVideoMode = true; + if (this.photoSession != null) { + await this.photoSession?.stop() } } catch (e) { - Log.d(TAG, "session stop error") } try { - if (this.videoSession != undefined) { + if (this.videoSession != null) { await this.videoSession?.stop(); } } catch (e) { - Log.d(TAG, "videoSession stop error") } + let profiles = + CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_PHOTO, this.cameraManager) + let previewProfiles: Array = profiles.previewProfiles; + let captureSize: camera.Size = this.cameraFeatures.getResolution().getCaptureSize(); + let previewProfilesObj = previewProfiles.find((profile: camera.Profile) => { + return profile.size.width === captureSize.width && profile.size.height === captureSize.height; + }); + let previewProfilesObj2 = previewProfiles.find((profile: camera.Profile) => { + return profile.size.width === captureSize.width && profile.size.height === captureSize.height; + }); + + this.previewOutput = + this.cameraManager.createPreviewOutput(previewProfilesObj, this.flutterTexture.getSurfaceId().toString()); + let imageReceiverSurfaceId: string = await this.imageStreamReader!.getReceivingSurfaceId(); + let previewOutput2: camera.PreviewOutput = + this.cameraManager.createPreviewOutput(previewProfilesObj2, imageReceiverSurfaceId); + + this.photoSession = this.cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; + this.photoSession.beginConfig(); + await this.cameraInput?.open(); + this.photoSession.addInput(this.cameraInput); + this.photoSession.addOutput(this.previewOutput); + this.photoSession.addOutput(previewOutput2); + await this.photoSession.commitConfig(); + await this.photoSession.start(); + } + + async prepareMediaRecorder(cameraManager: camera.CameraManager, + cameraOutputCapability: camera.CameraOutputCapability, url: string) { + Log.i(TAG, "prepareMediaRecorder"); + if (this.avRecorder != null) { + this.avRecorder.release(); + } + } + + async startCapture(record: boolean, stream: boolean) { + if (!this.pausedPreview) { + this.getCurSession().stop(); + } + this.photoSession = null; + this.isVideoMode = true; media.createAVRecorder(async (error, recorder) => { if (recorder != null) { this.avRecorder = recorder; @@ -751,19 +765,22 @@ export class Camera implements CameraCaptureStateListener { profile: this.aVRecorderProfile, url: `fd://${fd}`, rotation: 90, // 90°为默认竖屏显示角度,如果由于设备原因或应用期望以其他方式显示等原因,请根据实际情况调整该参数 - location: { latitude: 30, longitude: 130 } }; - await this.avRecorder.prepare(aVRecorderConfig); - let videoId = await this.avRecorder.getInputSurface(); - this.cameraOutputCapability = CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_VIDEO, this.cameraManager); + await this.avRecorder.prepare(aVRecorderConfig).then(async () => { + this.videoId = await this.avRecorder?.getInputSurface(); + }); + this.cameraOutputCapability = + CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_VIDEO, + this.cameraManager); let previewProfile = this.cameraOutputCapability?.previewProfiles[0]; this.previewOutput = this.cameraManager.createPreviewOutput(previewProfile, this.flutterTexture.getSurfaceId() .toString()); let videoProfilesArray: Array = this.cameraOutputCapability?.videoProfiles; let videoProfile: undefined | camera.VideoProfile = videoProfilesArray.find((profile: camera.VideoProfile) => { - return profile.size.width === this.aVRecorderProfile.videoFrameWidth && profile.size.height === this.aVRecorderProfile.videoFrameHeight; + return profile.size.width === this.aVRecorderProfile.videoFrameWidth && + profile.size.height === this.aVRecorderProfile.videoFrameHeight; }) - this.videoOutput = this.cameraManager.createVideoOutput(videoProfile, videoId); + this.videoOutput = this.cameraManager.createVideoOutput(videoProfile, this.videoId); this.videoSession = this.cameraManager.createSession(camera.SceneMode.NORMAL_VIDEO) as camera.VideoSession; this.videoSession?.beginConfig(); await this.cameraInput?.open(); @@ -774,58 +791,22 @@ export class Camera implements CameraCaptureStateListener { await this.videoSession?.start(); await this.videoOutput.start(); try { + if (this.pausedPreview) { + await this.previewOutput.stop(); + } if (record) { await this.avRecorder.start(); } } catch (e) { Log.d(TAG, "startAVRecorder error") } - } else { Log.e(TAG, "startVideo createAVRecorder fail :" + error.message); } }); } - // todo 此方法是否需要,ohos已经已经在拍照前创建了captureSession - createCaptureSession() { - // Close any existing capture session. - this.session = null; - } - - - public stopBackgroundThread() { - // todo: - } - - async prepareRecording(result: MethodResult): Promise { - //let filePath + '/' + await systemDateTime.getCurrentTime() + '.mp4'; - //let filePath = this.applicationContext.filesDir + '/' + '325.mp4'; - //let url: string; - try { - /* let phAccessHelper: photoAccessHelper.PhotoAccessHelper - = photoAccessHelper.getPhotoAccessHelper(getContext(this)); - let options: photoAccessHelper.CreateOptions = { title: Date.now().toString() }; - let videoUri: string = await phAccessHelper.createAsset(PhotoAccessHelper.PhotoType.IMAGE, 'mp4', options); - // 生成临时文件 - this.captureFile = fs.openSync(videoUri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); - // this.captureFile = file - this.fd = this.captureFile.fd;*/ - } catch (e) { - result.error("cannotCreateFile", e.getMessage(), null); - return; - } - /* try { - this.cameraManager = CameraUtils.getCameraManager(this.applicationContext); - this.cameraOutputCapability = CameraUtils.getSupportedOutputCapability(this.cameraManager) - } catch (e) { - this.recordingVideo = false; - this.captureFile = null; - result.error("videoRecordingFailed", e.getMessage(), null); - return; - }*/ - this.cameraFeatures.setAutoFocus(this.cameraFeatureFactory.createAutoFocusFeature(this.cameraProperties, true)); } @@ -852,19 +833,9 @@ export class Camera implements CameraCaptureStateListener { this.imageStreamReader.subscribeListener(this.captureProps, imageStreamSink); } - closeCaptureSession(): void { - if (this.session != null) { - this.session.stop(); - this.session.release(); - this.session = null; - } - } - + // 关闭 public close(): void { - console.info(TAG, 'close'); - this.stopAndReleaseCamera(); - this.imageReceiver?.release(); this.imageReceiver = null; @@ -872,29 +843,47 @@ export class Camera implements CameraCaptureStateListener { this.avRecorder?.release(); this.avRecorder = null; - this.stopBackgroundThread(); - this.cameraDevice = null; - this.closeCaptureSession(); + this.releaseSession(); this.dartMessenger.sendCameraClosingEvent(); } + // 关闭摄像头输入流 private stopAndReleaseCamera() { - if (this.cameraDevice) { - // this.cameraDevice.close(); - this.cameraDevice = null; - this.session = null; - } else { - this.closeCaptureSession(); + if (this.cameraInput != null) { + try { + this.photoSession?.removeInput(this.cameraInput); + } catch (e) { + } + try { + this.videoSession?.removeInput(this.cameraInput); + } catch (e) { + } + + this.cameraInput.close(); + this.cameraInput = null; + } + if (this.cameraDevice != null) { this.cameraDevice = null; - this.closeCaptureSession(); - this.dartMessenger.sendCameraClosingEvent(); + this.photoSession = null; + this.videoSession = null; + } else { + this.stopSession(); } } - private prepareVideoRenderer() { - // todo: + // 停止Session + async stopSession() { + + if (this.photoSession != null) { + await this.photoSession.stop(); + this.photoSession = null; + } + if (this.videoSession != null) { + await this.videoSession.stop(); + this.videoSession = null; + } } public setDescriptionWhileRecording(result: MethodResult, properties: CameraProperties) { @@ -904,7 +893,6 @@ export class Camera implements CameraCaptureStateListener { } this.stopAndReleaseCamera(); - this.prepareVideoRenderer(); this.cameraProperties = properties; this.cameraFeatures = @@ -928,8 +916,22 @@ export class Camera implements CameraCaptureStateListener { this.getDeviceOrientationManager().stop(); } + // 释放Session + private async releaseSession() { + if (this.photoSession != null) { + await this.photoSession.stop(); + await this.photoSession.release(); + this.photoSession = null; + } + if (this.videoSession != null) { + await this.videoSession.stop(); + await this.videoSession.release(); + this.videoSession = null; + } + } + private async releaseCameraInput() { - if (this.cameraInput) { + if (this.cameraInput != null) { try { await this.cameraInput.close(); this.cameraInput = null; @@ -939,7 +941,7 @@ export class Camera implements CameraCaptureStateListener { } private async releasePreviewOutput() { - if (this.previewOutput) { + if (this.previewOutput != null) { try { await this.previewOutput.release(); this.previewOutput = null; @@ -949,7 +951,7 @@ export class Camera implements CameraCaptureStateListener { } private async releasePhotoOutput() { - if (this.photoOutPut) { + if (this.photoOutPut != null) { try { await this.photoOutPut.release(); this.photoOutPut = null; @@ -958,20 +960,10 @@ export class Camera implements CameraCaptureStateListener { } } - private async releaseSession() { - if (this.session) { - try { - await this.session.stop(); - this.session.release(); - this.session = null; - } catch (e) { - } - } - } - private async releaseVideoOutput() { - if (this.videoOutput) { + if (this.videoOutput != null) { try { + await this.videoOutput.stop(); await this.videoOutput.release(); this.videoOutput = null; } catch (e) { @@ -979,11 +971,12 @@ export class Camera implements CameraCaptureStateListener { } } + // 释放Camera async releaseCamera() { - await this.releaseSession(); await this.releaseCameraInput(); + await this.releaseSession(); await this.releasePreviewOutput(); await this.releaseVideoOutput(); await this.releasePhotoOutput(); } -} +} \ No newline at end of file diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraPermissions.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraPermissions.ets index b9e1871482ec00fe660de96df84c0ac43802d9c1..0a86311710901f9656216b940f2aae2053e0e623 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraPermissions.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraPermissions.ets @@ -21,11 +21,7 @@ type ResultCallback = (errCode: string | null, errDesc: string | null) => void; const cameraPermission: Array = ['ohos.permission.CAMERA', - 'ohos.permission.MICROPHONE', - 'ohos.permission.READ_IMAGEVIDEO', - 'ohos.permission.WRITE_IMAGEVIDEO', - 'ohos.permission.READ_MEDIA', - 'ohos.permission.WRITE_MEDIA']; + 'ohos.permission.MICROPHONE']; const audioPermission: Array = ['ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO']; diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets index 06909715fc195e8aaa7981e339def4ae42b6af35..2bf6392f046feb7ff62e54814edf1bff3ce1fb00 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets @@ -16,7 +16,6 @@ import camera from '@ohos.multimedia.camera'; import { BusinessError } from '@ohos.base'; import { HashMap } from '@kit.ArkTS'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; import DateTimeUtil from './utlis/DateTimeUtil'; import { DeviceOrientation } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/systemchannels/PlatformChannel'; @@ -43,10 +42,8 @@ const CameraDeviceMap = (cameraManager: camera.CameraManager): HashMap { - let dateTimeUtil: DateTimeUtil = new DateTimeUtil(); - let info: FileInfo = CameraUtils.getInfoFromMediaType(mediaType); - let name: string = `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}`; - let displayName: string = `${info.prefix}${name}${info.suffix}`; - let publicPath: string = await CameraUtils.mediaLibraryTest.getPublicDirectory( - info.directory - ); - let fileAsset: mediaLibrary.FileAsset = await CameraUtils.mediaLibraryTest.createAsset( - mediaType, - displayName, - publicPath - ); - return fileAsset; - } - - static getInfoFromMediaType(mediaType: mediaLibrary.MediaType): FileInfo { - let fileInfo: FileInfo = { - prefix: '', - suffix: '', - directory: 0 - }; - switch (mediaType) { - case mediaLibrary.MediaType.FILE: - fileInfo.prefix = 'FILE_'; - fileInfo.suffix = '.txt'; - fileInfo.directory = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - break; - case mediaLibrary.MediaType.IMAGE: - fileInfo.prefix = 'IMG_'; - fileInfo.suffix = '.jpg'; - fileInfo.directory = mediaLibrary.DirectoryType.DIR_IMAGE; - break; - case mediaLibrary.MediaType.VIDEO: - fileInfo.prefix = 'VID_'; - fileInfo.suffix = '.mp4'; - fileInfo.directory = mediaLibrary.DirectoryType.DIR_VIDEO; - break; - case mediaLibrary.MediaType.AUDIO: - fileInfo.prefix = 'AUD_'; - fileInfo.suffix = '.wav'; - fileInfo.directory = mediaLibrary.DirectoryType.DIR_AUDIO; - break; - } - return fileInfo; - } - //检测是否有闪光灯 public static hasFlash(captureSession: camera.PhotoSession | camera.VideoSession): boolean { let status: boolean = false; @@ -247,7 +197,7 @@ export class CameraUtils { // 获取支持的最小变焦范围 public static getMinZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number { - let minZoomRatio: number = -1; + let minZoomRatio: number = -10; try { let zoomRatioRange: Array = captureSession.getZoomRatioRange(); minZoomRatio = Math.min(...zoomRatioRange); @@ -261,7 +211,7 @@ export class CameraUtils { // 获取支持的最大变焦范围 public static getMaxZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number { - let maxZoomRatio: number = 1; + let maxZoomRatio: number = 10; try { let zoomRatioRange: Array = captureSession.getZoomRatioRange(); maxZoomRatio = Math.max(...zoomRatioRange); @@ -288,7 +238,7 @@ export class CameraUtils { // 查询最小曝光补偿值 public static getMinExposureBias(captureSession: camera.PhotoSession | camera.VideoSession): number { - let minExposure: number = -1; + let minExposure: number = -10; try { let biasRangeArray = captureSession.getExposureBiasRange(); if (biasRangeArray.length > 1) { @@ -304,7 +254,7 @@ export class CameraUtils { // 查询最大曝光补偿值 public static getMaxExposureBias(captureSession: camera.PhotoSession | camera.VideoSession): number { - let maxExposure: number = 1; + let maxExposure: number = 10; try { let biasRangeArray = captureSession.getExposureBiasRange(); if (biasRangeArray.length > 1) { diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/MethodCallHandlerImpl.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/MethodCallHandlerImpl.ets index 0ffb8758cc67a8f4adec79f0b8e88360d4a7f847..732e2cd6e42c315bf385cd698883442d77af4c01 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/MethodCallHandlerImpl.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/MethodCallHandlerImpl.ets @@ -353,16 +353,18 @@ export class MethodCallHandlerImpl implements MethodCallHandler { } case 'pausePreview': { try { - this.camera!.pausePreview(); - result.success(null); + this.camera!.pausePreview(result); } catch (e) { this.handleException(e, result); } break; } case 'resumePreview': { - this.camera!.resumePreview(); - result.success(null); + try { + this.camera!.resumePreview(result); + } catch (e) { + this.handleException(e, result); + } } break; case 'setDescriptionWhileRecording': { diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/media/ImageStreamReader.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/media/ImageStreamReader.ets index 429e152c78a3cb007b9cfd6a3133bb1e61bd98bd..bf6890b0e3d89afe0163b28499bc5875985f2db6 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/media/ImageStreamReader.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/media/ImageStreamReader.ets @@ -18,8 +18,8 @@ import { CameraCaptureProperties } from '../types/CameraCaptureProperties'; import { ImageStreamReaderUtils } from './ImageStreamReaderUtils'; import { ArrayList, HashMap } from '@kit.ArkTS'; import { Size } from '@kit.ArkUI'; -import { EventSink, StreamHandler } from '@ohos/flutter_ohos/src/main/ets/plugin/common/EventChannel'; -import { ByteBuffer } from '@ohos/flutter_ohos'; +import { EventSink } from '@ohos/flutter_ohos/src/main/ets/plugin/common/EventChannel'; +import { BusinessError } from '@kit.BasicServicesKit'; export class ImageStreamReader { private readonly dartImageFormat: number; @@ -33,19 +33,15 @@ export class ImageStreamReader { this.imageStreamReaderUtils = new ImageStreamReaderUtils(); } - public onImageAvailable( + public async onImageAvailable( _image: image.Image, + imgComponent: image.Component, captureProps: CameraCaptureProperties, - imageStreamSink: EventSink): void { + imageStreamSink: EventSink) { try { let imageBuffer: HashMap = new HashMap(); - if(this.dartImageFormat == image.ImageFormat.YCBCR_422_SP) { - imageBuffer.set("planes", this.parsePlanesForYuvOrJpeg(_image)) - } else{ - imageBuffer.set("planes", this.parsePlanesForYuvOrJpeg(_image)) - } - + imageBuffer.set("planes", this.parsePlanes(_image, imgComponent)) imageBuffer.set('width', _image.size.width); imageBuffer.set('height', _image.size.height); imageBuffer.set('format', this.dartImageFormat); @@ -55,60 +51,55 @@ export class ImageStreamReader { imageBuffer.set('sensorSensitivity', sensorSensitivity == null ? null : sensorSensitivity); imageStreamSink.success(imageBuffer) - _image.release() + await _image.release() } catch (e) { imageStreamSink.error( "IllegalStateException", "Caught IllegalStateException: " + e.getMessage(), null) - _image.release() + await _image.release() } } - public parsePlanesForYuvOrJpeg(_image: image.Image): ArrayList> { + public parsePlanes( + _image: image.Image, + imgComponent: image.Component): ArrayList> { let planes: ArrayList> = new ArrayList(); - Object.values(image.ComponentType).forEach(async (value) => { - _image.getComponent(value as number).then((component: image.Component) => { - let planeBuffer: HashMap = new HashMap(); - - planeBuffer.set("bytesPerRow", component.rowStride); - planeBuffer.set("bytesPerPixel", component.pixelStride); - planeBuffer.set("bytes", component.byteBuffer); - - planes.add(planeBuffer) - }) - }) - return planes; - } - - public parsePlanesForYCBCR422SP(_image: image.Image): ArrayList> { - let planes: ArrayList> = new ArrayList(); - let imageBuffer: Array = new Array(); - Object.values(image.ComponentType).forEach(async (value) => { - _image.getComponent(value as number).then((component: image.Component) => { - imageBuffer.push(component.byteBuffer); - }) - }) - // let bytes: ByteBuffer = this.imageStreamReaderUtils.yuv420ThreePlanesToNv21(_image, _image.size.width, _image.size.height); let planeBuffer: HashMap = new HashMap(); - planeBuffer.set("bytesPerRow", _image.size.width); - planeBuffer.set("bytesPerPixel", 1); - // planeBuffer.set("bytes", bytes); - planeBuffer.set("bytes", imageBuffer); + planeBuffer.set("bytesPerRow", imgComponent.rowStride); + planeBuffer.set("bytesPerPixel", imgComponent.pixelStride); + planeBuffer.set("bytes", new Uint8Array(imgComponent.byteBuffer)); planes.add(planeBuffer); + return planes; } - // public getSurface(): Surface { - // return this.imageReceiver.getReceivingSurfaceId(); - // } + public getReceivingSurfaceId() { + return this.imageReceiver.getReceivingSurfaceId(); + } - public async subscribeListener(captureProps: CameraCaptureProperties, imageStreamSink: EventSink): Promise { - const _image: image.Image = await this.imageReceiver.readNextImage() - if(_image == null) return - this.onImageAvailable(_image, captureProps, imageStreamSink) + public async subscribeListener(captureProps: CameraCaptureProperties, imageStreamSink: EventSink) { + + this.imageReceiver.on('imageArrival', () => { + this.imageReceiver.readNextImage((err: BusinessError, nextImage: image.Image) => { + if (err || nextImage === undefined) { + console.error('readNextImage failed'); + return; + } + nextImage.getComponent(image.ComponentType.JPEG, (err: BusinessError, imgComponent: image.Component) => { + if (err || imgComponent === undefined) { + console.error('getComponent failed'); + } + if (imgComponent && imgComponent.byteBuffer as ArrayBuffer) { + this.onImageAvailable(nextImage, imgComponent, captureProps, imageStreamSink) + } else { + console.error('byteBuffer is null'); + } + }) + }) + }); } public removeListener(): void { diff --git a/packages/file_selector/file_selector_ohos/.gitignore b/packages/file_selector/file_selector_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..894df49349702b4499f23d1dbc7beec90c271b2f 100644 --- a/packages/file_selector/file_selector_ohos/.gitignore +++ b/packages/file_selector/file_selector_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/file_selector/file_selector_ohos/example/lib/open_text_page.dart b/packages/file_selector/file_selector_ohos/example/lib/open_text_page.dart index 8d21e4337cf63636c21aad42b69a1ec931fa1b9e..b0b40cab4e38de637c14533477becf3349fc08db 100644 --- a/packages/file_selector/file_selector_ohos/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_ohos/example/lib/open_text_page.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:convert'; import 'package:file_selector_platform_interface/file_selector_platform_interface.dart'; import 'package:flutter/material.dart'; @@ -24,7 +25,8 @@ class OpenTextPage extends StatelessWidget { return; } final String fileName = file.name; - final String fileContent = await file.readAsString(); + final bytes = await file.readAsBytes(); + final String fileContent = utf8.decode(bytes); if (context.mounted) { await showDialog( diff --git a/packages/file_selector/file_selector_ohos/example/ohos/build-profile.json5 b/packages/file_selector/file_selector_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/file_selector/file_selector_ohos/example/ohos/build-profile.json5 +++ b/packages/file_selector/file_selector_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/file_selector/file_selector_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/file_selector/file_selector_ohos/example/ohos/hvigorw b/packages/file_selector/file_selector_ohos/example/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/file_selector/file_selector_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/file_selector/file_selector_ohos/example/ohos/hvigorw.bat b/packages/file_selector/file_selector_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 5799f5498ae79096ba616bd383f7fe0523a90528..0000000000000000000000000000000000000000 --- a/packages/file_selector/file_selector_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/file_selector/file_selector_ohos/example/ohos/oh-package.json5 b/packages/file_selector/file_selector_ohos/example/ohos/oh-package.json5 index f086fa08cba1cc0c6e165cc413304fc4148a72ec..f7f25c568e44e26ca3f9b84951bf7e64c07f649a 100644 --- a/packages/file_selector/file_selector_ohos/example/ohos/oh-package.json5 +++ b/packages/file_selector/file_selector_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/file_selector/file_selector_ohos/example/pubspec.yaml b/packages/file_selector/file_selector_ohos/example/pubspec.yaml index 6d5118b988b539d25a351ce5cddd12a6f3a9e175..f6d2a8aead9d708effa47d6d76397d65169f5166 100644 --- a/packages/file_selector/file_selector_ohos/example/pubspec.yaml +++ b/packages/file_selector/file_selector_ohos/example/pubspec.yaml @@ -32,7 +32,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.19.6 <3.0.0' + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/image_picker/image_picker_ohos/.gitignore b/packages/image_picker/image_picker_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..894df49349702b4499f23d1dbc7beec90c271b2f 100644 --- a/packages/image_picker/image_picker_ohos/.gitignore +++ b/packages/image_picker/image_picker_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/image_picker/image_picker_ohos/example/lib/main.dart b/packages/image_picker/image_picker_ohos/example/lib/main.dart index 803cd8e55371bd2b359164936db6f4d057943554..1119d902752e69e6dfe2d9d2e57ca0b7c1ee2748 100644 --- a/packages/image_picker/image_picker_ohos/example/lib/main.dart +++ b/packages/image_picker/image_picker_ohos/example/lib/main.dart @@ -341,7 +341,7 @@ class _MyHomePageState extends State { title: Text(widget.title!), ), body: Center( - child: !kIsWeb && defaultTargetPlatform == TargetPlatform.android + child: !kIsWeb && (defaultTargetPlatform == TargetPlatform.android || defaultTargetPlatform == TargetPlatform.ohos) ? FutureBuilder( future: retrieveLostData(), builder: (BuildContext context, AsyncSnapshot snapshot) { diff --git a/packages/image_picker/image_picker_ohos/example/ohos/build-profile.json5 b/packages/image_picker/image_picker_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/image_picker/image_picker_ohos/example/ohos/build-profile.json5 +++ b/packages/image_picker/image_picker_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/image_picker/image_picker_ohos/example/ohos/entry/src/main/module.json5 b/packages/image_picker/image_picker_ohos/example/ohos/entry/src/main/module.json5 index a9af4bfab3fc30e132a61de4447500a0d9c212e9..1aeeb2da1b769819c2fdf57c01c550109e20938a 100644 --- a/packages/image_picker/image_picker_ohos/example/ohos/entry/src/main/module.json5 +++ b/packages/image_picker/image_picker_ohos/example/ohos/entry/src/main/module.json5 @@ -57,16 +57,6 @@ "when": "inuse" } }, - { - "name" : "ohos.permission.READ_MEDIA", - "reason": "$string:EntryAbility_desc", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "inuse" - } - } ] } } \ No newline at end of file diff --git a/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/image_picker/image_picker_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/image_picker/image_picker_ohos/example/ohos/hvigorw b/packages/image_picker/image_picker_ohos/example/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/image_picker/image_picker_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/image_picker/image_picker_ohos/example/ohos/hvigorw.bat b/packages/image_picker/image_picker_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 5799f5498ae79096ba616bd383f7fe0523a90528..0000000000000000000000000000000000000000 --- a/packages/image_picker/image_picker_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/image_picker/image_picker_ohos/example/ohos/oh-package.json5 b/packages/image_picker/image_picker_ohos/example/ohos/oh-package.json5 index e585e0e793f17b41162cf8a1244974da50b9e69e..8f72a6f6c86d7c91b97dd324494dda410ec79c80 100644 --- a/packages/image_picker/image_picker_ohos/example/ohos/oh-package.json5 +++ b/packages/image_picker/image_picker_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets b/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets index cb1d31ed123f16a6339038d2bbc094fead72f7b5..2da7ced588a26c96ebf3ea1e66168a1fcfe3d268 100644 --- a/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets +++ b/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets @@ -13,15 +13,11 @@ * limitations under the License. */ import ArrayList from '@ohos.util.ArrayList'; -import Want from '@ohos.app.ability.Want'; import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; import fs from '@ohos.file.fs' import common from '@ohos.app.ability.common'; -import wantConstant from '@ohos.ability.wantConstant'; -import bundleManager from '@ohos.bundle.bundleManager'; import ImagePickerCache, { CacheType } from './ImagePickerCache' import FileUtils from './FileUtils' -import StartOptions from '@ohos.app.ability.StartOptions'; import { FlutterError, ImageSelectionOptions, @@ -35,8 +31,9 @@ import { import ImageResizer from './ImageResizer'; import HashMap from '@ohos.util.HashMap'; import UIAbility from '@ohos.app.ability.UIAbility'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import { BusinessError } from '@ohos.base'; +import { cameraPicker, camera } from '@kit.CameraKit'; +import { photoAccessHelper } from '@kit.MediaLibraryKit' export default class ImagePickerDelegate { readonly REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY = 2342; @@ -53,6 +50,8 @@ export default class ImagePickerDelegate { private pendingCameraMediaUri: string | null = null; private pendingCallState: PendingCallState | null = null; private context: common.UIAbilityContext | null = null; + private photoPicker = new photoAccessHelper.PhotoViewPicker(); + private cameraPosition: camera.CameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; constructor(ability: UIAbility, imageResizer: ImageResizer, cache: ImagePickerCache, context?: common.UIAbilityContext, pendingImageOptions?: ImageSelectionOptions, pendingVideoOptions?: VideoSelectionOptions, @@ -65,8 +64,14 @@ export default class ImagePickerDelegate { this.context = ability.context; } - /* 当前默认调用仅支持后置摄像头 */ setCameraDevice(device: CameraDevice): void { + if (device == CameraDevice.REAR) { + this.cameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; + } + + if (device == CameraDevice.FRONT) { + this.cameraPosition = camera.CameraPosition.CAMERA_POSITION_FRONT; + } } saveStateBeforeResult(): void { @@ -129,40 +134,42 @@ export default class ImagePickerDelegate { return result.build ? result.build() : null; } + chooseMedia(maxMultiple: number, handleType: string, type?: photoAccessHelper.PhotoViewMIMETypes) { + let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); + photoSelectOptions.MIMEType = type; + photoSelectOptions.maxSelectNumber = maxMultiple; + + this.photoPicker.select(photoSelectOptions).then((photoSelectResult: photoAccessHelper.PhotoSelectResult) => { + this.handleResultType(handleType, 0, photoSelectResult.photoUris) + }).catch((err: BusinessError) => { + this.handleResultType(handleType, -1, []) + Log.e(ImagePickerDelegate.TAG, `PhotoViewPicker.select failed whih err: ${err}`) + }) + } + + handleResultType(handleType: string, code: number, uris: Array) { + switch (handleType) { + case 'handleChooseVideoResult': + this.handleChooseVideoResult(code, uris); + break; + case 'handleChooseImageResult': + this.handleChooseImageResult(code, uris); + break; + case 'handleChooseMediaResult': + this.handleChooseMediaResult(code, uris); + break; + } + } + + // 选择多个图片或者多个视频 chooseMediaFromGallery(options: MediaSelectionOptions, generalOptions: GeneralOptions, result: Result>): void { if (!this.setPendingOptionsAndResult(options.getImageSelectionOptions(), null, result)) { this.finishWithAlreadyActiveError(result); return; } - this.launchPickMediaFromGalleryWant(generalOptions); - } - launchPickMediaFromGalleryWant(generalOptions: GeneralOptions): void { - let config: Want = { - action: 'ohos.want.action.photoPicker', - type: generalOptions.getAllowMultiple() ? 'multipleselect' : 'singleselect', - parameters: { - uri: generalOptions.getAllowMultiple() ? 'multipleselect' : 'singleselect', - maxSelectCount: generalOptions.getAllowMultiple() ? 9 : 1, - filterMediaType: 'FILTER_MEDIA_TYPE_ALL' - } - }; - let options: StartOptions = { - displayId: 0, - }; - if (!this.context) { - return - } - this.context.startAbilityForResult(config, options).then(result => { - if (result && result.want && result.want.parameters) { - let uris: Array = result.want.parameters['select-item-list'] as Array; - let code = result["resultCode"] as number; - Log.i(ImagePickerDelegate.TAG, "startAbilityForResult : " + JSON.stringify(result.want.parameters)); - this.handleChooseMediaResult(code, uris); - } - - }); + this.chooseMedia(generalOptions.getAllowMultiple() ? 9 : 1, 'handleChooseMediaResult') } handleChooseMediaResult(code: number, uris: Array): void { @@ -197,41 +204,14 @@ export default class ImagePickerDelegate { this.finishWithListSuccess(pathList); } + // 选择一个视频 chooseVideoFromGallery(options: VideoSelectionOptions, usePhotoPicker: boolean, result: Result>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); return; } - this.launchPickVideoFromGalleryWant(usePhotoPicker); - } - - async launchPickVideoFromGalleryWant(usePhotoPicker: boolean): Promise { - Log.i(ImagePickerDelegate.TAG, "launchPickVideoFromGalleryWant enter"); - let config: Want = { - action: 'ohos.want.action.photoPicker', - type: 'singleselect', - parameters: { - uri: 'singleselect', - maxSelectCount: 1, - filterMediaType: 'FILTER_MEDIA_TYPE_VIDEO' - } - }; - - let options: StartOptions = { - displayId: 0, - }; - let result: ESObject = null - if (this.context) { - result = await this.context.startAbilityForResult(config, options); - } - - if (result && result.want && result.want.parameters) { - let uris = result.want.parameters['select-item-list'] as Array; - let code = result.resultCode as number; - this.handleChooseVideoResult(code, uris); - } - + this.chooseMedia(1, 'handleChooseVideoResult', photoAccessHelper.PhotoViewMIMETypes.VIDEO_TYPE); } handleChooseVideoResult(code: number, uris: Array): void { @@ -243,6 +223,7 @@ export default class ImagePickerDelegate { } } + // 唤起相机录像 takeVideoWithCamera(options: VideoSelectionOptions, result: Result>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); @@ -254,67 +235,25 @@ export default class ImagePickerDelegate { } async launchTakeVideoWithCameraWant(duration: number): Promise { - let want: Want = { - "action": wantConstant.Action.ACTION_VIDEO_CAPTURE, - parameters: { - callBundleName: "flutter_embedding", - "supportMultiMode": false, - durationLimit: duration - } + let pickerProfile: cameraPicker.PickerProfile = { + cameraPosition: this.cameraPosition, + videoDuration: duration } - abilityAccessCtrl.createAtManager() - .requestPermissionsFromUser(this.context, ['ohos.permission.READ_MEDIA']) - .then(async (permission) => { - if(permission.authResults[0] !== 0){ - return - } - let result: ESObject = null; - if (this.context) { - result = await this.context.startAbilityForResult(want); - } - if (result && result.want && result.want.parameters) { - let uri = result["want"]["parameters"].resourceUri as string; - let code = result["resultCode"] as number; - this.handlerCaptureImageResult(code, uri); - } - }); + cameraPicker.pick(this.context, [cameraPicker.PickerMediaType.VIDEO], pickerProfile).then((pickerResult: cameraPicker.PickerResult) => { + this.handlerCaptureImageResult(pickerResult.resultCode, pickerResult.resultUri); + }) } - async chooseImageFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result>): Promise { + // 选择单个图片 + chooseImageFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result>) { Log.i(ImagePickerDelegate.TAG, "chooseImageFromGallery enter"); if (!this.setPendingOptionsAndResult(options, null, result)) { this.finishWithAlreadyActiveError(result); return; } - await this.launchPickImageFromGalleryWant(usePhotoPicker); - } - - async launchPickImageFromGalleryWant(usePhotoPicker: boolean): Promise { - Log.i(ImagePickerDelegate.TAG, "launchPickImageFromGalleryWant enter"); - let config: Want = { - action: 'ohos.want.action.photoPicker', - type: 'singleselect', - parameters: { - uri: 'singleselect', - maxSelectCount: 1, - filterMediaType: 'FILTER_MEDIA_TYPE_IMAGE' - } - }; - - let options: StartOptions = { - displayId: 0, - }; - let result: ESObject = null; - if (this.context) { - result = await this.context.startAbilityForResult(config, options); - } - if (result && result.want && result.want.parameters) { - let uris = result?.want?.parameters['select-item-list'] as Array; - let code = result.resultCode as number; - this.handleChooseImageResult(code, uris); - } + this.chooseMedia(1, 'handleChooseImageResult', photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE) } handleChooseImageResult(code: number, uris: Array): void { @@ -326,41 +265,17 @@ export default class ImagePickerDelegate { } } + // 选择多个图片 chooseMultiImagesFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result>): void { if (!this.setPendingOptionsAndResult(options, null, result)) { this.finishWithAlreadyActiveError(result); return; } - this.launchMultiPickImageFromGalleryWant(usePhotoPicker); - } - - async launchMultiPickImageFromGalleryWant(usePhotoPicker: boolean): Promise { - let config: Want = { - action: 'ohos.want.action.photoPicker', - type: 'multipleselect', - parameters: { - uri: 'multipleselect', - maxSelectCount: 9, - filterMediaType: 'FILTER_MEDIA_TYPE_IMAGE' - } - }; - - let options: StartOptions = { - displayId: 0, - }; - let result: ESObject = null; - if (this.context) { - result = await this.context.startAbilityForResult(config, options); - } - if (result && result.want && result.want.parameters) { - let uris = result?.want?.parameters['select-item-list'] as Array; - let resultCode = result.resultCode as number; - this.handleChooseMediaResult(resultCode, uris); - } - + this.chooseMedia(9, 'handleChooseMediaResult', photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE) } + // 唤起相机拍照 takeImageWithCamera(options: ImageSelectionOptions, result: Result>): void { if (!this.setPendingOptionsAndResult(options, null, result)) { this.finishWithAlreadyActiveError(result); @@ -369,36 +284,15 @@ export default class ImagePickerDelegate { this.launchTakeImageWithCameraWant(); } - async launchTakeImageWithCameraWant(): Promise { - let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; - let bundleName = "" - try { - let t = await bundleManager.getBundleInfoForSelf(bundleFlags) - bundleName = t.name - } catch (err) { - let message = (err as BusinessError).message; - Log.e('getBundleInfoForSelf failed: %{public}s', message); - } - - let want: Want = { - "action": wantConstant.Action.ACTION_IMAGE_CAPTURE, - parameters: { - callBundleName: bundleName || "flutter_embedding", - "supportMultiMode": false - } - } - let result: ESObject = null - if (this.context) { - result = await this.context.startAbilityForResult(want); + launchTakeImageWithCameraWant() { + let pickerProfile: cameraPicker.PickerProfile = { + cameraPosition: this.cameraPosition, } - if (!result) { - return - } - let uri = result["want"]["parameters"].resourceUri as string; - let code = result["resultCode"] as number; - this.pendingCameraMediaUri = uri; - this.handlerCaptureImageResult(code, uri); + cameraPicker.pick(this.context, [cameraPicker.PickerMediaType.PHOTO], pickerProfile).then((pickerResult: cameraPicker.PickerResult) => { + this.pendingCameraMediaUri = pickerResult.resultUri; + this.handlerCaptureImageResult(pickerResult.resultCode, pickerResult.resultUri); + }) } setPendingOptionsAndResult(imageOptions: ImageSelectionOptions | null, videoOptions: VideoSelectionOptions | null, diff --git a/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerPlugin.ets b/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerPlugin.ets index f51a6716f604c8ffcc8a54a8d820a87506449cf7..a5c2897e1375bfa66e77cda3bf3cbb541b16a235 100644 --- a/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerPlugin.ets +++ b/packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerPlugin.ets @@ -93,7 +93,7 @@ export default class ImagePickerPlugin implements FlutterPlugin, AbilityAware { } } - async pickImages(source: SourceSpecification, options: ImageSelectionOptions, generalOptions: GeneralOptions, result: Result>): Promise { + pickImages(source: SourceSpecification, options: ImageSelectionOptions, generalOptions: GeneralOptions, result: Result>) { let delegate: ImagePickerDelegate | null = this.getImagePickerDelegate(); if (delegate == null) { let temp: Error = @@ -107,7 +107,7 @@ export default class ImagePickerPlugin implements FlutterPlugin, AbilityAware { } else { switch (source.getType()) { case SourceType.GALLERY: { - await delegate.chooseImageFromGallery(options, generalOptions.getUsePhotoPicker(), result); + delegate.chooseImageFromGallery(options, generalOptions.getUsePhotoPicker(), result); break; } case SourceType.CAMERA: { diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index 652ebc3b46e50d9234e0b6964e6a2e0beea2d3ac..c9dd5bd0fb1503206e05ea62a937175c56abbf46 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.11 + +* Updates documentation reference of `finishPurchase` to `completePurchase`. + ## 3.1.10 * Updates example code for current versions of Flutter. diff --git a/packages/in_app_purchase/in_app_purchase/README.md b/packages/in_app_purchase/in_app_purchase/README.md index 59cb2c2dd9a8af2c90092cc2cd8ea67ccc6519e4..f33c4d30cf11ed8f07136b4a7cb1a3f3192c04f8 100644 --- a/packages/in_app_purchase/in_app_purchase/README.md +++ b/packages/in_app_purchase/in_app_purchase/README.md @@ -5,6 +5,23 @@ A storefront-independent API for purchases in Flutter apps. This plugin supports in-app purchases (_IAP_) through an _underlying store_, which can be the App Store (on iOS and macOS) or Google Play (on Android). + + +#### ohos ˵ + +ohos ƽ̨Ŀǰӿڣ + +* purchaseStream +* isAvailable +* queryProductDetails +* buyNonConsumable +* buyConsumable +* completePurchase + +Ŀǰ֧ûӦóдָֻ֧̣֧ȹܣδ + + + | | Android | iOS | macOS | |-------------|---------|-------|--------| | **Support** | SDK 16+ | 11.0+ | 10.15+ | diff --git a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart index 5afb52ac99ea2b5045158ddad1ff54f6f480fbb4..c60f060c1b04f129282a8c497a3217cbdbb52abd 100644 --- a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart @@ -92,6 +92,7 @@ class _MyAppState extends State<_MyApp> { final ProductDetailsResponse productDetailResponse = await _inAppPurchase.queryProductDetails(_kProductIds.toSet()); + var productDetails = productDetailResponse.productDetails; if (productDetailResponse.error != null) { setState(() { _queryProductError = productDetailResponse.error!.message; @@ -149,13 +150,18 @@ class _MyAppState extends State<_MyApp> { if (_queryProductError == null) { stack.add( ListView( - children: [ - _buildConnectionCheckTile(), - _buildProductList(), - _buildConsumableBox(), - _buildRestoreButton(), - ], - ), + children: Platform.operatingSystem == 'ohos' + ? [ + _buildConnectionCheckTile(), + _buildProductList(), + _buildConsumableBox(), + ] + : [ + _buildConnectionCheckTile(), + _buildProductList(), + _buildConsumableBox(), + _buildRestoreButton(), + ]), ); } else { stack.add(Center( @@ -164,7 +170,7 @@ class _MyAppState extends State<_MyApp> { } if (_purchasePending) { stack.add( - const Stack( + Stack( children: [ Opacity( opacity: 0.3, @@ -259,10 +265,12 @@ class _MyAppState extends State<_MyApp> { subtitle: Text( productDetails.description, ), - trailing: previousPurchase != null && Platform.isIOS - ? IconButton( - onPressed: () => confirmPriceChange(context), - icon: const Icon(Icons.upgrade)) + trailing: previousPurchase != null + ? Platform.isIOS + ? IconButton( + onPressed: () => confirmPriceChange(context), + icon: const Icon(Icons.upgrade)) + : SizedBox.shrink() : TextButton( style: TextButton.styleFrom( backgroundColor: Colors.green[800], diff --git a/packages/camera/camera_ohos/ohos/camera/.gitignore b/packages/in_app_purchase/in_app_purchase/example/ohos/.gitignore similarity index 86% rename from packages/camera/camera_ohos/ohos/camera/.gitignore rename to packages/in_app_purchase/in_app_purchase/example/ohos/.gitignore index ee3ce1184f6b8b65dd95267ab36d861a48e54b11..6ca13b3170eec5dd5ac5ad7f1c4dd0118845f473 100644 --- a/packages/camera/camera_ohos/ohos/camera/.gitignore +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/.gitignore @@ -16,4 +16,4 @@ **/src/main/resources/rawfile/flutter_assets/ **/libs/arm64-v8a/libapp.so **/libs/arm64-v8a/libflutter.so -**/libs/arm64-v8a/libvmservice_snapshot.so \ No newline at end of file +**/libs/arm64-v8a/libvmservice_snapshot.so diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/app.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a13c8bfdc16a34697a1ce5c7dc8e207275149473 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.in_app_purchase_ohos", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..810f4a362c1d177309eec4f2efe5cac2f4558c28 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "example" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/media/app_icon.png b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase/example/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/build-profile.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1d12140d202702d7c73d64f1b291fe5c45a660ce --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/build-profile.json5 @@ -0,0 +1,27 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/.gitignore b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/build-profile.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..633d360fbc91a3186a23b66ab71b27e5618944cb --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/hvigorfile.ts b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/oh-package.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ebe795339873776bf5a6f746d1f6d1351f208c1f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "in_app_purchase_ohos": "file:../har/in_app_purchase_ohos.har", + "integration_test": "file:../har/integration_test.har" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bc48be8773196f34cccb15cf517f87f5c6b94d2 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; + +export default class EntryAbility extends FlutterAbility { + configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + GeneratedPluginRegistrant.registerWith(flutterEngine) + } +} diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/pages/Index.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1125f9fdd95f4310a182c1c9e3680f37f73686c9 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import common from '@ohos.app.ability.common'; +import { FlutterPage } from '@ohos/flutter_ohos' + +let storage = LocalStorage.getShared() +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' + +@Entry(storage) +@Component +struct Index { + private context = getContext(this) as common.UIAbilityContext + @LocalStorageLink('viewId') viewId: string = ""; + + build() { + Column() { + FlutterPage({ viewId: this.viewId }) + } + } + + onBackPress(): boolean { + this.context.eventHub.emit(EVENT_BACK_PRESS) + return true + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/module.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/color.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..67e0f4ff4ac762d1714f6e215c6636a4ad3d620e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/media/icon.png b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/profile/main_pages.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/en_US/element/string.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..67e0f4ff4ac762d1714f6e215c6636a4ad3d620e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/zh_CN/element/string.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..601e2b5a1c273aa04920b126e3ab715a4450e58f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/List.test.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/module.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/color.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/media/icon.png b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/hvigor/hvigor-config.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..541ba35711b75986f9295410ee38fdb8f2572878 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/hvigorfile.ts b/packages/in_app_purchase/in_app_purchase/example/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f2d2aafe6d6a3a71a9944ebd0c91fbc308ac9d1 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/hvigorfile.ts @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/ohos/oh-package.json5 b/packages/in_app_purchase/in_app_purchase/example/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e955b929b0dc04a27550d0a075407cf140f19b78 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/ohos/oh-package.json5 @@ -0,0 +1,21 @@ +{ + "modelVersion": "5.0.0", + "name": "example", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har" + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "overrides": { + "@ohos/flutter_ohos": "file:./har/flutter.har", + "in_app_purchase_ohos": "file:./har/in_app_purchase_ohos.har", + "integration_test": "file:./har/integration_test.har", + "@ohos/flutter_module": "file:./entry" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml index fcb72375f256b699aff61e72b010ceff9a533945..edc13ff9b20771e6df001ef96ed9b61710b6f71a 100644 --- a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml @@ -18,7 +18,14 @@ dependencies: path: ../ in_app_purchase_android: ^0.3.0 in_app_purchase_storekit: ^0.3.4 - shared_preferences: ^2.0.0 + shared_preferences: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/shared_preferences/shared_preferences + +dependency_overrides: + in_app_purchase_ohos: + path: ../../in_app_purchase_ohos dev_dependencies: flutter_test: diff --git a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart index 64e0095dcbb7c47bd95769627a3491390e8366ae..2bd431449f717ada1a9b69a08a956285f18bff81 100644 --- a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart +++ b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; import 'package:in_app_purchase_android/in_app_purchase_android.dart'; import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart'; +import 'package:in_app_purchase_ohos/in_app_purchase_ohos.dart'; export 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart' show @@ -37,6 +38,8 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider { } else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) { InAppPurchaseStoreKitPlatform.registerPlatform(); + } else if (defaultTargetPlatform == TargetPlatform.ohos) { + InAppPurchaseOhosPlatform.registerPlatform(); } _instance = InAppPurchase._(); @@ -195,7 +198,7 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider { /// Restored purchases are delivered through the [purchaseStream] with a /// status of [PurchaseStatus.restored]. You should listen for these purchases, /// validate their receipts, deliver the content and mark the purchase complete - /// by calling the [finishPurchase] method for each purchase. + /// by calling the [completePurchase] method for each purchase. /// /// This does not return consumed products. If you want to restore unused /// consumable products, you need to persist consumable product information diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index ba95a32125a59e60f5e5ba15b104bb96977669ad..2c30df6651ddd137ef8d4f43052ff0b9a35f628e 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 3.1.10 +version: 3.1.11 environment: sdk: ">=2.19.0 <4.0.0" @@ -13,6 +13,8 @@ flutter: platforms: android: default_package: in_app_purchase_android + ohos: + default_package: in_app_purchase_ohos ios: default_package: in_app_purchase_storekit macos: @@ -22,6 +24,8 @@ dependencies: flutter: sdk: flutter in_app_purchase_android: ^0.3.0 + in_app_purchase_ohos: + path: ../in_app_purchase_ohos/ in_app_purchase_platform_interface: ^1.0.0 in_app_purchase_storekit: ^0.3.4 diff --git a/packages/in_app_purchase/in_app_purchase_ohos/AUTHORS b/packages/in_app_purchase/in_app_purchase_ohos/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..78f9e5ad9f6b842b45e9fd070a44e042d6c7b6a9 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/AUTHORS @@ -0,0 +1,67 @@ +# Below is a list of people and organizations that have contributed +# to the Flutter project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. +The Chromium Authors +German Saprykin +Benjamin Sauer +larsenthomasj@gmail.com +Ali Bitek +Pol Batlló +Anatoly Pulyaevskiy +Hayden Flinner +Stefano Rodriguez +Salvatore Giordano +Brian Armstrong +Paul DeMarco +Fabricio Nogueira +Simon Lightfoot +Ashton Thomas +Thomas Danner +Diego Velásquez +Hajime Nakamura +Tuyển Vũ Xuân +Miguel Ruivo +Sarthak Verma +Mike Diarmid +Invertase +Elliot Hesp +Vince Varga +Aawaz Gyawali +EUI Limited +Katarina Sheremet +Thomas Stockx +Sarbagya Dhaubanjar +Ozkan Eksi +Rishab Nayak +ko2ic +Jonathan Younger +Jose Sanchez +Debkanchan Samadder +Audrius Karosevicius +Lukasz Piliszczuk +SoundReply Solutions GmbH +Rafal Wachol +Pau Picas +Christian Weder +Alexandru Tuca +Christian Weder +Rhodes Davis Jr. +Luigi Agosti +Quentin Le Guennec +Koushik Ravikumar +Nissim Dsilva +Giancarlo Rocha +Ryo Miyake +Théo Champion +Kazuki Yamaguchi +Eitan Schwartz +Chris Rutkowski +Juan Alvarez +Aleksandr Yurkovskiy +Anton Borries +Alex Li +Rahul Raj <64.rahulraj@gmail.com> +Maurits van Beusekom diff --git a/packages/in_app_purchase/in_app_purchase_ohos/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_ohos/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..4fac17c4689aeb69433e4c406db2da67aa1fa4b3 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +* Initial open-source release. diff --git a/packages/in_app_purchase/in_app_purchase_ohos/LICENSE b/packages/in_app_purchase/in_app_purchase_ohos/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c6823b81eb845db89cee59cbbc7ee0b0b63d86ec --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/LICENSE @@ -0,0 +1,25 @@ +Copyright 2013 The Flutter Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/in_app_purchase/in_app_purchase_ohos/README.md b/packages/in_app_purchase/in_app_purchase_ohos/README.md new file mode 100644 index 0000000000000000000000000000000000000000..971c114cbbe8c3e920073cd76066f81ef545796a --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/README.md @@ -0,0 +1,24 @@ +# in\_app\_purchase\_ohos + +The Ohos implementation of [`in_app_purchase`][1]. + +## Usage + +This package is [endorsed][2], which means you can simply use `in_app_purchase` +normally. This package will be automatically included in your app when you do, +so you do not need to add it to your `pubspec.yaml`. + +## Contributing + +This plugin utilizes +[json_serializable](https://pub.dev/packages/json_serializable) for the +numerous data structures communicated between the underlying platform layers and Dart. After +modifying any of the serialized data structures, regenerate the serializers by executing +`flutter pub run build_runner build --delete-conflicting-outputs`. +`flutter pub run build_runner watch --delete-conflicting-outputs` will supervise the filesystem for changes. + +If you are interested in contributing to the plugin, please consult our +[contribution guidelines](https://github.com/flutter/plugins/blob/main/CONTRIBUTING.md). + +[1]: https://pub.dev/packages/in_app_purchase +[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin diff --git a/packages/in_app_purchase/in_app_purchase_ohos/build.yaml b/packages/in_app_purchase/in_app_purchase_ohos/build.yaml new file mode 100644 index 0000000000000000000000000000000000000000..651a557fc1ca5de4484891911e24fd8c0e7addf4 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/build.yaml @@ -0,0 +1,8 @@ +# See https://pub.dev/packages/build_config +targets: + $default: + builders: + json_serializable: + options: + any_map: true + create_to_json: false diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/README.md b/packages/in_app_purchase/in_app_purchase_ohos/example/README.md new file mode 100644 index 0000000000000000000000000000000000000000..96b8bb17dbff8e7acd9a1dd59c65ff40b96e1228 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/README.md @@ -0,0 +1,9 @@ +# Platform Implementation Test App + +This is a test app for manual testing and automated integration testing +of this platform implementation. It is not intended to demonstrate actual use of +this package, since the intent is that plugin clients use the app-facing +package. + +Unless you are making changes to this implementation package, this example is +very unlikely to be relevant. diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/integration_test/in_app_purchase_test.dart b/packages/in_app_purchase/in_app_purchase_ohos/example/integration_test/in_app_purchase_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..28f99f748b4d199067672c3ffa2be0a32fcf979c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/integration_test/in_app_purchase_test.dart @@ -0,0 +1,20 @@ +// Copyright 2013 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. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:in_app_purchase_ohos/in_app_purchase_ohos.dart'; +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; +import 'package:integration_test/integration_test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testWidgets('Can create InAppPurchaseStoreKit instance', + (WidgetTester tester) async { + InAppPurchaseOhosPlatform.registerPlatform(); + final InAppPurchasePlatform androidPlatform = + InAppPurchasePlatform.instance; + expect(androidPlatform, isNotNull); + }); +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/lib/consumable_store.dart b/packages/in_app_purchase/in_app_purchase_ohos/example/lib/consumable_store.dart new file mode 100644 index 0000000000000000000000000000000000000000..f8791d3b18c0524be8ec89cf02705cea880dd904 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/lib/consumable_store.dart @@ -0,0 +1,52 @@ +// Copyright 2013 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. + +import 'dart:async'; +import 'package:shared_preferences/shared_preferences.dart'; + +// ignore: avoid_classes_with_only_static_members +/// A store of consumable items. +/// +/// This is a development prototype that stores consumables in the shared +/// preferences. Do not use this in real world apps. +class ConsumableStore { + static const String _kPrefKey = 'consumables'; + static Future _writes = Future.value(); + + /// Adds a consumable with ID `id` to the store. + /// + /// The consumable is only added after the returned Future is complete. + static Future save(String id) { + _writes = _writes.then((void _) => _doSave(id)); + return _writes; + } + + /// Consumes a consumable with ID `id` from the store. + /// + /// The consumable was only consumed after the returned Future is complete. + static Future consume(String id) { + _writes = _writes.then((void _) => _doConsume(id)); + return _writes; + } + + /// Returns the list of consumables from the store. + static Future> load() async { + return (await SharedPreferences.getInstance()).getStringList(_kPrefKey) ?? + []; + } + + static Future _doSave(String id) async { + final List cached = await load(); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + cached.add(id); + await prefs.setStringList(_kPrefKey, cached); + } + + static Future _doConsume(String id) async { + final List cached = await load(); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + cached.remove(id); + await prefs.setStringList(_kPrefKey, cached); + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_ohos/example/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..d79a39189da8652f6e066a3efba0958f63cae015 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/lib/main.dart @@ -0,0 +1,414 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:in_app_purchase_ohos/in_app_purchase_ohos.dart'; +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +import 'consumable_store.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + + // When using the Ohos plugin directly it is mandatory to register + // the plugin as default instance as part of initializing the app. + InAppPurchaseOhosPlatform.registerPlatform(); + + runApp(_MyApp()); +} + +const String _kConsumableId = 'consumable'; +const String _kUpgradeId = 'upgrade'; +const String _kSilverSubscriptionId = 'subscription_silver'; +const String _kGoldSubscriptionId = 'subscription_gold'; +const List _kProductIds = [ + _kConsumableId, + _kUpgradeId, + _kSilverSubscriptionId, + _kGoldSubscriptionId, +]; + +class _MyApp extends StatefulWidget { + @override + State<_MyApp> createState() => _MyAppState(); +} + +class _MyAppState extends State<_MyApp> { + final InAppPurchaseOhosPlatform _iapStoreKitPlatform = + InAppPurchasePlatform.instance as InAppPurchaseOhosPlatform; + late StreamSubscription> _subscription; + List _notFoundIds = []; + List _products = []; + List _purchases = []; + List _consumables = []; + bool _isAvailable = false; + bool _purchasePending = false; + bool _loading = true; + String? _queryProductError; + + @override + void initState() { + final Stream> purchaseUpdated = + _iapStoreKitPlatform.purchaseStream; + _subscription = + purchaseUpdated.listen((List purchaseDetailsList) { + _listenToPurchaseUpdated(purchaseDetailsList); + }, onDone: () { + _subscription.cancel(); + }, onError: (Object error) { + // handle error here. + }); + + initStoreInfo(); + super.initState(); + } + + Future initStoreInfo() async { + final bool isAvailable = await _iapStoreKitPlatform.isAvailable(); + if (!isAvailable) { + setState(() { + _isAvailable = isAvailable; + _products = []; + _purchases = []; + _notFoundIds = []; + _consumables = []; + _purchasePending = false; + _loading = false; + }); + return; + } + final ProductDetailsResponse productDetailResponse = + await _iapStoreKitPlatform.queryProductDetails(_kProductIds.toSet()); + if (productDetailResponse.error != null) { + setState(() { + _queryProductError = productDetailResponse.error!.message; + _isAvailable = isAvailable; + _products = productDetailResponse.productDetails; + _purchases = []; + _notFoundIds = productDetailResponse.notFoundIDs; + _consumables = []; + _purchasePending = false; + _loading = false; + }); + return; + } + + if (productDetailResponse.productDetails.isEmpty) { + setState(() { + _queryProductError = null; + _isAvailable = isAvailable; + _products = productDetailResponse.productDetails; + _purchases = []; + _notFoundIds = productDetailResponse.notFoundIDs; + _consumables = []; + _purchasePending = false; + _loading = false; + }); + return; + } + + final List consumables = await ConsumableStore.load(); + setState(() { + _isAvailable = isAvailable; + _products = productDetailResponse.productDetails; + _notFoundIds = productDetailResponse.notFoundIDs; + _consumables = consumables; + _purchasePending = false; + _loading = false; + }); + } + + @override + void dispose() { + _subscription.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final List stack = []; + if (_queryProductError == null) { + stack.add( + ListView( + children: [ + _buildConnectionCheckTile(), + _buildProductList(), + _buildConsumableBox(), + // _buildRestoreButton(), + ], + ), + ); + } else { + stack.add(Center( + child: Text(_queryProductError!), + )); + } + if (_purchasePending) { + stack.add( + // const Stack( + Stack( + children: [ + Opacity( + opacity: 0.3, + child: ModalBarrier(dismissible: false, color: Colors.grey), + ), + Center( + child: CircularProgressIndicator(), + ), + ], + ), + ); + } + + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('IAP Example'), + ), + body: Stack( + children: stack, + ), + ), + ); + } + + Card _buildConnectionCheckTile() { + if (_loading) { + return const Card(child: ListTile(title: Text('Trying to connect...'))); + } + final Widget storeHeader = ListTile( + leading: Icon(_isAvailable ? Icons.check : Icons.block, + color: _isAvailable + ? Colors.green + : ThemeData.light().colorScheme.error), + title: + Text('The store is ${_isAvailable ? 'available' : 'unavailable'}.'), + ); + final List children = [storeHeader]; + + if (!_isAvailable) { + children.addAll([ + const Divider(), + ListTile( + title: Text('Not connected', + style: TextStyle(color: ThemeData.light().colorScheme.error)), + subtitle: const Text( + 'Unable to connect to the payments processor. Has this app been configured correctly? See the example README for instructions.'), + ), + ]); + } + return Card(child: Column(children: children)); + } + + Card _buildProductList() { + if (_loading) { + return const Card( + child: ListTile( + leading: CircularProgressIndicator(), + title: Text('Fetching products...'))); + } + if (!_isAvailable) { + return const Card(); + } + const ListTile productHeader = ListTile(title: Text('Products for Sale')); + final List productList = []; + if (_notFoundIds.isNotEmpty) { + productList.add(ListTile( + title: Text('[${_notFoundIds.join(", ")}] not found', + style: TextStyle(color: ThemeData.light().colorScheme.error)), + subtitle: const Text( + 'This app needs special configuration to run. Please see example/README.md for instructions.'))); + } + + // This loading previous purchases code is just a demo. Please do not use this as it is. + // In your app you should always verify the purchase data using the `verificationData` inside the [PurchaseDetails] object before trusting it. + // We recommend that you use your own server to verify the purchase data. + final Map purchases = + Map.fromEntries( + _purchases.map((PurchaseDetails purchase) { + if (purchase.pendingCompletePurchase) { + _iapStoreKitPlatform.completePurchase(purchase); + } + return MapEntry(purchase.productID, purchase); + })); + productList.addAll(_products.map( + (ProductDetails productDetails) { + final PurchaseDetails? previousPurchase = purchases[productDetails.id]; + return ListTile( + title: Text( + productDetails.title, + ), + subtitle: Text( + productDetails.description, + ), + trailing: previousPurchase != null + ? SizedBox.shrink() + : TextButton( + style: TextButton.styleFrom( + backgroundColor: Colors.green[800], + foregroundColor: Colors.white, + ), + onPressed: () { + final PurchaseParam purchaseParam = PurchaseParam( + productDetails: productDetails, + ); + if (productDetails.id == _kConsumableId) { + _iapStoreKitPlatform.buyConsumable( + purchaseParam: purchaseParam); + } else { + _iapStoreKitPlatform.buyNonConsumable( + purchaseParam: purchaseParam); + } + }, + child: Text(productDetails.price), + )); + }, + )); + + return Card( + child: Column( + children: [productHeader, const Divider()] + productList)); + } + + Card _buildConsumableBox() { + if (_loading) { + return const Card( + child: ListTile( + leading: CircularProgressIndicator(), + title: Text('Fetching consumables...'))); + } + if (!_isAvailable || _notFoundIds.contains(_kConsumableId)) { + return const Card(); + } + const ListTile consumableHeader = + ListTile(title: Text('Purchased consumables')); + final List tokens = _consumables.map((String id) { + return GridTile( + child: IconButton( + icon: const Icon( + Icons.stars, + size: 42.0, + color: Colors.orange, + ), + splashColor: Colors.yellowAccent, + onPressed: () => consume(id), + ), + ); + }).toList(); + return Card( + child: Column(children: [ + consumableHeader, + const Divider(), + GridView.count( + crossAxisCount: 5, + shrinkWrap: true, + padding: const EdgeInsets.all(16.0), + children: tokens, + ) + ])); + } + + Widget _buildRestoreButton() { + if (_loading) { + return Container(); + } + + return Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton( + style: TextButton.styleFrom( + backgroundColor: Theme.of(context).colorScheme.primary, + foregroundColor: Colors.white, + ), + onPressed: () => _iapStoreKitPlatform.restorePurchases(), + child: const Text('Restore purchases'), + ), + ], + ), + ); + } + + Future consume(String id) async { + await ConsumableStore.consume(id); + final List consumables = await ConsumableStore.load(); + setState(() { + _consumables = consumables; + }); + } + + void showPendingUI() { + setState(() { + _purchasePending = true; + }); + } + + Future deliverProduct(PurchaseDetails purchaseDetails) async { + // IMPORTANT!! Always verify purchase details before delivering the product. + if (purchaseDetails.productID == _kConsumableId) { + await ConsumableStore.save(purchaseDetails.purchaseID!); + final List consumables = await ConsumableStore.load(); + setState(() { + _purchasePending = false; + _consumables = consumables; + }); + } else { + setState(() { + _purchases.add(purchaseDetails); + _purchasePending = false; + }); + } + } + + void handleError(IAPError error) { + setState(() { + _purchasePending = false; + }); + } + + Future _verifyPurchase(PurchaseDetails purchaseDetails) { + // IMPORTANT!! Always verify a purchase before delivering the product. + // For the purpose of an example, we directly return true. + return Future.value(true); + } + + void _handleInvalidPurchase(PurchaseDetails purchaseDetails) { + // handle invalid purchase here if _verifyPurchase` failed. + } + + void _listenToPurchaseUpdated(List purchaseDetailsList) { + purchaseDetailsList.forEach(_handleReportedPurchaseState); + } + + Future _handleReportedPurchaseState( + PurchaseDetails purchaseDetails) async { + print('InAppPurchasePlugin purchaseDetails.status =$purchaseDetails'); + if (purchaseDetails.status == PurchaseStatus.pending) { + showPendingUI(); + } else { + if (purchaseDetails.status == PurchaseStatus.error) { + handleError(purchaseDetails.error!); + } else if (purchaseDetails.status == PurchaseStatus.purchased || + purchaseDetails.status == PurchaseStatus.restored) { + final bool valid = await _verifyPurchase(purchaseDetails); + if (valid) { + await deliverProduct(purchaseDetails); + } else { + _handleInvalidPurchase(purchaseDetails); + return; + } + }else if(purchaseDetails.status == PurchaseStatus.canceled){ + + } + + if (purchaseDetails.pendingCompletePurchase) { + await _iapStoreKitPlatform.completePurchase(purchaseDetails); + } + } + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/.gitignore b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6ca13b3170eec5dd5ac5ad7f1c4dd0118845f473 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/.gitignore @@ -0,0 +1,19 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +*.har +**/BuildProfile.ets +**/oh-package-lock.json5 + +**/src/main/resources/rawfile/flutter_assets/ +**/libs/arm64-v8a/libapp.so +**/libs/arm64-v8a/libflutter.so +**/libs/arm64-v8a/libvmservice_snapshot.so diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/app.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a13c8bfdc16a34697a1ce5c7dc8e207275149473 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.in_app_purchase_ohos", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..810f4a362c1d177309eec4f2efe5cac2f4558c28 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "example" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/media/app_icon.png b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/build-profile.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1d12140d202702d7c73d64f1b291fe5c45a660ce --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/build-profile.json5 @@ -0,0 +1,27 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/.gitignore b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/build-profile.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..633d360fbc91a3186a23b66ab71b27e5618944cb --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/hvigorfile.ts b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..5bda56eeac3f79703639db986e2faaa433b0e48c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/oh-package.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0dabd8f8158dd0c7ef1dd55fc8361f234192f9d0 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "in_app_purchase_ohos": "file:../har/in_app_purchase_ohos.har", + "integration_test": "file:../har/integration_test.har", + "shared_preferences_ohos": "file:../har/shared_preferences_ohos.har" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5888ed9002dd328f9abd3141ee3e63e88b40d0f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; + +export default class EntryAbility extends FlutterAbility { + configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + GeneratedPluginRegistrant.registerWith(flutterEngine) + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/pages/Index.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d9647743f4651f3dab7aa3076ed0707b207b436 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import common from '@ohos.app.ability.common'; +import { FlutterPage } from '@ohos/flutter_ohos' + +let storage = LocalStorage.getShared() +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' + +@Entry(storage) +@Component +struct Index { + private context = getContext(this) as common.UIAbilityContext + @LocalStorageLink('viewId') viewId: string = ""; + + build() { + Column() { + FlutterPage({ viewId: this.viewId }) + } + } + + onBackPress(): boolean { + this.context.eventHub.emit(EVENT_BACK_PRESS) + return true + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets new file mode 100644 index 0000000000000000000000000000000000000000..0569b3bbcb6759d2988addd26cbefff06fd96c4a --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; +import InAppPurchasePlugin from 'in_app_purchase_ohos'; +import IntegrationTestPlugin from 'integration_test'; +import SharedPreferencesPlugin from 'shared_preferences_ohos'; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Ohos platform. + */ + +const TAG = "GeneratedPluginRegistrant"; + +export class GeneratedPluginRegistrant { + + static registerWith(flutterEngine: FlutterEngine) { + try { + flutterEngine.getPlugins()?.add(new InAppPurchasePlugin()); + flutterEngine.getPlugins()?.add(new IntegrationTestPlugin()); + flutterEngine.getPlugins()?.add(new SharedPreferencesPlugin()); + } catch (e) { + Log.e( + TAG, + "Tried to register plugins with FlutterEngine (" + + flutterEngine + + ") failed."); + Log.e(TAG, "Received exception while registering", e); + } + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/module.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/color.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..67e0f4ff4ac762d1714f6e215c6636a4ad3d620e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/media/icon.png b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/en_US/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..67e0f4ff4ac762d1714f6e215c6636a4ad3d620e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/zh_CN/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..601e2b5a1c273aa04920b126e3ab715a4450e58f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "example" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdb2d4b3479e7c4b3d4ffb539abc734470c57f32 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/List.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ed99383f79bb67de7472f356de5b0421fa26e71 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..465211ee2e66f8b16d8c28881acc0f534df700e5 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdf1e5f905bcacd6a73af7709c41d4a79d41b170 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..58d9c312f08e7c9ac01e4d6f2d0a33ddc6188ed9 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/module.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/color.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/media/icon.png b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..541ba35711b75986f9295410ee38fdb8f2572878 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigorfile.ts b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..38626e385a5b47dd3cba0e1e83c614f091b7cc9e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/hvigorfile.ts @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/oh-package.json5 b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..81da8c679151fb90deafcfea3617d7463ac9a0d1 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/ohos/oh-package.json5 @@ -0,0 +1,22 @@ +{ + "modelVersion": "5.0.0", + "name": "example", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har" + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "overrides": { + "@ohos/flutter_ohos": "file:./har/flutter.har", + "in_app_purchase_ohos": "file:./har/in_app_purchase_ohos.har", + "shared_preferences_ohos": "file:./har/shared_preferences_ohos.har", + "integration_test": "file:./har/integration_test.har", + "@ohos/flutter_module": "file:./entry" + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_ohos/example/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..657c9d1cab93a692ef1e97588d82bcee34eb5bc6 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/example/pubspec.yaml @@ -0,0 +1,33 @@ +name: in_app_purchase_ohos_example +description: Demonstrates how to use the in_app_purchase_ohos plugin. +publish_to: none + +environment: + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" + +dependencies: + flutter: + sdk: flutter + in_app_purchase_ohos: + # When depending on this package from a real application you should use: + # in_app_purchase_ohos: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + in_app_purchase_platform_interface: ^1.0.0 + shared_preferences: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/shared_preferences/shared_preferences + +dev_dependencies: + # build_runner: ^2.4.5 + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + +flutter: + uses-material-design: true diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/iap_kit_wrappers.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/iap_kit_wrappers.dart new file mode 100644 index 0000000000000000000000000000000000000000..eade8d181a423271bdd006693187b3bceb3e3266 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/iap_kit_wrappers.dart @@ -0,0 +1,9 @@ +// Copyright 2013 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. + +export 'src/iap_kit_wrappers/ik_payment_queue_wrapper.dart'; +export 'src/iap_kit_wrappers/ik_payment_transaction_wrappers.dart'; +export 'src/iap_kit_wrappers/ik_product_wrapper.dart'; +export 'src/iap_kit_wrappers/ik_receipt_manager.dart'; +export 'src/iap_kit_wrappers/ik_request_maker.dart'; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/in_app_purchase_ohos.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/in_app_purchase_ohos.dart new file mode 100644 index 0000000000000000000000000000000000000000..bee9e1c9af5a87b59b3b834cd115de3db5cbff3e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/in_app_purchase_ohos.dart @@ -0,0 +1,7 @@ +// Copyright 2013 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. + +export 'src/in_app_purchase_ohos_platform.dart'; +export 'src/in_app_purchase_ohos_platform_addition.dart'; +export 'src/types/types.dart'; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/channel.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/channel.dart new file mode 100644 index 0000000000000000000000000000000000000000..c8b9d647a28c30b58e641ab229c21982c8f789e1 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/channel.dart @@ -0,0 +1,9 @@ +// Copyright 2013 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. + +import 'package:flutter/services.dart'; + +/// Method channel for the plugin's platform<-->Dart calls. +const MethodChannel channel = + MethodChannel('plugins.flutter.io/in_app_purchase'); \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/README.md b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8a99aab65991bcdb9538d628393657dc0c65bc62 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/README.md @@ -0,0 +1,5 @@ +# iap_kit_wrappers + +This exposes Dart endpoints through to the +IAP Kit APIs. It offers functionality +as an alternative to [in_app_purchase](../in_app_purchase/README.md). \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.dart new file mode 100644 index 0000000000000000000000000000000000000000..76e1932354e1e339d5d250164c32b481ce949ded --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.dart @@ -0,0 +1,143 @@ +// Copyright 2013 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. + +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import '../../iap_kit_wrappers.dart'; + +part 'enum_converters.g.dart'; + +/// Serializer for [IKPaymentTransactionStateWrapper]. +/// +/// Use these in `@JsonSerializable()` classes by annotating them with +/// `@IKTransactionStatusConverter()`. +class IKTransactionStatusConverter + implements JsonConverter { + /// Default const constructor. + const IKTransactionStatusConverter(); + + @override + IKPaymentTransactionStateWrapper fromJson(int? json) { + if (json == null) { + return IKPaymentTransactionStateWrapper.unspecified; + } + return $enumDecode( + _$IKPaymentTransactionStateWrapperEnumMap + .cast(), + json); + } + + /// Converts an [IKPaymentTransactionStateWrapper] to a [PurchaseStatus]. + PurchaseStatus toPurchaseStatus( + IKPaymentTransactionStateWrapper object, IKError? error) { + print('MethodCallHandlerImpl toPurchaseStatus. $object'); + switch (object) { + case IKPaymentTransactionStateWrapper.purchasing: + case IKPaymentTransactionStateWrapper.deferred: + return PurchaseStatus.pending; + case IKPaymentTransactionStateWrapper.purchased: + return PurchaseStatus.purchased; + case IKPaymentTransactionStateWrapper.restored: + return PurchaseStatus.restored; + case IKPaymentTransactionStateWrapper.failed: + // According to the Apple documentation the error code "2" indicates + // the user cancelled the payment (IKErrorPaymentCancelled) and error + // code "15" indicates the cancellation of the overlay (IKErrorOverlayCancelled). + if (error != null && (error.code == 2 || error.code == 15)) { + return PurchaseStatus.canceled; + } + return PurchaseStatus.error; + case IKPaymentTransactionStateWrapper.unspecified: + return PurchaseStatus.error; + } + } + + @override + int toJson(IKPaymentTransactionStateWrapper object) => + _$IKPaymentTransactionStateWrapperEnumMap[object]!; +} + +/// Serializer for [IKSubscriptionPeriodUnit]. +/// +/// Use these in `@JsonSerializable()` classes by annotating them with +/// `@IKSubscriptionPeriodUnitConverter()`. +class IKSubscriptionPeriodUnitConverter + implements JsonConverter { + /// Default const constructor. + const IKSubscriptionPeriodUnitConverter(); + + @override + IKSubscriptionPeriodUnit fromJson(int? json) { + if (json == null) { + return IKSubscriptionPeriodUnit.day; + } + return $enumDecode( + _$IKSubscriptionPeriodUnitEnumMap + .cast(), + json); + } + + @override + int toJson(IKSubscriptionPeriodUnit object) => + _$IKSubscriptionPeriodUnitEnumMap[object]!; +} + +/// Serializer for [IKProductDiscountPaymentMode]. +/// +/// Use these in `@JsonSerializable()` classes by annotating them with +/// `@IKProductDiscountPaymentModeConverter()`. +class IKProductDiscountPaymentModeConverter + implements JsonConverter { + /// Default const constructor. + const IKProductDiscountPaymentModeConverter(); + + @override + IKProductDiscountPaymentMode fromJson(int? json) { + if (json == null) { + return IKProductDiscountPaymentMode.payAsYouGo; + } + return $enumDecode( + _$IKProductDiscountPaymentModeEnumMap + .cast(), + json); + } + + @override + int toJson(IKProductDiscountPaymentMode object) => + _$IKProductDiscountPaymentModeEnumMap[object]!; +} + +// Define a class so we generate serializer helper methods for the enums +// See https://github.com/google/json_serializable.dart/issues/778 +@JsonSerializable() +class _SerializedEnums { + late IKPaymentTransactionStateWrapper response; + late IKSubscriptionPeriodUnit unit; + late IKProductDiscountPaymentMode discountPaymentMode; +} + +/// Serializer for [IKProductDiscountType]. +/// +/// Use these in `@JsonSerializable()` classes by annotating them with +/// `@IKProductDiscountTypeConverter()`. +class IKProductDiscountTypeConverter + implements JsonConverter { + /// Default const constructor. + const IKProductDiscountTypeConverter(); + + @override + IKProductDiscountType fromJson(int? json) { + if (json == null) { + return IKProductDiscountType.introductory; + } + return $enumDecode( + _$IKProductDiscountTypeEnumMap.cast(), + json); + } + + @override + int toJson(IKProductDiscountType object) => + _$IKProductDiscountTypeEnumMap[object]!; +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.g.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.g.dart new file mode 100644 index 0000000000000000000000000000000000000000..1fd872ac6fc51499b191a0a4e1868f47569c55af --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/enum_converters.g.dart @@ -0,0 +1,42 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'enum_converters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SerializedEnums _$SerializedEnumsFromJson(Map json) => _SerializedEnums() + ..response = + $enumDecode(_$IKPaymentTransactionStateWrapperEnumMap, json['response']) + ..unit = $enumDecode(_$IKSubscriptionPeriodUnitEnumMap, json['unit']) + ..discountPaymentMode = $enumDecode( + _$IKProductDiscountPaymentModeEnumMap, json['discountPaymentMode']); + +const _$IKPaymentTransactionStateWrapperEnumMap = { + IKPaymentTransactionStateWrapper.purchasing: 0, + IKPaymentTransactionStateWrapper.purchased: 1, + IKPaymentTransactionStateWrapper.failed: 2, + IKPaymentTransactionStateWrapper.restored: 3, + IKPaymentTransactionStateWrapper.deferred: 4, + IKPaymentTransactionStateWrapper.unspecified: -1, +}; + +const _$IKSubscriptionPeriodUnitEnumMap = { + IKSubscriptionPeriodUnit.day: 0, + IKSubscriptionPeriodUnit.week: 1, + IKSubscriptionPeriodUnit.month: 2, + IKSubscriptionPeriodUnit.year: 3, +}; + +const _$IKProductDiscountPaymentModeEnumMap = { + IKProductDiscountPaymentMode.payAsYouGo: 0, + IKProductDiscountPaymentMode.payUpFront: 1, + IKProductDiscountPaymentMode.freeTrail: 2, + IKProductDiscountPaymentMode.unspecified: -1, +}; + +const _$IKProductDiscountTypeEnumMap = { + IKProductDiscountType.introductory: 0, + IKProductDiscountType.subscription: 1, +}; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.dart new file mode 100644 index 0000000000000000000000000000000000000000..c4fdc94af11cc5d47573d11eabb84c4236ff0b41 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.dart @@ -0,0 +1,264 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import '../../iap_kit_wrappers.dart'; +import '../channel.dart'; +import '../in_app_purchase_ohos_platform.dart'; + +part 'ik_payment_queue_wrapper.g.dart'; + +class IKPaymentQueueWrapper { + /// Returns the default payment queue. + /// + /// We do not support instantiating a custom payment queue, hence the + /// singleton. However, you can override the observer. + factory IKPaymentQueueWrapper() { + return _singleton; + } + + IKPaymentQueueWrapper._(); + + static final IKPaymentQueueWrapper _singleton = IKPaymentQueueWrapper._(); + + IKTransactionObserverWrapper? _observer; + + Future> transactions() async { + return _getTransactionList((await channel + .invokeListMethod('iap#transactions'))!); + } + + static Future queryEnvironmentStatus() async => + (await channel.invokeMethod('iap#queryEnvironmentStatus')) ?? false; + + void setTransactionObserver(IKTransactionObserverWrapper observer) { + _observer = observer; + channel.setMethodCallHandler(handleObserverCallbacks); + } + + Future startObservingTransactionQueue() => + channel.invokeMethod('iap#startObservingTransactionQueue'); + + Future stopObservingTransactionQueue() => + channel.invokeMethod('iap#stopObservingTransactionQueue'); + + Future addPayment(IKPaymentWrapper payment) async { + assert(_observer != null, + '[in_app_purchase]: Trying to add a payment without an observer. One must be set using `IKPaymentQueueWrapper.setTransactionObserver` before the app launches.'); + final Map requestMap = payment.toMap(); + await channel.invokeMethod( + 'iap#createPurchase', + requestMap, + ); + } + + Future finishTransaction( + IKPaymentTransactionWrapper transaction) async { + final Map requestMap = transaction.toFinishMap(); + await channel.invokeMethod( + 'iap#finishPurchase', + requestMap, + ); + } + + // 暂未实现 + Future restoreTransactions({String? applicationUserName}) async { + await channel.invokeMethod( + 'iap#restoreTransactions', applicationUserName); + } + + /// Triage a method channel call from the platform and triggers the correct observer method. + /// + /// This method is public for testing purposes only and should not be used + /// outside this class. + @visibleForTesting + Future handleObserverCallbacks(MethodCall call) async { + assert(_observer != null, + '[in_app_purchase]: (Fatal)The observer has not been set but we received a purchase transaction notification. Please ensure the observer has been set using `setTransactionObserver`. Make sure the observer is added right at the App Launch.'); + print('MethodCallHandlerImpl handleObserverCallbacks : ' + call.method); + final IKTransactionObserverWrapper observer = _observer!; + switch (call.method) { + case 'updatedTransactions': + { + print('MethodCallHandlerImpl handleObserverCallbacks'); + final List transactions = + _getTransactionList(call.arguments as List); + return Future(() { + observer.updatedTransactions(transactions: transactions); + }); + } + case 'removedTransactions': + { + final List transactions = + _getTransactionList(call.arguments as List); + return Future(() { + observer.removedTransactions(transactions: transactions); + }); + } + default: + break; + } + throw PlatformException( + code: 'no_such_callback', + message: 'Did not recognize the observer callback ${call.method}.'); + } + + // Get transaction wrapper object list from arguments. + List _getTransactionList( + List transactionsData) { + return transactionsData.map((dynamic map) { + return IKPaymentTransactionWrapper.fromJson( + Map.castFrom( + map as Map)); + }).toList(); + } +} + +@immutable +@JsonSerializable() +class IKError { + /// Creates a new [IKError] object with the provided information. + const IKError( + {required this.code, required this.domain, required this.userInfo}); + + /// Constructs an instance of this from a key-value map of data. + /// + /// The map needs to have named string keys with values matching the names and + /// types of all of the members on this class. The `map` parameter must not be + /// null. + factory IKError.fromJson(Map map) { + return _$IKErrorFromJson(map); + } + + /// Error code + @JsonKey(defaultValue: 0) + final int code; + + /// Error + @JsonKey(defaultValue: '') + final String domain; + + /// A map that contains more detailed information about the error. + @JsonKey(defaultValue: {}) + final Map userInfo; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is IKError && + other.code == code && + other.domain == domain && + const DeepCollectionEquality.unordered() + .equals(other.userInfo, userInfo); + } + + @override + int get hashCode => Object.hash( + code, + domain, + userInfo, + ); +} + +/// Dart wrapper around IAP Kit +/// [PurchaseParameter](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/iap-iap-V5#section1340120344598). +/// +/// Used as the parameter to initiate a payment. In general, a developer should +/// not need to create the payment object explicitly; instead, use +/// [IKPaymentQueueWrapper.addPayment] directly with a product identifier to +/// initiate a payment. +@immutable +@JsonSerializable(createToJson: true) +class IKPaymentWrapper { + /// Creates a new [IKPaymentWrapper] with the provided information. + const IKPaymentWrapper({ + required this.productId, + this.productType, + this.developerPayload, + this.reservedInfo, + this.promotionalOfferId, + this.applicationUserName, + this.jwsRepresentation, + }); + + /// Constructs an instance of this from a key value map of data. + /// + /// The map needs to have named string keys with values matching the names and + /// types of all of the members on this class. The `map` parameter must not be + /// null. + factory IKPaymentWrapper.fromJson(Map map) { + return _$IKPaymentWrapperFromJson(map); + } + + /// Creates a Map object describes the payment object. + Map toMap() { + return { + 'productId': productId, + 'productType': productType, + 'developerPayload': developerPayload, + 'reservedInfo': reservedInfo, + 'promotionalOfferId': promotionalOfferId, + 'applicationUserName': applicationUserName, + 'jwsRepresentation': jwsRepresentation, + }; + } + + /// 待支付的商品ID。商品ID来源于开发者在AppGallery Connect中配置商品信息时设置的“商品ID”,具体请参见配置商品信息。 + final String productId; + + /// 需要查询的商品类型 + final ProductType? productType; + + /// 商户侧保留信息 + final String? developerPayload; + + /// 要求JSON String格式,商户可以将额外需要传入的字段以key-value的形式设置在JSON String中,并通过该参数传入。 + final String? reservedInfo; + + /// 优惠ID。优惠ID来源于开发者在AppGallery Connect中配置商品信息时设置的促销优惠标识符, + /// 具体请参见设置促销价格。传递该字段且要生效,需传递jwsRepresentation字段包含促销优惠信息。 + final String? promotionalOfferId; + + /// 用户账户相关联的混淆字符串,唯一标识用户。传递优惠ID场景,可以传递该字段。 + final String? applicationUserName; + + /// 包含购买参数信息的JWS格式签名数据。购买参数,如促销优惠等。 + final String? jwsRepresentation; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is IKPaymentWrapper && + other.productId == productId && + other.productType == productType && + other.developerPayload == developerPayload && + other.reservedInfo == reservedInfo && + other.promotionalOfferId == promotionalOfferId && + other.applicationUserName == applicationUserName && + other.jwsRepresentation == jwsRepresentation; + } + + @override + int get hashCode => Object.hash(productId, productType, developerPayload, + reservedInfo, promotionalOfferId); + + @override + String toString() => _$IKPaymentWrapperToJson(this).toString(); +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.g.dart new file mode 100644 index 0000000000000000000000000000000000000000..1cd277f1c9b10a2b83274e66cb45d73c0070c4b3 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_queue_wrapper.g.dart @@ -0,0 +1,50 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ik_payment_queue_wrapper.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IKError _$IKErrorFromJson(Map json) => IKError( + code: json['code'] as int? ?? 0, + domain: json['domain'] as String? ?? '', + userInfo: (json['userInfo'] as Map?)?.map( + (k, e) => MapEntry(k as String, e), + ) ?? + {}, + ); + +IKPaymentWrapper _$IKPaymentWrapperFromJson(Map json) => IKPaymentWrapper( + productId: json['productId'] as String? ?? '', + productType: _$IKProductTypeFromInt(json['productType'] as int? ?? 0), + developerPayload: json['developerPayload'] as String?, + reservedInfo: json['reservedInfo'] as String?, + promotionalOfferId: json['promotionalOfferId'] as String?, + applicationUserName: json['applicationUserName'] as String?, + jwsRepresentation: json['jwsRepresentation'] as String?, + ); + +Map _$IKPaymentWrapperToJson(IKPaymentWrapper instance) => + { + 'productId': instance.productId, + 'productType': instance.productType, + 'developerPayload': instance.developerPayload, + 'reservedInfo': instance.reservedInfo, + 'promotionalOfferId': instance.promotionalOfferId, + 'applicationUserName': instance.applicationUserName, + 'jwsRepresentation': instance.jwsRepresentation, + }; + +ProductType _$IKProductTypeFromInt(int type) { + switch (type) { + case 0: + return ProductType.CONSUMABLE; + case 1: + return ProductType.NONCONSUMABLE; + case 3: + return ProductType.AUTORENEWABLE; + default: + return ProductType.CONSUMABLE; + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc34cd9551f989eb46340f5a0137c113df7f6c92 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.dart @@ -0,0 +1,172 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'enum_converters.dart'; +import 'ik_payment_queue_wrapper.dart'; +import 'ik_product_wrapper.dart'; + +part 'ik_payment_transaction_wrappers.g.dart'; + +/// Callback handlers for transaction status changes. +abstract class IKTransactionObserverWrapper { + /// Triggered when any transactions are updated. + void updatedTransactions( + {required List transactions}); + + /// Triggered when any transactions are removed from the payment queue. + void removedTransactions( + {required List transactions}); +} + +/// The state of a transaction. +enum IKPaymentTransactionStateWrapper { + /// Indicates the transaction is being processed in App Store. + /// + /// You should update your UI to indicate that you are waiting for the + /// transaction to update to another state. Never complete a transaction that + /// is still in a purchasing state. + @JsonValue(0) + purchasing, + + /// The user's payment has been succesfully processed. + /// + /// You should provide the user the content that they purchased. + @JsonValue(1) + purchased, + + /// The transaction failed. + /// + /// Check the [IKPaymentTransactionWrapper.error] property from + /// [IKPaymentTransactionWrapper] for details. + @JsonValue(2) + failed, + + /// This transaction is restoring content previously purchased by the user. + /// + /// The previous transaction information can be obtained in + /// [IKPaymentTransactionWrapper.originalTransaction] from + /// [IKPaymentTransactionWrapper]. + @JsonValue(3) + restored, + + /// The transaction is in the queue but pending external action. Wait for + /// another callback to get the final state. + /// + /// You should update your UI to indicate that you are waiting for the + /// transaction to update to another state. + @JsonValue(4) + deferred, + + /// Indicates the transaction is in an unspecified state. + @JsonValue(-1) + unspecified, +} + +/// Created when a payment is added to the [IKPaymentQueueWrapper]. +/// +/// Transactions are delivered to your app when a payment is finished +/// processing. Completed transactions provide a receipt and a transaction +/// identifier that the app can use to save a permanent record of the processed +/// payment. +@JsonSerializable(createToJson: true) +@immutable +class IKPaymentTransactionWrapper { + /// Creates a new [IKPaymentTransactionWrapper] with the provided information. + // TODO(stuartmorgan): Temporarily ignore const warning in other parts of the + // federated package, and remove this. + // ignore: prefer_const_constructors_in_immutables + IKPaymentTransactionWrapper({ + required this.payment, + required this.transactionState, + this.originalTransaction, + this.transactionTimeStamp, + this.transactionIdentifier, + this.error, + }); + + /// Constructs an instance of this from a key value map of data. + /// + /// The map needs to have named string keys with values matching the names and + /// types of all of the members on this class. The `map` parameter must not be + /// null. + factory IKPaymentTransactionWrapper.fromJson(Map map) { + return _$IKPaymentTransactionWrapperFromJson(map); + } + + /// Current transaction state. + @IKTransactionStatusConverter() + final IKPaymentTransactionStateWrapper transactionState; + + /// The payment that has been created and added to the payment queue which + /// generated this transaction. + final IKPaymentWrapper payment; + + /// The original Transaction. + /// + /// Only available if the [transactionState] is [SKPaymentTransactionStateWrapper.restored]. + /// Otherwise the value is `null`. + /// + /// When the [transactionState] + /// is [IKPaymentTransactionStateWrapper.restored], the current transaction + /// object holds a new [transactionIdentifier]. + final IKPaymentTransactionWrapper? originalTransaction; + + /// The timestamp of the transaction. + /// + /// Seconds since epoch. It is only defined when the [transactionState] is + /// [IKPaymentTransactionStateWrapper.purchased] or + /// [IKPaymentTransactionStateWrapper.restored]. + /// Otherwise, the value is `null`. + final double? transactionTimeStamp; + + /// The unique string identifer of the transaction. + /// + /// It is only defined when the [transactionState] is + /// [IKPaymentTransactionStateWrapper.purchased] or + /// [IKPaymentTransactionStateWrapper.restored]. You may wish to record this + /// string as part of an audit trail for App Store purchases. The value of + /// this string corresponds to the same property in the receipt. + /// + /// The value is `null` if it is an unsuccessful transaction. + final String? transactionIdentifier; + + /// The error object + /// + /// Only available if the [transactionState] is + /// [IKPaymentTransactionStateWrapper.failed]. + final IKError? error; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is IKPaymentTransactionWrapper && + other.payment == payment && + other.transactionState == transactionState && + other.originalTransaction == originalTransaction && + other.transactionTimeStamp == transactionTimeStamp && + other.transactionIdentifier == transactionIdentifier && + other.error == error; + } + + @override + int get hashCode => Object.hash(payment, transactionState, + originalTransaction, transactionTimeStamp, transactionIdentifier, error); + + @override + String toString() => _$IKPaymentTransactionWrapperToJson(this).toString(); + + /// The payload that is used to finish this transaction. + Map toFinishMap() => { + 'transactionIdentifier': transactionIdentifier, + 'productIdentifier': payment.productId, + }; +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.g.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.g.dart new file mode 100644 index 0000000000000000000000000000000000000000..9a51a4267cada34f1173bf2cab2411e6fbf5fd6a --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_payment_transaction_wrappers.g.dart @@ -0,0 +1,36 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ik_payment_transaction_wrappers.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IKPaymentTransactionWrapper _$IKPaymentTransactionWrapperFromJson(Map json) => + IKPaymentTransactionWrapper( + payment: IKPaymentWrapper.fromJson( + Map.from(json['payment'] as Map)), + transactionState: const IKTransactionStatusConverter() + .fromJson(json['transactionState'] as int?), + originalTransaction: json['originalTransaction'] == null + ? null + : IKPaymentTransactionWrapper.fromJson( + Map.from(json['originalTransaction'] as Map)), + transactionTimeStamp: (json['transactionTimeStamp'] as num?)?.toDouble(), + transactionIdentifier: json['transactionIdentifier'] as String?, + error: json['error'] == null + ? null + : IKError.fromJson(Map.from(json['error'] as Map)), + ); + +Map _$IKPaymentTransactionWrapperToJson( + IKPaymentTransactionWrapper instance) => + { + 'transactionState': const IKTransactionStatusConverter() + .toJson(instance.transactionState), + 'payment': instance.payment, + 'originalTransaction': instance.originalTransaction, + 'transactionTimeStamp': instance.transactionTimeStamp, + 'transactionIdentifier': instance.transactionIdentifier, + 'error': instance.error, + }; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.dart new file mode 100644 index 0000000000000000000000000000000000000000..057e60ac240a82cfa5087c397a93a5c61f773cfb --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.dart @@ -0,0 +1,279 @@ +// Copyright 2013 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. + +import 'package:collection/collection.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'enum_converters.dart'; + +// WARNING: Changes to `@JsonSerializable` classes need to be reflected in the +// below generated file. Run `flutter packages pub run build_runner watch` to +// rebuild and watch for further changes. +part 'ik_product_wrapper.g.dart'; + +/// Represents the response object returned by [IKRequestMaker.startProductRequest]. +/// Contains information about a list of products and a list of invalid product identifiers. +@JsonSerializable() +@immutable +class IKProductResponseWrapper { + /// Creates an [IKProductResponseWrapper] with the given product details. + // TODO(stuartmorgan): Temporarily ignore const warning in other parts of the + // federated package, and remove this. + // ignore: prefer_const_constructors_in_immutables + IKProductResponseWrapper( + {required this.products, required this.invalidProductIdentifiers}); + + /// Constructing an instance from a map from the Objective-C layer. + /// + /// This method should only be used with `map` values returned by [IKRequestMaker.startProductRequest]. + factory IKProductResponseWrapper.fromJson(Map map) { + var maptt = _$SkProductResponseWrapperFromJson(map); + return _$SkProductResponseWrapperFromJson(map); + } + + /// Stores all matching successfully found products. + /// + /// One product in this list matches one valid product identifier passed to the [IKRequestMaker.startProductRequest]. + /// Will be empty if the [IKRequestMaker.startProductRequest] method does not pass any correct product identifier. + @JsonKey(defaultValue: []) + final List products; + + /// Stores product identifiers in the `productIdentifiers` from [IKRequestMaker.startProductRequest] that are not recognized by the AppGallery. + /// Will be empty if all the product identifiers are valid. + @JsonKey(defaultValue: []) + final List invalidProductIdentifiers; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is IKProductResponseWrapper && + const DeepCollectionEquality().equals(other.products, products) && + const DeepCollectionEquality() + .equals(other.invalidProductIdentifiers, invalidProductIdentifiers); + } + + @override + int get hashCode => Object.hash(products, invalidProductIdentifiers); +} + +/// Used as a property in the [IKProductSubscriptionPeriodWrapper]. Minimum is a day and maximum is a year. +// The values of the enum options are matching the [IKProductPeriodUnit]'s values. Should there be an update or addition +// in the [IKProductPeriodUnit], this need to be updated to match. +enum IKSubscriptionPeriodUnit { + /// An interval lasting one day. + @JsonValue(0) + day, + + /// An interval lasting one month. + @JsonValue(1) + + /// An interval lasting one week. + week, + @JsonValue(2) + + /// An interval lasting one month. + month, + + /// An interval lasting one year. + @JsonValue(3) + year, +} + +/// A period is defined by a [numberOfUnits] and a [unit], e.g for a 3 months period [numberOfUnits] is 3 and [unit] is a month. +/// It is used as a property in [IKProductDiscountWrapper] and [IKProductWrapper]. +@JsonSerializable() +@immutable +class IKProductSubscriptionPeriodWrapper { + /// Creates an [IKProductSubscriptionPeriodWrapper] for a `numberOfUnits`x`unit` period. + // TODO(stuartmorgan): Temporarily ignore const warning in other parts of the + // federated package, and remove this. + // ignore: prefer_const_constructors_in_immutables + IKProductSubscriptionPeriodWrapper( + {required this.numberOfUnits, required this.unit}); + + /// Constructing an instance from a map from the Objective-C layer. + /// + /// This method should only be used with `map` values returned by [IKProductDiscountWrapper.fromJson] or [IKProductWrapper.fromJson]. + factory IKProductSubscriptionPeriodWrapper.fromJson( + Map? map) { + if (map == null) { + return IKProductSubscriptionPeriodWrapper( + numberOfUnits: 0, unit: IKSubscriptionPeriodUnit.day); + } + return _$IKProductSubscriptionPeriodWrapperFromJson(map); + } + + /// The number of [unit] units in this period. + /// + /// Must be greater than 0 if the object is valid. + @JsonKey(defaultValue: 0) + final int numberOfUnits; + + /// The time unit used to specify the length of this period. + @IKSubscriptionPeriodUnitConverter() + final IKSubscriptionPeriodUnit unit; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is IKProductSubscriptionPeriodWrapper && + other.numberOfUnits == numberOfUnits && + other.unit == unit; + } + + @override + int get hashCode => Object.hash(numberOfUnits, unit); +} + +/// This is used as a property in the [IKProductDiscountWrapper]. +// The values of the enum options are matching the [IKProductDiscountPaymentMode]'s values. Should there be an update or addition +// in the [IKProductDiscountPaymentMode], this need to be updated to match. +enum IKProductDiscountPaymentMode { + /// Allows user to pay the discounted price at each payment period. + @JsonValue(0) + payAsYouGo, + + /// Allows user to pay the discounted price upfront and receive the product for the rest of time that was paid for. + @JsonValue(1) + payUpFront, + + /// User pays nothing during the discounted period. + @JsonValue(2) + freeTrail, + + /// Unspecified mode. + @JsonValue(-1) + unspecified, +} + + +/// This is used as a property in the [IKProductDiscountWrapper]. +/// The values of the enum options are matching the [IKProductDiscountType]'s +/// values. +/// +/// Values representing the types of discount offers an app can present. +enum IKProductDiscountType { + /// A constant indicating the discount type is an introductory offer. + @JsonValue(0) + introductory, + + /// A constant indicating the discount type is a promotional offer. + @JsonValue(1) + subscription, +} + +/// Dart wrapper around IAP Kit [Product](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/iap-iap-V5#section346874219313). +/// +/// A list of [IKProductWrapper] is returned in the [IKRequestMaker.startProductRequest] method, and +/// should be stored for use when making a payment. +@JsonSerializable() +@immutable +class IKProductWrapper { + /// Creates an [IKProductWrapper] with the given product details. + // TODO(stuartmorgan): Temporarily ignore const warning in other parts of the + // federated package, and remove this. + // ignore: prefer_const_constructors_in_immutables + IKProductWrapper({ + required this.id, + required this.type, + required this.name, + required this.description, + required this.localPrice, + required this.microPrice, + required this.originalLocalPrice, + required this.originalMicroPrice, + required this.currency, + this.status, + // this.subscriptionInfo, + // this.promotionalOffers, + this.jsonRepresentation, + }); + + /// Constructing an instance from a map from the ets layer. + /// + /// This method should only be used with `map` values returned by [IKProductResponseWrapper.fromJson]. + factory IKProductWrapper.fromJson(Map map) { + return _$IKProductWrapperFromJson(map); + } + + /// 商品ID + final String id; + + /// 商品类型 + final ProductType type; + + /// 商品名称,为配置商品信息时配置的名称。用于显示在应用内支付收银台 + final String name; + + /// 商品描述,即配置商品信息时配置的描述信息 + final String description; + + /// 商品的展示价格,包含商品币种和价格,格式为“币种+商品价格”,例如 EUR 0.15。部分国家/地区会返回“货币符号+商品价格”,例如中国大陆返回“¥0.15”。此价格含税。可选。 + final String localPrice; + + /// 商品实际价格乘以1,000,000后的微单位价格。例如某个商品实际价格是1.99美元,则该商品对应的微单位价格为:1.99*1000000=1990000。 + final int microPrice; + + /// 商品的原价,包含商品币种和价格,格式为“币种+商品价格”,例如 EUR 0.15。部分国家/地区会返回“货币符号+商品价格”,例如中国大陆返回“¥0.15”。此价格含税。 + final String originalLocalPrice; + + /// 商品原价的微单位价格。商品原价乘以1,000,000后的微单位价格。例如某个商品原价是1.99美元,则该商品对应的微单位价格为:1.99*1000000=1990000。 + final int originalMicroPrice; + + /// 用于支付该商品的币种,必须符合ISO 4217标准,例如USD、CNY、MYR。 + final String currency; + + /// 商品状态 + final ProductStatus? status; + + /// 自动续期订阅商品相关的信息。可选。 + // final SubscriptionInfo? subscriptionInfo; + + /// 订阅商品支持的优惠信息列表 + // final PromotionalOffer[]? promotionalOffers; + + /// 商品详细信息的原始JSON字符串 + final String? jsonRepresentation; +} + +/// 商品状态枚举 +enum ProductType { + /// 消耗型商品 + @JsonValue(0) + CONSUMABLE, + + /// 非消耗型商品 + @JsonValue(1) + NONCONSUMABLE, + + /// 自动续期订阅商品 + @JsonValue(3) + AUTORENEWABLE, +} + +/// 商品状态枚举 +enum ProductStatus { + /// 有效状态。 + @JsonValue(0) + VALID, + + /// 取消状态,即删除。此状态的商品不可续订,也不可订阅。 + @JsonValue(1) + CANCELED, + + /// 下线状态,不能订阅,但老用户仍可续订。 + @JsonValue(3) + OFFLINE, +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.g.dart new file mode 100644 index 0000000000000000000000000000000000000000..072612e1c4be955a94c1a46b9a5073fc24575d9f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_product_wrapper.g.dart @@ -0,0 +1,69 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ik_product_wrapper.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IKProductResponseWrapper _$SkProductResponseWrapperFromJson(Map json) => + IKProductResponseWrapper( + products: (json['products'] as List?) + ?.map((e) => IKProductWrapper.fromJson( + Map.from(e as Map))) + .toList() ?? + [], + invalidProductIdentifiers: + (json['invalidProductIdentifiers'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + ); + +IKProductSubscriptionPeriodWrapper _$IKProductSubscriptionPeriodWrapperFromJson( + Map json) => + IKProductSubscriptionPeriodWrapper( + numberOfUnits: json['numberOfUnits'] as int? ?? 0, + unit: const IKSubscriptionPeriodUnitConverter() + .fromJson(json['unit'] as int?), + ); + +IKProductWrapper _$IKProductWrapperFromJson(Map json) => IKProductWrapper( + id: json['id'] as String? ?? '', + type: _$IKProductTypeFromInt(json['type'] as int? ?? 0), + name: json['name'] as String? ?? '', + description: json['description'] as String? ?? '', + localPrice: json['localPrice'] as String? ?? '', + microPrice: json['microPrice'] as int? ?? 0, + originalLocalPrice: json['originalLocalPrice'] as String? ?? '', + originalMicroPrice: json['originalMicroPrice'] as int? ?? 0, + currency: json['currency'] as String? ?? '', + status: _$IKProductStatusFromInt(json['status'] as int? ?? 0), + jsonRepresentation: json['jsonRepresentation'] as String?, + ); + +ProductType _$IKProductTypeFromInt(int type) { + switch (type) { + case 0: + return ProductType.CONSUMABLE; + case 1: + return ProductType.NONCONSUMABLE; + case 3: + return ProductType.AUTORENEWABLE; + default: + return ProductType.CONSUMABLE; + } +} + +ProductStatus _$IKProductStatusFromInt(int type) { + switch (type) { + case 0: + return ProductStatus.VALID; + case 1: + return ProductStatus.CANCELED; + case 3: + return ProductStatus.OFFLINE; + default: + return ProductStatus.VALID; + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_receipt_manager.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_receipt_manager.dart new file mode 100644 index 0000000000000000000000000000000000000000..68feb9e103623e4e13d1ad42b35b99c07651126c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_receipt_manager.dart @@ -0,0 +1,18 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import '../channel.dart'; + +// ignore: avoid_classes_with_only_static_members +/// This class contains static methods to manage StoreKit receipts. +class IKReceiptManager { + /// Retrieve the receipt data from your application's main bundle. + static Future retrieveReceiptData() async { + return (await channel.invokeMethod( + 'iap#retrieveReceiptData')) ?? + ''; + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_request_maker.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_request_maker.dart new file mode 100644 index 0000000000000000000000000000000000000000..0eebfe8362bb047f46293948d574d3bccc96e71b --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/iap_kit_wrappers/ik_request_maker.dart @@ -0,0 +1,46 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:flutter/services.dart'; + +import '../channel.dart'; +import 'ik_product_wrapper.dart'; + +/// A request maker that handles all the requests made by IKRequest subclasses. +class IKRequestMaker { + /// Fetches product information for a list of given product identifiers. + /// + /// The `productIdentifiers` should contain legitimate product identifiers that you declared for the products in the iTunes Connect. Invalid identifiers + /// will be stored and returned in [SkProductResponseWrapper.invalidProductIdentifiers]. Duplicate values in `productIdentifiers` will be omitted. + /// If `productIdentifiers` is null, an `storekit_invalid_argument` error will be returned. If `productIdentifiers` is empty, a [SkProductResponseWrapper] + /// will still be returned with [SkProductResponseWrapper.products] being null. + /// + /// [SkProductResponseWrapper] is returned if there is no error during the request. + /// A [PlatformException] is thrown if the platform code making the request fails. + Future startProductRequest( + List productIdentifiers) async { + final Map? productResponseMap = + await channel.invokeMapMethod( + 'iap#queryProducts', + productIdentifiers, + ); + if (productResponseMap == null) { + throw PlatformException( + code: 'storekit_no_response', + message: 'StoreKit: Failed to get response from platform.', + ); + } + return IKProductResponseWrapper.fromJson(productResponseMap); + } + + Future startRefreshReceiptRequest( + {Map? receiptProperties}) { + return channel.invokeMethod( + 'iap#refreshReceipt', + receiptProperties, + ); + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform.dart new file mode 100644 index 0000000000000000000000000000000000000000..2fa17d603b1554f8269d990456733526a027e372 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform.dart @@ -0,0 +1,219 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +import '../iap_kit_wrappers.dart'; +import '../in_app_purchase_ohos.dart'; + +/// [IAPError.code] code for failed purchases. +const String kPurchaseErrorCode = 'purchase_error'; + +/// Indicates store front is AppGallery. +const String kIAPSource = 'app_gallery'; + +/// An [InAppPurchasePlatform] that wraps IAP Kit. +/// +/// This translates various `IAP Kit` calls and responses into the +/// generic plugin API. +class InAppPurchaseOhosPlatform extends InAppPurchasePlatform { + /// Creates an [InAppPurchaseOhosPlatform] object. + /// + /// This constructor should only be used for testing, for any other purpose + /// get the connection from the [instance] getter. + @visibleForTesting + InAppPurchaseOhosPlatform(); + + static late IKPaymentQueueWrapper _skPaymentQueueWrapper; + static late _TransactionObserver _observer; + + @override + Stream> get purchaseStream => + _observer.purchaseUpdatedController.stream; + + /// Callback handler for transaction status changes. + @visibleForTesting + static IKTransactionObserverWrapper get observer => _observer; + + /// Registers this class as the default instance of [InAppPurchasePlatform]. + static void registerPlatform() { + // Register the [InAppPurchaseOhosPlatformAddition] containing + // IapKit-specific functionality. + InAppPurchasePlatformAddition.instance = + InAppPurchaseOhosPlatformAddition(); + + // Register the platform-specific implementation of the idiomatic + // InAppPurchase API. + InAppPurchasePlatform.instance = InAppPurchaseOhosPlatform(); + + _skPaymentQueueWrapper = IKPaymentQueueWrapper(); + + // Create a purchaseUpdatedController and notify the native side when to + // start of stop sending updates. + final StreamController> updateController = + StreamController>.broadcast( + onListen: () => _skPaymentQueueWrapper.startObservingTransactionQueue(), + onCancel: () => _skPaymentQueueWrapper.stopObservingTransactionQueue(), + ); + _observer = _TransactionObserver(updateController); + _skPaymentQueueWrapper.setTransactionObserver(observer); + } + + @override + Future isAvailable() => IKPaymentQueueWrapper.queryEnvironmentStatus(); + + @override + Future buyNonConsumable({required PurchaseParam purchaseParam}) async { + await _skPaymentQueueWrapper.addPayment( + IKPaymentWrapper(productId: purchaseParam.productDetails.id)); + return true; // There's no error feedback from ohos here to return. + } + + @override + Future buyConsumable( + {required PurchaseParam purchaseParam, bool autoConsume = true}) { + assert(autoConsume == true, 'On ohos, we should always auto consume'); + return buyNonConsumable(purchaseParam: purchaseParam); + } + + @override + Future completePurchase(PurchaseDetails purchase) { + assert( + purchase is AppGalleryPurchaseDetails, + 'On ohos, the `purchase` should always be of type `AppGalleryPurchaseDetails`.', + ); + + return _skPaymentQueueWrapper.finishTransaction( + (purchase as AppGalleryPurchaseDetails).ikPaymentTransaction, + ); + } + + @override + Future restorePurchases({String? applicationUserName}) async { + return _observer + .restoreTransactions( + queue: _skPaymentQueueWrapper, + applicationUserName: applicationUserName) + .whenComplete(() => _observer.cleanUpRestoredTransactions()); + } + + /// Query the product detail list. + /// + /// This method only returns [ProductDetailsResponse]. + /// To get detailed Store Kit product list, use [SkProductResponseWrapper.startProductRequest] + /// to get the [IKProductResponseWrapper]. + @override + Future queryProductDetails( + Set identifiers) async { + final IKRequestMaker requestMaker = IKRequestMaker(); + IKProductResponseWrapper response; + PlatformException? exception; + try { + response = await requestMaker.startProductRequest(identifiers.toList()); + print('InAppPurchasePlugin productDetailResponse response'); + } on PlatformException catch (e) { + exception = e; + response = IKProductResponseWrapper( + products: const [], + invalidProductIdentifiers: identifiers.toList()); + } + List productDetails = + []; + productDetails = response.products + .map((IKProductWrapper productWrapper) => + AppGalleryProductDetails.fromIKProduct(productWrapper)) + .toList(); + List invalidIdentifiers = response.invalidProductIdentifiers; + if (productDetails.isEmpty) { + invalidIdentifiers = identifiers.toList(); + } + final ProductDetailsResponse productDetailsResponse = + ProductDetailsResponse( + productDetails: productDetails, + notFoundIDs: invalidIdentifiers, + error: exception == null + ? null + : IAPError( + source: kIAPSource, + code: exception.code, + message: exception.message ?? '', + details: exception.details), + ); + return productDetailsResponse; + } +} + +enum _TransactionRestoreState { + notRunning, + waitingForTransactions, + receivedTransaction, +} + +class _TransactionObserver implements IKTransactionObserverWrapper { + _TransactionObserver(this.purchaseUpdatedController); + + final StreamController> purchaseUpdatedController; + + Completer? _restoreCompleter; + late String _receiptData; + _TransactionRestoreState _transactionRestoreState = + _TransactionRestoreState.notRunning; + + Future restoreTransactions({ + required IKPaymentQueueWrapper queue, + String? applicationUserName, + }) { + _transactionRestoreState = _TransactionRestoreState.waitingForTransactions; + _restoreCompleter = Completer(); + queue.restoreTransactions(applicationUserName: applicationUserName); + return _restoreCompleter!.future; + } + + void cleanUpRestoredTransactions() { + _restoreCompleter = null; + } + + @override + void updatedTransactions( + {required List transactions}) { + _handleTransationUpdates(transactions); + } + + @override + void removedTransactions( + {required List transactions}) {} + + Future getReceiptData() async { + try { + _receiptData = await IKReceiptManager.retrieveReceiptData(); + } catch (e) { + _receiptData = ''; + } + return _receiptData; + } + + Future _handleTransationUpdates( + List transactions) async { + print('MethodCallHandlerImpl _handleTransationUpdates '); + if (_transactionRestoreState == + _TransactionRestoreState.waitingForTransactions && + transactions.any((IKPaymentTransactionWrapper transaction) => + transaction.transactionState == + IKPaymentTransactionStateWrapper.restored)) { + _transactionRestoreState = _TransactionRestoreState.receivedTransaction; + } + + final String receiptData = await getReceiptData(); + final List purchases = transactions + .map((IKPaymentTransactionWrapper transaction) => + AppGalleryPurchaseDetails.fromIKTransaction( + transaction, receiptData)) + .toList(); + purchaseUpdatedController.add(purchases); + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform_addition.dart new file mode 100644 index 0000000000000000000000000000000000000000..88a0325358931fc30d47a145df61ea217e637344 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/in_app_purchase_ohos_platform_addition.dart @@ -0,0 +1,33 @@ +// Copyright 2013 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. + +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +import '../iap_kit_wrappers.dart'; +import '../in_app_purchase_ohos.dart'; + +/// Contains InApp Purchase features that are only available on ohos. +class InAppPurchaseOhosPlatformAddition + extends InAppPurchasePlatformAddition { + + /// Retry loading purchase data after an initial failure. + /// + /// If no results, a `null` value is returned. + Future refreshPurchaseVerificationData() async { + await IKRequestMaker().startRefreshReceiptRequest(); + try { + final String receipt = await IKReceiptManager.retrieveReceiptData(); + return PurchaseVerificationData( + localVerificationData: receipt, + serverVerificationData: receipt, + source: kIAPSource); + } catch (e) { + // ignore: avoid_print + print( + 'Something is wrong while fetching the receipt, this normally happens when the app is ' + 'running on a simulator: $e'); + return null; + } + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_product_details.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_product_details.dart new file mode 100644 index 0000000000000000000000000000000000000000..907dd328854d84c7c96c39d18cc53aaa19823d8b --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_product_details.dart @@ -0,0 +1,43 @@ +// Copyright 2013 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. + +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +import '../../iap_kit_wrappers.dart'; + +/// The class represents the information of a product as registered in the AppGallery Connect +/// AppGallery. +class AppGalleryProductDetails extends ProductDetails { + /// Creates a new AppStore specific product details object with the provided + /// details. + AppGalleryProductDetails({ + required super.id, + required super.title, + required super.description, + required super.price, + required super.rawPrice, + required super.currencyCode, + required this.skProduct, + required super.currencySymbol, + }); + + factory AppGalleryProductDetails.fromIKProduct(IKProductWrapper product) { + return AppGalleryProductDetails( + id: product.id, + title: product.name, + description: product.description, + price: product.localPrice, + rawPrice: product.microPrice / 1000000.0, + currencyCode: product.currency, + currencySymbol: product.localPrice.isNotEmpty + ? product.localPrice.replaceAll(RegExp(r'[0-9.]+'), "") + : product.currency, + skProduct: product, + ); + } + + /// Points back to the [IKProductWrapper] object that was used to generate + /// this [AppGalleryProductDetails] object. + final IKProductWrapper skProduct; +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_details.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_details.dart new file mode 100644 index 0000000000000000000000000000000000000000..b77ba6d569827b1b2e28f2510702aa1f5396d307 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_details.dart @@ -0,0 +1,79 @@ +// Copyright 2013 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. + +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +import '../../iap_kit_wrappers.dart'; +import '../../in_app_purchase_ohos.dart'; +import '../iap_kit_wrappers/enum_converters.dart'; + +/// The class represents the information of a purchase made with the IAP Kit +/// AppGallery. +class AppGalleryPurchaseDetails extends PurchaseDetails { + /// Creates a new AppStore specific purchase details object with the provided + /// details. + AppGalleryPurchaseDetails({ + super.purchaseID, + required super.productID, + required super.verificationData, + required super.transactionDate, + required this.ikPaymentTransaction, + required PurchaseStatus status, + }) : super(status: status) { + this.status = status; + } + + factory AppGalleryPurchaseDetails.fromIKTransaction( + IKPaymentTransactionWrapper transaction, + String base64EncodedReceipt, + ) { + print('MethodCallHandlerImpl AppGalleryPurchaseDetails.fromIKTransaction '); + final AppGalleryPurchaseDetails purchaseDetails = AppGalleryPurchaseDetails( + productID: transaction.payment.productId, + purchaseID: transaction.transactionIdentifier, + ikPaymentTransaction: transaction, + status: const IKTransactionStatusConverter() + .toPurchaseStatus(transaction.transactionState, transaction.error), + transactionDate: transaction.transactionTimeStamp != null + ? (transaction.transactionTimeStamp! * 1000).toInt().toString() + : null, + verificationData: PurchaseVerificationData( + localVerificationData: base64EncodedReceipt, + serverVerificationData: base64EncodedReceipt, + source: kIAPSource), + ); + var statuus = purchaseDetails.status; + if (purchaseDetails.status == PurchaseStatus.error || + purchaseDetails.status == PurchaseStatus.canceled) { + purchaseDetails.error = IAPError( + source: kIAPSource, + code: kPurchaseErrorCode, + message: transaction.error?.domain ?? '', + details: transaction.error?.userInfo, + ); + } + return purchaseDetails; + } + + /// Points back to the [IKPaymentTransactionWrapper] which was used to + /// generate this [AppStorePurchaseDetails] object. + final IKPaymentTransactionWrapper ikPaymentTransaction; + + late PurchaseStatus _status; + + /// The status that this [PurchaseDetails] is currently on. + @override + PurchaseStatus get status => _status; + + @override + set status(PurchaseStatus status) { + _pendingCompletePurchase = status == PurchaseStatus.purchased; + _status = status; + } + + bool _pendingCompletePurchase = false; + + @override + bool get pendingCompletePurchase => _pendingCompletePurchase; +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_param.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_param.dart new file mode 100644 index 0000000000000000000000000000000000000000..556acab0925a298d23dd341a6b1bb65bad05fa7a --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/app_gallery_purchase_param.dart @@ -0,0 +1,18 @@ +// Copyright 2013 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. + +import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; + +/// Apple AppStore specific parameter object for generating a purchase. +class AppGalleryPurchaseParam extends PurchaseParam { + /// Creates a new [AppGalleryPurchaseParam] object with the given data. + AppGalleryPurchaseParam({ + required super.productDetails, + super.applicationUserName, + this.quantity = 1, + }); + + /// Quantity of the product user requested to buy. + final int quantity; +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/types.dart b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/types.dart new file mode 100644 index 0000000000000000000000000000000000000000..1704a2e9ca59ead77b8dcdf50682906db026f383 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/lib/src/types/types.dart @@ -0,0 +1,7 @@ +// Copyright 2013 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. +// +export 'app_gallery_product_details.dart'; +export 'app_gallery_purchase_details.dart'; +export 'app_gallery_purchase_param.dart'; diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/.gitignore b/packages/in_app_purchase/in_app_purchase_ohos/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/BuildProfile.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..fde84590b4cebb8b75f4d038e944f120c643fe2c --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/BuildProfile.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/Index.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e39f7c8d0372cd1c4654dec5429fb2317a5740e --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/Index.ets @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { InAppPurchasePlugin } from './src/main/ets/components/InAppPurchasePlugin' +export default InAppPurchasePlugin \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/build-profile.json5 b/packages/in_app_purchase/in_app_purchase_ohos/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e6773f9f5d76a66d6d19fddc9c6ddb3f5621d3b1 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + }, + "consumerFiles": [ + "./consumer-rules.txt" + ] + } + }, + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/consumer-rules.txt b/packages/in_app_purchase/in_app_purchase_ohos/ohos/consumer-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/hvigorfile.ts b/packages/in_app_purchase/in_app_purchase_ohos/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..12a327db0aeeb9462eb1dc098f5e808df40e3dce --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/hvigorfile.ts @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/obfuscation-rules.txt b/packages/in_app_purchase/in_app_purchase_ohos/ohos/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/oh-package.json5 b/packages/in_app_purchase/in_app_purchase_ohos/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4c93b2c90164676de09d712d7ba79512dfac8961 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "name": "in_app_purchase", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "Index.ets", + "author": "", + "license": "Apache-2.0", + "dependencies": { + "@ohos/flutter_ohos": "file:../libs/flutter.har" + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/JWTUtil.ts b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/JWTUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f87f4dbc22f2e9acb972ac3ac0b769e3e6b5bbd --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/JWTUtil.ts @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2024 Huawei Technologies Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import { util } from '@kit.ArkTS'; + +const centerLineRegex: RegExp = new RegExp('-', 'g'); +const underLineRegex: RegExp = new RegExp('_', 'g'); +const textDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }); +const base64 = new util.Base64Helper(); +const TAG: string = 'JWTUtil'; + +const BASE64_PAD_MOD = 4; +const BASE64_PAD_INVALID = 1; + +export class JWTUtil { + public static base64Decode(input: string) { + return textDecoder.decodeWithStream(base64.decodeSync(input)); + } + + private static base64UrlDecode(input: string) { + input = input + .replace(centerLineRegex, '+') + .replace(underLineRegex, '/'); + + // Pad out with standard base64 required padding characters + const pad = input.length % BASE64_PAD_MOD; + if (pad) { + if (pad === BASE64_PAD_INVALID) { + throw new Error('InvalidLengthError: Input base64url string is the wrong length to determine padding'); + } + input += new Array(5 - pad).join('='); + } + return this.base64Decode(input); + } + + public static decodeJwtObj(data: string) { + let jwt: string[] = data.split("."); + let exp: string = ""; + if (jwt.length < 3) { + return exp; + } + try { + exp = JWTUtil.base64UrlDecode(jwt[1]); + } catch (err) { + console.error(TAG, 'decodeJwtObj parse err: ' + JSON.stringify(err)); + } + return exp; + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/TsUtil.ts b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/TsUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..17ddb00ee72c59457f8c257ef9175c139ed6720f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/common/TsUtil.ts @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +export function ObjToMap(obj: Object): Map { + const map = new Map(); + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + map.set(key, obj[key]); + } + } + return map +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/InAppPurchasePlugin.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/InAppPurchasePlugin.ets new file mode 100644 index 0000000000000000000000000000000000000000..acc2a6683ac2115b91ceb8988fd05dc248296b34 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/InAppPurchasePlugin.ets @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { + AbilityAware, + AbilityPluginBinding, + FlutterPlugin, + FlutterPluginBinding, + BinaryMessenger, + Log, + MethodChannel, +} from '@ohos/flutter_ohos'; +import { common } from '@kit.AbilityKit'; +import { MethodCallHandlerImpl } from './MethodCallHandlerImpl'; + +const TAG = "InAppPurchasePlugin" + +export class InAppPurchasePlugin implements FlutterPlugin, AbilityAware { + private methodChannel: MethodChannel | null = null + private methodCallHandler: MethodCallHandlerImpl | null = null + private context: common.UIAbilityContext | null = null + + onAttachedToEngine(binding: FlutterPluginBinding): void { + this.setUpMethodChannel(binding.getBinaryMessenger(), binding.getApplicationContext()); + } + + onDetachedFromEngine(binding: FlutterPluginBinding): void { + this.teardownMethodChannel(); + } + + onAttachedToAbility(binding: AbilityPluginBinding): void { + this.context = binding.getAbility().context + this.methodCallHandler?.setContext(this.context) + } + + onDetachedFromAbility(): void { + this.methodCallHandler?.setContext(null) + } + + getUniqueClassName(): string { + return TAG + } + + setUpMethodChannel(messenger: BinaryMessenger, context: common.Context) { + this.methodChannel = new MethodChannel(messenger, "plugins.flutter.io/in_app_purchase"); + this.methodCallHandler = + new MethodCallHandlerImpl(context, this.methodChannel); + this.methodChannel.setMethodCallHandler(this.methodCallHandler); + } + + teardownMethodChannel() { + this.methodChannel?.setMethodCallHandler(null); + this.methodChannel = null; + this.methodCallHandler = null; + this.context = null; + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodCallHandlerImpl.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodCallHandlerImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..28b3aeff9beb0345c645ce9998560b3a35ba54b1 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodCallHandlerImpl.ets @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { MethodCall, MethodCallHandler, MethodChannel, MethodResult, Log, Any } from '@ohos/flutter_ohos'; +import { MethodNames } from './MethodNames'; +import { iap } from '@kit.IAPKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { common } from '@kit.AbilityKit'; +import { ProductType } from './ProductType'; +import { JWTUtil } from '../common/JWTUtil'; +import { PurchaseOrderPayload, PurchaseSubGroupStatusPayload } from './PurchaseOrderPayload'; +import { HashMap } from '@kit.ArkTS'; +import { TransactionState } from './TransactionState'; +import { PurchaseData } from './PurchaseData'; +import { ObjToMap } from '../common/TsUtil'; + +const TAG = "MethodCallHandlerImpl" + +export class IKError { + code: number = 0 + domain: string = '' + userInfo: Map = new Map() +} + +export class MethodCallHandlerImpl implements MethodCallHandler { + private context: common.UIAbilityContext | null = null + private methodChannel: MethodChannel + private observer: MethodChannel | null = null + private productDetailsMap: HashMap = new HashMap() + + constructor(context: common.Context, methodChannel: MethodChannel) { + this.methodChannel = methodChannel + } + + setContext(context: common.UIAbilityContext | null) { + this.context = context + } + + onMethodCall(call: MethodCall, result: MethodResult): void { + switch (call.method) { + case MethodNames.START_OBSERVING_TRANSACTION_QUEUE: + this.startObserver() + break; + case MethodNames.STOP_OBSERVING_TRANSACTION_QUEUE: + this.stopObserver() + break; + case MethodNames.QUERY_ENVIRONMENT_STATUS: + this.isFeatureSupported(result) + break; + case MethodNames.QUERY_PRODUCTS: + let productList: Array = call.args as Array ?? [] + this.queryProductDetails(productList, result) + break; + case MethodNames.CREATE_PURCHASE: + this.purchaseGoods(call.args, result) + break; + case MethodNames.RETRIEVE_RECEIPT_DATA: + result.success(null) + break; + case MethodNames.FINISH_PURCHASE: + this.iapFinishPurchase(call, result) + break; + default: + result.notImplemented(); + } + } + + isFeatureSupported(result: MethodResult): void { + try { + iap.queryEnvironmentStatus(this.context).then(() => { + result.success(true); + }).catch((err: BusinessError) => { + Log.e(TAG, `Failed to query environment status. Code is ${err.code}, message is ${err.message}`); + result.success(false); + }) + } catch (e) { + Log.e(TAG, `Failed to query environment status. err: ${JSON.stringify(e)}`); + result.success(false); + } + } + + queryProductDetails(list: Array, result: MethodResult) { + let productList: Array> = [] + let count: number = 0 + let validProductsList: Array = [] + let invalidProductIdentifiers: Array = [] + ProductType.forEach((type) => { + const queryProductParam: iap.QueryProductsParameter = { + productType: type, + productIds: list + }; + iap.queryProducts(this.context, queryProductParam).then((result) => { + let resultTemp = result.map((value) => { + validProductsList.push(value.id) + this.productDetailsMap.set(value.id, value) + return ObjToMap(value) + }) + productList.push(...resultTemp) + }).catch((err: BusinessError) => { + Log.e(TAG, `Failed to query products. Code is ${err.code}, message is ${err.message}`); + }).finally(() => { + count++ + if (count === ProductType.length) { + let productDetailsResponse: HashMap = new HashMap() + productDetailsResponse.set('products', productList) + list.forEach((id) => { + if (!validProductsList.includes(id)) { + invalidProductIdentifiers.push(id) + } + }) + productDetailsResponse.set('invalidProductIdentifiers', invalidProductIdentifiers) + result.success(productDetailsResponse) + } + }) + }) + } + + purchaseGoods(args: Any, result: MethodResult) { + let map: Map = args as Map + let id: string = map.get('productId') as string + // 拉起支付接口前更新状态为支付中 + let mapRes: Map = new Map() + mapRes.set('payment', args) + mapRes.set('transactionState', TransactionState.purchasing) + this.observer?.invokeMethod('updatedTransactions', [mapRes]) + this.createPurchase(id, map, result) + } + + createPurchase(id: string, args: Map, result: MethodResult) { + try { + const type = this.productDetailsMap.get(id).type + let createPurchaseParam: iap.PurchaseParameter = { + productId: id, + productType: type, + } + iap.createPurchase(this.context, createPurchaseParam).then(async (createPurchaseResult) => { + let type: number = JSON.parse(createPurchaseResult.purchaseData).type + if (type == iap.ProductType.AUTORENEWABLE) { + let jwsSubscriptionStatus: string = JSON.parse(createPurchaseResult.purchaseData).jwsSubscriptionStatus; + let purchaseStr = JWTUtil.decodeJwtObj(jwsSubscriptionStatus); + let purchaseOrderPayload = JSON.parse(purchaseStr) as PurchaseSubGroupStatusPayload; + let map: Map = new Map(); + map.set('payment', args) + map.set('transactionIdentifier', + purchaseOrderPayload.lastSubscriptionStatus?.lastPurchaseOrder.purchaseOrderId) + map.set('transactionState', TransactionState.purchased) + this.observer?.invokeMethod('updatedTransactions', [map]) + } else if (type == iap.ProductType.CONSUMABLE || type == iap.ProductType.NONCONSUMABLE) { + let jwsPurchaseOrder: string = JSON.parse(createPurchaseResult.purchaseData).jwsPurchaseOrder; + let purchaseStr = JWTUtil.decodeJwtObj(jwsPurchaseOrder); + let purchaseOrderPayload = JSON.parse(purchaseStr) as PurchaseOrderPayload; + let map: Map = new Map(); + map.set('payment', args) + map.set('transactionIdentifier', purchaseOrderPayload.purchaseOrderId) + map.set('transactionState', TransactionState.purchased) + this.observer?.invokeMethod('updatedTransactions', [map]) + } + result.success(null) + }).catch((err: BusinessError) => { + Log.e(TAG, `Failed to create purchase1. Code is ${err.code}, message is ${err.message}`); + this.errorPurchase(args, err); + }) + } catch (err) { + const e: BusinessError = err as BusinessError; + const msg: string = `Failed to create purchase. Code is ${e.code}, message is ${e.message}`; + Log.e(TAG, msg); + this.errorPurchase(args, err); + } + } + + errorPurchase(args: Map, err: BusinessError) { + let map: Map = new Map(); + let iKError: IKError = new IKError() + if (err) { + iKError.code = err.code + iKError.domain = err.message + } + map.set('error', iKError) + map.set('payment', args) + map.set('transactionState', TransactionState.failed) + this.observer?.invokeMethod('updatedTransactions', [map]) + } + + finishPurchase(productType: iap.ProductType, purchaseToken: string, purchaseOrderId: string, result?: MethodResult) { + let finishPurchaseParam: iap.FinishPurchaseParameter = { + productType: productType, + purchaseToken: purchaseToken, + purchaseOrderId: purchaseOrderId + }; + iap.finishPurchase(this.context, finishPurchaseParam).then(() => { + Log.i(TAG, 'Succeeded in finishing purchase.'); + result?.success(true); + }).catch((err: BusinessError) => { + Log.e(TAG, `Failed to finish purchase. Code is ${err.code}, message is ${err.message}`); + result?.error('' + err.code, err.message, err); + }); + } + + queryPurchasesAsync(productType: iap.ProductType, result: MethodResult) { + let param: iap.QueryPurchasesParameter = { + productType: productType, + queryType: iap.PurchaseQueryType.UNFINISHED + }; + iap.queryPurchases(this.context, param).then((res: iap.QueryPurchaseResult) => { + let purchaseDataList: string[] = res.purchaseDataList; + if (purchaseDataList === undefined || purchaseDataList.length <= 0) { + /* 购买成功后, 查询不到购买订单 返回失败. */ + Log.i(TAG, 'queryPurchases, purchaseDataList empty'); + result.error('UNAVAILABLE', 'purchaseDataList empty!', null); + return; + } + this.purchaseCompletionByTypeProcessing(purchaseDataList, result) + }).catch((err: BusinessError) => { + Log.e(TAG, `Failed to query purchases. Code is ${err.code}, message is ${err.message}`); + result.error('' + err.code, err.message, err); + }); + } + + purchaseCompletionByTypeProcessing(purchaseDataList: string[], result: MethodResult) { + for (let i = 0; i < purchaseDataList.length; i++) { + let purchaseData = purchaseDataList[i]; + let type: number = JSON.parse(purchaseData).type + let purchaseToken = '' + let purchaseOrderId = '' + //自动订阅类型 + if (type == iap.ProductType.AUTORENEWABLE) { + let jwsSubscriptionStatus = (JSON.parse(purchaseData) as PurchaseData).jwsSubscriptionStatus; + if (!jwsSubscriptionStatus) { + Log.e(TAG, 'queryPurchases, jwsSubscriptionStatus invalid'); + continue; + } + let purchaseStr = JWTUtil.decodeJwtObj(jwsSubscriptionStatus); + let purchaseOrderPayload = JSON.parse(purchaseStr) as PurchaseSubGroupStatusPayload; + if (purchaseOrderPayload.lastSubscriptionStatus) { + purchaseToken = purchaseOrderPayload.lastSubscriptionStatus.purchaseToken + purchaseOrderId = purchaseOrderPayload.lastSubscriptionStatus.lastPurchaseOrder.purchaseOrderId + } + } else { + //非自动订阅类型 + let jwsPurchaseOrder = (JSON.parse(purchaseData) as PurchaseData).jwsPurchaseOrder; + if (!jwsPurchaseOrder) { + Log.e(TAG, 'queryPurchases, jwsPurchaseOrder invalid'); + continue; + } + let purchaseStr = JWTUtil.decodeJwtObj(jwsPurchaseOrder); + let purchaseOrderPayload = JSON.parse(purchaseStr) as PurchaseOrderPayload; + purchaseToken = purchaseOrderPayload.purchaseToken + purchaseOrderId = purchaseOrderPayload.purchaseOrderId + } + this.finishPurchase(type, purchaseToken, purchaseOrderId, result); + } + } + + iapFinishPurchase(call: MethodCall, result: MethodResult) { + let finishPurchaseMap: Map = call.args as Map + let productIdentifier: string = finishPurchaseMap.get('productIdentifier') as string + let product: iap.Product = this.productDetailsMap.get(productIdentifier) + // let productType: string = finishPurchaseMap.get('productType') as string + let productType: iap.ProductType = product.type + if (!product) { + Log.i(TAG, `Failed to get productType.`); + result.error('UNAVAILABLE', 'productType is null!', null); + return; + } else { + this.queryPurchasesAsync(productType, result); + } + } + + startObserver() { + this.observer = this.methodChannel + } + + stopObserver() { + this.observer = null + } +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodNames.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodNames.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c6e415b1da952b8ed70d0c654b4fc2ab19d91f9 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/MethodNames.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +export class MethodNames { + static QUERY_ENVIRONMENT_STATUS: string = "iap#queryEnvironmentStatus"; + static QUERY_PRODUCTS: string = "iap#queryProducts"; + static CREATE_PURCHASE: string = "iap#createPurchase"; + static START_OBSERVING_TRANSACTION_QUEUE: string = "iap#startObservingTransactionQueue"; + static STOP_OBSERVING_TRANSACTION_QUEUE: string = "iap#stopObservingTransactionQueue"; + static RETRIEVE_RECEIPT_DATA: string = "iap#retrieveReceiptData"; + static TRANSACTIONS: string = "iap#transactions"; + static FINISH_PURCHASE: string = "iap#finishPurchase"; + static RESTORE_TRANSACTIONS: string = "iap#restoreTransactions"; +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/ProductType.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/ProductType.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ca4c1205a2503749f95c40a9f99be343bfc9b62 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/ProductType.ets @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { iap } from '@kit.IAPKit' +export const ProductType: Array = [ + iap.ProductType.CONSUMABLE, + iap.ProductType.NONCONSUMABLE, + iap.ProductType.AUTORENEWABLE +] \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseData.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseData.ets new file mode 100644 index 0000000000000000000000000000000000000000..8440c438ec9c4e4c6acaf59754c5c22ffd76d600 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseData.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +export interface PurchaseData { + type: number; + jwsPurchaseOrder?: string; + jwsSubscriptionStatus?: string; +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseOrderPayload.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseOrderPayload.ets new file mode 100644 index 0000000000000000000000000000000000000000..05fa8036fb1af5e633e2ebc0222a85a6354f9696 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/PurchaseOrderPayload.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { Any } from '@ohos/flutter_ohos'; + +export class PurchaseOrderPayload { + applicationId: string = ''; + countryCode: string = ''; + environment: string = ''; + payOrderId: string = ''; + price: number = 0; + productId: string = ''; + productType: number = 0; + purchaseOrderId: string = ''; + purchaseTime: number = 0; + purchaseToken: string = ''; + signedTime: number = 0; +} + +export class PurchaseSubGroupStatusPayload { + environment: string = ''; + applicationId: string = ''; + packageName: string = ''; + subGroupId: string = ''; + lastSubscriptionStatus?: PurchaseSubscriptionStatus; + historySubscriptionStatusList?: Any[] = []; +} + +export class PurchaseSubscriptionStatus { + subGroupGenerationId: string = ''; + subscriptionId: string = ''; + purchaseToken: string = ''; + status: string = ''; + expiresTime: number = 0; + lastPurchaseOrder?: Any = {}; + recentPurchaseOrderList?: Any[] = []; + renewalInfo?: Any = {}; +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/TransactionState.ts b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/TransactionState.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9a82a173075e7be1d8487bcd0aecb3426ef9387 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/ets/components/TransactionState.ts @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +export enum TransactionState { + purchasing = 0, + purchased = 1, + failed = 2, + restored = 3, + deferred = 4, + unspecified = -1, +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/module.json5 b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..098fbca2fca6d6869d1c7c7eec4f00fa8f10663f --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "in_app_purchase_ohos", + "type": "har", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ] + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/base/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from package" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/en_US/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/en_US/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from package" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/zh_CN/element/string.json b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from package" + } + ] +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/Ability.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..40eab016e599b3fde160825d05015e9388598f93 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/List.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a88ef7e80505428a44812fceb130b4f31d51960d --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/module.json5 b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7b2341f33368780796dabc95e347a14bc5d0f7d8 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/ohosTest/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "in_app_purchase_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/List.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3f1904373eb8182a07290c5b9a1287d1a9dd219 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/LocalUnit.test.ets b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..13b2128b8428b9368a257451baf665e38434bbac --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/ohos/src/test/LocalUnit.test.ets @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/packages/in_app_purchase/in_app_purchase_ohos/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_ohos/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1eef2cb8b149e712ddef32f9e1a0dd9aa2dbb62b --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_ohos/pubspec.yaml @@ -0,0 +1,35 @@ +name: in_app_purchase_ohos +description: An implementation for the Ohos platform of the Flutter `in_app_purchase` plugin. This uses the ohoa IAPKit APIs. +repository: https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/in_app_purchase/in_app_purchase_ohos +issue_tracker: https://gitee.com/openharmony-sig/flutter_packages/issues +version: 0.1.0 + +environment: + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" + +flutter: + plugin: + implements: in_app_purchase + platforms: + ohos: + pluginClass: InAppPurchasePlugin + +dependencies: + collection: ^1.15.0 + flutter: + sdk: flutter + in_app_purchase_platform_interface: ^1.3.0 + json_annotation: ^4.8.0 + +dev_dependencies: + build_runner: ^2.0.0 + flutter_test: + sdk: flutter + json_serializable: ^6.3.1 + mockito: 5.4.0 + test: ^1.16.0 + +topics: + - in-app-purchase + - payment diff --git a/packages/local_auth/local_auth_ohos/.gitignore b/packages/local_auth/local_auth_ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7ec225305d1580562b9856e4c9e0488a2ea19b63 --- /dev/null +++ b/packages/local_auth/local_auth_ohos/.gitignore @@ -0,0 +1,51 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/local_auth/local_auth_ohos/example/ohos/build-profile.json5 b/packages/local_auth/local_auth_ohos/example/ohos/build-profile.json5 index 05be14e57d9b7372db69f8fdf2d8cd60e5187b5f..d209fee432db4515940449ca8f4516144ae32cf6 100644 --- a/packages/local_auth/local_auth_ohos/example/ohos/build-profile.json5 +++ b/packages/local_auth/local_auth_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ], diff --git a/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/local_auth/local_auth_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/local_auth/local_auth_ohos/example/ohos/hvigorw b/packages/local_auth/local_auth_ohos/example/ohos/hvigorw deleted file mode 100755 index 89ac7a4d160b955293e84eb59315b3836fb0eb8d..0000000000000000000000000000000000000000 --- a/packages/local_auth/local_auth_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME="`pwd -P`" -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/local_auth/local_auth_ohos/example/ohos/hvigorw.bat b/packages/local_auth/local_auth_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 31c9e4ba042b35231078bdba338946fe8bc9085b..0000000000000000000000000000000000000000 --- a/packages/local_auth/local_auth_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" "%WRAPPER_MODULE_PATH%" %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/local_auth/local_auth_ohos/example/ohos/oh-package.json5 b/packages/local_auth/local_auth_ohos/example/ohos/oh-package.json5 index 0aa78a0033c8e8176a7aa6b0a9f643b40c3bfe20..595d99e8527dbb41dbbb649a703609f64a6154c4 100644 --- a/packages/local_auth/local_auth_ohos/example/ohos/oh-package.json5 +++ b/packages/local_auth/local_auth_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "local_auth_ohos_example", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/local_auth/local_auth_ohos/lib/types/auth_messages_ohos.dart b/packages/local_auth/local_auth_ohos/lib/types/auth_messages_ohos.dart index f2919282a87f673bfcd921ac15bed8b25794a7b0..c9a53a4965d29b5a91fc2a38aa602f5e0391ea80 100644 --- a/packages/local_auth/local_auth_ohos/lib/types/auth_messages_ohos.dart +++ b/packages/local_auth/local_auth_ohos/lib/types/auth_messages_ohos.dart @@ -23,6 +23,7 @@ class OhosAuthMessages extends AuthMessages { this.goToSettingsButton, this.goToSettingsDescription, this.signInTitle, + this.authType, }); /// Hint message advising the user how to authenticate with biometrics. @@ -70,6 +71,10 @@ class OhosAuthMessages extends AuthMessages { /// Maximum 60 characters. final String? signInTitle; + /// This is used to select the biometric type: + /// FACE、FINGERPRINT、PIN. + final String? authType; + @override Map get args { return { @@ -88,6 +93,7 @@ class OhosAuthMessages extends AuthMessages { 'goToSettingDescription': goToSettingsDescription ?? ohosGoToSettingsDescription, 'signInTitle': signInTitle ?? ohosSignInTitle, + 'authType': authType ?? '', }; } @@ -107,7 +113,8 @@ class OhosAuthMessages extends AuthMessages { other.deviceCredentialsSetupDescription && goToSettingsButton == other.goToSettingsButton && goToSettingsDescription == other.goToSettingsDescription && - signInTitle == other.signInTitle; + signInTitle == other.signInTitle && + authType == other.authType; @override int get hashCode => Object.hash( @@ -121,7 +128,8 @@ class OhosAuthMessages extends AuthMessages { deviceCredentialsSetupDescription, goToSettingsButton, goToSettingsDescription, - signInTitle); + signInTitle, + authType); } // Default strings for OhosAuthMessages. Currently supports English. diff --git a/packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/AuthenticationHelper.ets b/packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/AuthenticationHelper.ets index a91e55a30f338464883001ee724a287429abf642..c15934f2123ed98875f898bb74b25d021cc40d81 100644 --- a/packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/AuthenticationHelper.ets +++ b/packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/AuthenticationHelper.ets @@ -56,13 +56,28 @@ export class AuthenticationHelper { if (allowCredentials) { this.authParam = { challenge: new Uint8Array([49, 49, 49, 49, 49, 49]), - authType: [ - userAuth.UserAuthType.FINGERPRINT, - userAuth.UserAuthType.FACE, - userAuth.UserAuthType.PIN - ], + authType: [], authTrustLevel: userAuth.AuthTrustLevel.ATL1, }; + const argAuthType:string = call.argument("authType") + switch (argAuthType) { + case 'FACE': + this.authParam.authType.push(userAuth.UserAuthType.FACE); + break; + case 'FINGERPRINT': + this.authParam.authType.push(userAuth.UserAuthType.FINGERPRINT); + break; + case 'PIN': + this.authParam.authType.push(userAuth.UserAuthType.PIN); + break; + default: + this.authParam.authType = [ + userAuth.UserAuthType.FINGERPRINT, + userAuth.UserAuthType.FACE, + userAuth.UserAuthType.PIN + ]; + break; + } this.widgetParam = { title: call.argument("localizedReason"), } diff --git a/packages/path_provider/path_provider_ohos/.gitignore b/packages/path_provider/path_provider_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..6665baf5ad7de7fd7352c04cfa1b6d9e318a73c9 100644 --- a/packages/path_provider/path_provider_ohos/.gitignore +++ b/packages/path_provider/path_provider_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 diff --git a/packages/path_provider/path_provider_ohos/example/ohos/build-profile.json5 b/packages/path_provider/path_provider_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/path_provider/path_provider_ohos/example/ohos/build-profile.json5 +++ b/packages/path_provider/path_provider_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/path_provider/path_provider_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/path_provider/path_provider_ohos/example/ohos/hvigorw b/packages/path_provider/path_provider_ohos/example/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/path_provider/path_provider_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/path_provider/path_provider_ohos/example/ohos/hvigorw.bat b/packages/path_provider/path_provider_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 5799f5498ae79096ba616bd383f7fe0523a90528..0000000000000000000000000000000000000000 --- a/packages/path_provider/path_provider_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/path_provider/path_provider_ohos/example/ohos/oh-package.json5 b/packages/path_provider/path_provider_ohos/example/ohos/oh-package.json5 index e585e0e793f17b41162cf8a1244974da50b9e69e..8f72a6f6c86d7c91b97dd324494dda410ec79c80 100644 --- a/packages/path_provider/path_provider_ohos/example/ohos/oh-package.json5 +++ b/packages/path_provider/path_provider_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/pigeon/example/app/ohos/build-profile.json5 b/packages/pigeon/example/app/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/pigeon/example/app/ohos/build-profile.json5 +++ b/packages/pigeon/example/app/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/pigeon/example/app/ohos/hvigor/hvigor-config.json5 b/packages/pigeon/example/app/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/pigeon/example/app/ohos/hvigor/hvigor-config.json5 +++ b/packages/pigeon/example/app/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/pigeon/example/app/ohos/hvigor/hvigor-wrapper.js b/packages/pigeon/example/app/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/pigeon/example/app/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/pigeon/example/app/ohos/hvigorw b/packages/pigeon/example/app/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/pigeon/example/app/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/pigeon/example/app/ohos/hvigorw.bat b/packages/pigeon/example/app/ohos/hvigorw.bat deleted file mode 100644 index 015ad7171d03a3c644d8ca0202c6d72313ba2a34..0000000000000000000000000000000000000000 --- a/packages/pigeon/example/app/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/pigeon/example/app/ohos/oh-package.json5 b/packages/pigeon/example/app/ohos/oh-package.json5 index e585e0e793f17b41162cf8a1244974da50b9e69e..8f72a6f6c86d7c91b97dd324494dda410ec79c80 100644 --- a/packages/pigeon/example/app/ohos/oh-package.json5 +++ b/packages/pigeon/example/app/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/pigeon/lib/arkts_generator.dart b/packages/pigeon/lib/arkts_generator.dart index fade1501432a0627f9a5a703735529e6ce940e2b..63d3cda31967781c0cedc6c791b050f206193c60 100644 --- a/packages/pigeon/lib/arkts_generator.dart +++ b/packages/pigeon/lib/arkts_generator.dart @@ -283,6 +283,8 @@ if (this.$fieldName instanceof Array) { if (customEnumNames.contains(field.type.baseName)) { indent.add( '${field.type.baseName}[${field.type.baseName}[arr[$i] as number]]'); + } else if (customClassNames.contains(field.type.baseName)) { + indent.add('arr[$i] instanceof Array ? ${field.type.baseName}.fromList(arr[$i] as Object[]) : null'); } else { final String type = _arkTSTypeForDartType(field.type); indent.add('arr[$i] as $type'); @@ -503,11 +505,7 @@ if (this.$fieldName instanceof Array) { indent.nest(2, () { indent .write('binaryMessenger, "$channelName", ${api.name}.getCodec()'); - if (taskQueue != null) { - indent.addln(', $taskQueue);'); - } else { - indent.addln(');'); - } + indent.addln(');'); }); }); indent.write('if (api != null) '); diff --git a/packages/platform/lib/src/interface/platform.dart b/packages/platform/lib/src/interface/platform.dart index dcc47be82a389b76fa635a01f832a66c9f6e4c03..50525f3c909d0f22af57c5c8104f86b37df7b787 100644 --- a/packages/platform/lib/src/interface/platform.dart +++ b/packages/platform/lib/src/interface/platform.dart @@ -59,6 +59,14 @@ abstract class Platform { /// To just check if the platform is Fuchsia, use [isFuchsia]. static const String fuchsia = 'fuchsia'; + /// A string constant to compare with [operatingSystem] to see if the platform + /// is Ohos. + /// + /// Useful in case statements when switching on [operatingSystem]. + /// + /// To just check if the platform is Ohos, use [isOhos]. + static const String ohos = 'ohos'; + /// A list of the possible values that [operatingSystem] can return. static const List operatingSystemValues = [ linux, @@ -67,6 +75,7 @@ abstract class Platform { android, iOS, fuchsia, + ohos ]; /// The number of processors of the machine. @@ -109,6 +118,9 @@ abstract class Platform { /// True if the operating system is Fuchsia bool get isFuchsia => operatingSystem == fuchsia; + /// True if the operating system is Ohos. + bool get isOhos => operatingSystem == ohos; + /// The environment for this process. /// /// The returned environment is an unmodifiable map whose content is diff --git a/packages/shared_preferences/shared_preferences_ohos/.gitignore b/packages/shared_preferences/shared_preferences_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..6665baf5ad7de7fd7352c04cfa1b6d9e318a73c9 100644 --- a/packages/shared_preferences/shared_preferences_ohos/.gitignore +++ b/packages/shared_preferences/shared_preferences_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/build-profile.json5 b/packages/shared_preferences/shared_preferences_ohos/example/ohos/build-profile.json5 index 05be14e57d9b7372db69f8fdf2d8cd60e5187b5f..d209fee432db4515940449ca8f4516144ae32cf6 100644 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/build-profile.json5 +++ b/packages/shared_preferences/shared_preferences_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ], diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw b/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw deleted file mode 100755 index 1f9378f2393618e98c87f3a0c4a70477c64da2be..0000000000000000000000000000000000000000 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw.bat b/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 5799f5498ae79096ba616bd383f7fe0523a90528..0000000000000000000000000000000000000000 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/shared_preferences/shared_preferences_ohos/example/ohos/oh-package.json5 b/packages/shared_preferences/shared_preferences_ohos/example/ohos/oh-package.json5 index cf95ec8c277f25d0a2bfc1a0f7ac2219b005f747..fbb4d868380927cef39f89209982af76516df1d1 100644 --- a/packages/shared_preferences/shared_preferences_ohos/example/ohos/oh-package.json5 +++ b/packages/shared_preferences/shared_preferences_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "license": "", "devDependencies": { "@ohos/hypium": "1.0.6" diff --git a/packages/shared_preferences/shared_preferences_ohos/lib/shared_preferences_ohos.dart b/packages/shared_preferences/shared_preferences_ohos/lib/shared_preferences_ohos.dart index 20010b248af81cf9e8a4dfe4a3776e66b33495ac..7cb24dad496ef6e993c57924bf90af563b98b1e5 100644 --- a/packages/shared_preferences/shared_preferences_ohos/lib/shared_preferences_ohos.dart +++ b/packages/shared_preferences/shared_preferences_ohos/lib/shared_preferences_ohos.dart @@ -37,6 +37,7 @@ class SharedPreferencesOhos extends SharedPreferencesStorePlatform { } static const String _defaultPrefix = 'flutter.'; + static const String _doublePrefix = "VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIGRvdWJsZS4"; @override Future remove(String key) async { @@ -47,13 +48,18 @@ class SharedPreferencesOhos extends SharedPreferencesStorePlatform { Future setValue(String valueType, String key, Object value) async { switch (valueType) { case 'String': + if((value as String).startsWith(_doublePrefix)) { + throw PlatformException( + code: 'InvalidOperation', + message: 'StorageError: This string cannot be stored as it clashes with special identifier prefixes'); + } return _api.setString(key, value as String); case 'Bool': return _api.setBool(key, value as bool); case 'Int': return _api.setInt(key, value as int); case 'Double': - return _api.setDouble(key, value as double); + return _api.setString(key, "$_doublePrefix$value"); case 'StringList': return _api.setStringList(key, value as List); } @@ -106,8 +112,14 @@ class SharedPreferencesOhos extends SharedPreferencesStorePlatform { Future> getAllWithParameters( GetAllParameters parameters) async { final PreferencesFilter filter = parameters.filter; - final Map data = + Map data = await _api.getAll(filter.prefix, filter.allowList?.toList()); + data = data.map((key, value) { + if(value is String && value.startsWith(_doublePrefix)) { + return MapEntry(key, double.tryParse(value.substring(_doublePrefix.length))); + } + return MapEntry(key, value); + }); return data.cast(); } } diff --git a/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets b/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets index 1e74be4651efb46ee1b66c5d5038bf523b3e0429..89837853015b4c57c4b823f7996a29fe27360790 100644 --- a/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets +++ b/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets @@ -251,18 +251,20 @@ export default class SharedPreferencesOhosPlugin implements FlutterPlugin, Share remove(key: string): boolean { try { - this.preferences?.delete(key, (err: ESObject) => { + let result = true + this.preferences?.delete(key,async (err: ESObject) => { if (err) { Log.w(TAG, "Failed to delete. message =" + err.message); - return false; + result = false; } Log.i(TAG, "Succeeded in deleting."); - return true; + await this.preferences?.flush(); }) + return result; } catch (err) { Log.e(TAG, "Failed to delete. " + JSON.stringify(err)); + return false; } - return false; } setString(key: string, value: string): Promise { @@ -408,9 +410,8 @@ export default class SharedPreferencesOhosPlugin implements FlutterPlugin, Share let stringValue = (value as string); if (stringValue.startsWith(LIST_IDENTIFIER)) { let strList: ESObject = this.listEncoder.decode(stringValue.substring(LIST_IDENTIFIER.length)); - //将形似 '["Earth","Moon","Sun"]' 这样的字符串转换为 数组 [] - let t:ESObject = strList.replaceAll('"' ,"").split(""); - return t.splice(1,t.length-2).join("").split(","); + let t: ESObject = JSON.parse(strList); + return t; } } return value; @@ -438,5 +439,3 @@ class ListEncoder implements SharedPreferencesListEncoder { return undefined } } - - diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index afd60143a54b10af9925aead16056b4ef4eba38c..a5dd9dbd78aff3dfc299fc403f1ccc7af163a887 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -9,6 +9,8 @@ A Flutter plugin for launching a URL. | | Android | iOS | Linux | macOS | Web | Windows | |-------------|---------|-------|-------|--------|-----|-------------| | **Support** | SDK 16+ | 11.0+ | Any | 10.14+ | Any | Windows 10+ | +## Postscript +Ohos does not support jumping to the App Store at this time ## Usage diff --git a/packages/url_launcher/url_launcher_ohos/.gitignore b/packages/url_launcher/url_launcher_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..894df49349702b4499f23d1dbc7beec90c271b2f 100644 --- a/packages/url_launcher/url_launcher_ohos/.gitignore +++ b/packages/url_launcher/url_launcher_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/url_launcher/url_launcher_ohos/example/lib/main.dart b/packages/url_launcher/url_launcher_ohos/example/lib/main.dart index e441ed8712032caeece537f94f019dc96fa89b7f..cad51cb05eca56d2faea9bb5b6cd45121c000fb4 100644 --- a/packages/url_launcher/url_launcher_ohos/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_ohos/example/lib/main.dart @@ -86,7 +86,10 @@ class _MyHomePageState extends State { enableJavaScript: false, enableDomStorage: false, universalLinksOnly: false, - headers: {'my_header_key': 'my_header_value'}, + headers: { + 'my_header_key': 'my_header_value', + 'harmony_browser_page': 'pages/LaunchInAppPage' + }, )) { throw Exception('Could not launch $url'); } @@ -100,7 +103,9 @@ class _MyHomePageState extends State { enableJavaScript: true, enableDomStorage: false, universalLinksOnly: false, - headers: {}, + headers: { + 'harmony_browser_page': 'pages/LaunchInAppPage' + }, )) { throw Exception('Could not launch $url'); } @@ -114,7 +119,9 @@ class _MyHomePageState extends State { enableJavaScript: false, enableDomStorage: true, universalLinksOnly: false, - headers: {}, + headers: { + 'harmony_browser_page': 'pages/LaunchInAppPage' + }, )) { throw Exception('Could not launch $url'); } diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/build-profile.json5 b/packages/url_launcher/url_launcher_ohos/example/ohos/build-profile.json5 index 05be14e57d9b7372db69f8fdf2d8cd60e5187b5f..d209fee432db4515940449ca8f4516144ae32cf6 100644 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/build-profile.json5 +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ], diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/ets/pages/LaunchInAppPage.ets b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/ets/pages/LaunchInAppPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbfce13e81a557d6500bff5129fb193e83044f18 --- /dev/null +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/ets/pages/LaunchInAppPage.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { InAppBrowser } from 'url_launcher_ohos/src/main/ets/components/plugin/InAppBrowser'; + +@Entry +@Component +struct LaunchInAppPage { + + build() { + Row() { + InAppBrowser() + } + } +} diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/module.json5 b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/module.json5 index b7b8f025dc5750912da86699a957fba336c362c0..57f7efd11c7ebfb48a1080df38ac560b51382157 100644 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/module.json5 +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/module.json5 @@ -46,6 +46,11 @@ } ] } + ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + } ] } } \ No newline at end of file diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json index 1898d94f58d6128ab712be2c68acc7c98e9ab9ce..20c731259059a89ac3c87b95f0c8f521347503f9 100644 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,6 @@ { "src": [ - "pages/Index" + "pages/Index", + "pages/LaunchInAppPage" ] } diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw b/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw deleted file mode 100755 index 1f9378f2393618e98c87f3a0c4a70477c64da2be..0000000000000000000000000000000000000000 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw.bat b/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 5799f5498ae79096ba616bd383f7fe0523a90528..0000000000000000000000000000000000000000 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,76 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/url_launcher/url_launcher_ohos/example/ohos/oh-package.json5 b/packages/url_launcher/url_launcher_ohos/example/ohos/oh-package.json5 index b857528044bd4d0398fa8a0a824e65eb7741cabf..8eb2c1cda381bc01a537315d048af981edaaf42e 100644 --- a/packages/url_launcher/url_launcher_ohos/example/ohos/oh-package.json5 +++ b/packages/url_launcher/url_launcher_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "license": "", "devDependencies": { "@ohos/hypium": "1.0.6" diff --git a/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/InAppBrowser.ets b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/InAppBrowser.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c725e6e4064e54ac3d221e9f0aaf7fff4fa8bfb --- /dev/null +++ b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/InAppBrowser.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import web_webview from '@ohos.web.webview'; +import router from '@ohos.router'; +import { ValueType } from '@kit.ArkData'; + +@Entry +@Component +export struct InAppBrowser { + webviewController: web_webview.WebviewController = new web_webview.WebviewController() + + private url?: string; + private enableJavaScript: boolean = true; + private enableDomStorage: boolean = true; + + aboutToAppear(){ + let params = router.getParams() as Map + this.url = params['url'] as string; + let options = params['options'] as Map; + this.enableJavaScript = options['enableJavaScript'] as boolean; + this.enableDomStorage = options['enableDomStorage'] as boolean; + } + + build() { + Row() { + Web({ src: this.url, controller: this.webviewController }) + .javaScriptAccess(this.enableJavaScript) + .domStorageAccess(this.enableDomStorage) + }.width('100%').height('100%') + } +} diff --git a/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets index ab9427efd0d2426c5a21e6143c690f8811b6f332..f53b5e5c271dd6a0ff3689cd728aa4e35be7c4c0 100644 --- a/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets +++ b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets @@ -24,6 +24,10 @@ import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; import call from '@ohos.telephony.call'; import i18n from '@ohos.i18n'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; +import bundleManager from '@ohos.bundle.bundleManager'; +import router from '@ohos.router' +import promptAction from '@ohos.promptAction'; +import { BusinessError } from '@kit.BasicServicesKit'; const TAG = 'UrlLauncher' @@ -34,11 +38,12 @@ class SendMessageParams { } export class UrlLauncher implements UrlLauncherApi { - static LAUNCH_TYPE_TEL: string = 'tel'; - static LAUNCH_TYPE_WEB: string = 'http'; - static LAUNCH_TYPE_MAILTO: string = 'mailto'; - static LAUNCH_TYPE_SMS: string = 'sms'; - static LAUNCH_TYPE_FILE: string = 'file'; + static LAUNCH_TYPE_TEL: string = 'tel:'; + static LAUNCH_TYPE_WEB_HTTP: string = 'http:'; + static LAUNCH_TYPE_WEB_HTTPS: string = 'https:'; + static LAUNCH_TYPE_MAILTO: string = 'mailto:'; + static LAUNCH_TYPE_SMS: string = 'sms:'; + static LAUNCH_TYPE_FILE: string = 'file:'; static MMS_BUNDLE_NAME = "com.ohos.mms"; static MMS_ABILITY_NAME = "com.ohos.mms.MainAbility"; @@ -48,7 +53,6 @@ export class UrlLauncher implements UrlLauncherApi { constructor(ctx: common.UIAbilityContext) { this.context = ctx; - this.getPermission(); } getPermission() { @@ -73,16 +77,42 @@ export class UrlLauncher implements UrlLauncherApi { } canLaunchUrl(url: string): boolean { - return true; + let encodedUri = encodeURI(url); + // Trick:由于 sms、tel、file、mailto 用 bundleManager.canOpenLink 判断会报 17700055 错误,这里暂时保留 if 这段条件判断代码 + if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_TEL) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_WEB_HTTP) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_WEB_HTTPS) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_MAILTO) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_SMS) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_FILE)) { + return true; + } + + try { + // 除了 sms、tel、file、mailto、http、https 开头的这六种 uri 之外的,用下面的方法判断是否支持打开。 + // 需要在 src/main/module.json5 的 querySchemes 中增加对应的头部信息,例如打开 "amapuri://route/plan/?did=xxx",module.json5 的样例:{ "module": { "querySchemes": [ "amapuri" ] } } + if (bundleManager.canOpenLink(encodedUri)) { + return true; + } + return false; + } catch (error) { + Log.e(TAG, 'canOpenLink error: ', JSON.stringify(error)); + return false; + } } launchUrl(url: string, headers: Map): boolean { + if (!this.canLaunchUrl(url)) { + return false; + } + this.ensureContext(); let encodedUri = encodeURI(url); Log.d(TAG, 'launchUrl. url:' + url + ' eurl:' + encodedUri); if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_TEL)) { return this.launchTel(url); - } else if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_WEB)) { + } else if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_WEB_HTTP) || + encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_WEB_HTTPS)) { return this.launchWeb(url, headers); } else if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_MAILTO)) { return this.launchMail(url); @@ -91,8 +121,7 @@ export class UrlLauncher implements UrlLauncherApi { } else if (encodedUri.startsWith(UrlLauncher.LAUNCH_TYPE_FILE)) { return this.launchFile(url); } else { - Log.w(TAG, 'launch type unsurppoted. url:' + url); - return false; + return this.launchOther(url); } } @@ -107,7 +136,7 @@ export class UrlLauncher implements UrlLauncherApi { } launchSms(url: string): boolean { - let phoneNum = this.parseUrl(url, UrlLauncher.LAUNCH_TYPE_SMS + ':'); + let phoneNum = this.parseUrl(url, UrlLauncher.LAUNCH_TYPE_SMS); let formatNum = this.format(phoneNum); let msgParam = new SendMessageParams(); @@ -209,6 +238,19 @@ export class UrlLauncher implements UrlLauncherApi { return true; } + launchOther(url: string): boolean { + let want: Want = { + uri: url, + } + try { + this.context.startAbility(want) + } catch (e) { + Log.e(TAG, 'launchOther failed. err:' + JSON.stringify(e)) + return false + } + return true; + } + parseUrl(url: string, prefix: string): string { if (url == null || url == undefined) { return '' @@ -224,15 +266,23 @@ export class UrlLauncher implements UrlLauncherApi { } openUrlInWebView(url: string, options: WebViewOptions): boolean { - try { - this.context?.startAbility({ - action: 'ohos.want.action.viewData', - entities: ['entity.system.browsable'], - uri: url, + let headers = options.getHeaders(); + if (!headers.has('harmony_browser_page')) { + promptAction.showToast({ + message: '请在 launch 函数的 headers 参数中添加 harmony_browser_page 和对应的值,并在鸿蒙工程中增加对应的页面和配置路由', }); - } catch (e) { return false; } + + let harmonyBrowserPage = headers.get('harmony_browser_page'); + router.pushUrl({ url: harmonyBrowserPage, params: {'url': url, 'options': options} }).catch((error: BusinessError) => { + Log.e(TAG, 'Failed to open url: ', harmonyBrowserPage, ', Error: ', JSON.stringify(error)); + if (error.code == 100002) { + promptAction.showToast({ + message: harmonyBrowserPage + ' 页面不存在,或者没有在 main_pages.json 中声明', + }); + } + }); return true; } diff --git a/packages/video_player/video_player/README.md b/packages/video_player/video_player/README.md index 167c565503f44cd041d37d5b33adf405ab77bc41..f579aa9be4dc609789bb4deafff11bbac23bb379 100644 --- a/packages/video_player/video_player/README.md +++ b/packages/video_player/video_player/README.md @@ -5,11 +5,13 @@ [![pub package](https://img.shields.io/pub/v/video_player.svg)](https://pub.dev/packages/video_player) A Flutter plugin for iOS, Android and Web for playing back video on a Widget surface. - | | Android | iOS | Web | |-------------|---------|-------|-------| | **Support** | SDK 16+ | 11.0+ | Any\* | +[Supported video formats](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-media-V5#avplayer9) + + ![The example app running in iOS](https://github.com/flutter/packages/blob/main/packages/video_player/video_player/doc/demo_ipod.gif?raw=true) ## Installation diff --git a/packages/video_player/video_player_ohos/.gitignore b/packages/video_player/video_player_ohos/.gitignore index 24476c5d1eb55824c76d8b01a3965f94abad1ef8..7ec225305d1580562b9856e4c9e0488a2ea19b63 100644 --- a/packages/video_player/video_player_ohos/.gitignore +++ b/packages/video_player/video_player_ohos/.gitignore @@ -42,3 +42,10 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 \ No newline at end of file diff --git a/packages/video_player/video_player_ohos/README.md b/packages/video_player/video_player_ohos/README.md index 12b6700c041a8238fae2b27d388ace022ac0a6c1..0a312b913c0bc71f16812ebd985b48de52fb1cd1 100644 --- a/packages/video_player/video_player_ohos/README.md +++ b/packages/video_player/video_player_ohos/README.md @@ -1,6 +1,5 @@ # video_player_ohos - -A new Flutter project. +[Supported video formats](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-media-V5#avplayer9) ## Getting Started diff --git a/packages/video_player/video_player_ohos/example/lib/main.dart b/packages/video_player/video_player_ohos/example/lib/main.dart index 99fb70c832864830b27a3fe5973078391029f66a..73a0feb3ad168e805a3e17512c48fd45e54e2d6a 100644 --- a/packages/video_player/video_player_ohos/example/lib/main.dart +++ b/packages/video_player/video_player_ohos/example/lib/main.dart @@ -34,7 +34,7 @@ class _App extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTabController( - length: 2, + length: 3, child: Scaffold( key: const ValueKey('home_page'), appBar: AppBar( @@ -131,7 +131,7 @@ class _LocalFileVideo extends StatefulWidget { class _LocalFileVideoState extends State<_LocalFileVideo> { late MiniController _controller; - late int fileFd; + int? fileFd; Future selectorFile() async { print("selectorFile"); @@ -141,8 +141,8 @@ class _LocalFileVideoState extends State<_LocalFileVideo> { uniformTypeIdentifiers: ['public.video'], ); final FileSelector instance = FileSelector(); - fileFd = (await instance - .openFile(acceptedTypeGroups: [typeGroup]))!; + fileFd = await instance + .openFile(acceptedTypeGroups: [typeGroup]); } @override @@ -153,14 +153,15 @@ class _LocalFileVideoState extends State<_LocalFileVideo> { void getFileFd() { print("getFileFd"); - selectorFile().then((_) => setState(() { - _controller = MiniController.file(fileFd); + selectorFile().then((value) { + _controller = MiniController.file(fileFd ?? 0); _controller.addListener(() { setState(() {}); }); - _controller.initialize().then((_) => setState(() {})); - _controller.play(); - })); + _controller.initialize().whenComplete(() { + _controller.play(); + }); + }); } @override @@ -232,7 +233,7 @@ class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> { _controller.addListener(() { setState(() {}); }); - _controller.initialize(); + _controller.initialize().whenComplete(() => _controller.play()); } @override diff --git a/packages/video_player/video_player_ohos/example/ohos/build-profile.json5 b/packages/video_player/video_player_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/video_player/video_player_ohos/example/ohos/build-profile.json5 +++ b/packages/video_player/video_player_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100755 --- a/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/video_player/video_player_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/video_player/video_player_ohos/example/ohos/hvigorw b/packages/video_player/video_player_ohos/example/ohos/hvigorw deleted file mode 100755 index 5efd8343d3232bdd1d9b7f67a3326034054c5396..0000000000000000000000000000000000000000 --- a/packages/video_player/video_player_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/video_player/video_player_ohos/example/ohos/hvigorw.bat b/packages/video_player/video_player_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 7a90cee5a765865a53fed7145c49e974886cafd7..0000000000000000000000000000000000000000 --- a/packages/video_player/video_player_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -@rem Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/video_player/video_player_ohos/example/ohos/oh-package.json5 b/packages/video_player/video_player_ohos/example/ohos/oh-package.json5 index f086fa08cba1cc0c6e165cc413304fc4148a72ec..f7f25c568e44e26ca3f9b84951bf7e64c07f649a 100644 --- a/packages/video_player/video_player_ohos/example/ohos/oh-package.json5 +++ b/packages/video_player/video_player_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "name": "apptemplate", "version": "1.0.0", "description": "Please describe the basic information.", diff --git a/packages/video_player/video_player_ohos/example/pubspec.yaml b/packages/video_player/video_player_ohos/example/pubspec.yaml index 470e812a49501b61c6d7122c02b54777a68f1df1..1276be087114da7c0c8fe2974bb48c6d5f04eaa5 100644 --- a/packages/video_player/video_player_ohos/example/pubspec.yaml +++ b/packages/video_player/video_player_ohos/example/pubspec.yaml @@ -31,7 +31,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.19.6 <3.0.0' + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayer.ets b/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayer.ets index f2ccd71f8a6df9b49c5b06f48bff3dfa15299e55..d5906daef0550ff4c4ddfffd62a59962eeb9a757 100644 --- a/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayer.ets +++ b/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayer.ets @@ -18,7 +18,7 @@ import prompt from '@ohos.promptAction'; import resourceManager from '@ohos.resourceManager'; import window from '@ohos.window'; import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; -import { SurfaceTextureEntry } from '@ohos/flutter_ohos/src/main/ets/view/TextureRegistry'; +import { SurfaceTextureEntry } from '@ohos/flutter_ohos/src/main/ets/view/TextureRegistry'; import image from '@ohos.multimedia.image'; import { AvplayerStatus, CommonConstants, Events, SliderMode } from './constants/CommonConstants'; import { PlayConstants } from './constants/PlayConstants'; @@ -33,6 +33,7 @@ import { EventSink, StreamHandler } from '@ohos/flutter_ohos/src/main/ets/plugin import { QueuingEventSink } from './QueuingEventSink'; import { ArrayList, HashMap } from '@kit.ArkTS'; import { audio } from '@kit.AudioKit'; +import fs from '@ohos.file.fs'; const FORMAT_SS: String = 'ss'; const FORMAT_DASH: String = 'dash'; @@ -55,7 +56,8 @@ export class VideoPlayer { private textureEntry: SurfaceTextureEntry; private eventChannel: EventChannel | null = null; private eventSink: QueuingEventSink | null = null; - private interruptMode: audio.InterruptMode = audio.InterruptMode.SHARE_MODE; + private interruptMode: audio.InterruptMode = audio.InterruptMode.INDEPENDENT_MODE; + private fd: number | null = null; constructor(playerModel: PlayerModel, textureEntry: SurfaceTextureEntry, url: resourceManager.RawFileDescriptor | null, iUrl: string | null, eventChannel: EventChannel, AudioFocus: Boolean) { this.playerModel = playerModel; @@ -65,7 +67,7 @@ export class VideoPlayer { this.iUrl = iUrl; this.eventChannel = eventChannel; if (AudioFocus == true) { - this.interruptMode = audio.InterruptMode.INDEPENDENT_MODE; + this.interruptMode = audio.InterruptMode.SHARE_MODE; Log.i(TAG, "set interruptMode : " + this.interruptMode); } Log.i(TAG, "surfaceId : " + this.surfaceId); @@ -88,7 +90,7 @@ export class VideoPlayer { await this.bindState(); if (this.iUrl != null) { - this.avPlayer.url = this.iUrl; + this.avPlayer.url = this.getIUri(); } else { this.avPlayer.fdSrc = this.url!; } @@ -116,7 +118,7 @@ export class VideoPlayer { case AvplayerStatus.IDLE: this.resetProgress(); if (this.iUrl) { - this.avPlayer.url = this.iUrl; + this.avPlayer.url = this.getIUri(); } else { this.avPlayer.fdSrc = this.url!; } @@ -133,7 +135,6 @@ export class VideoPlayer { this.duration = this.avPlayer.duration; break; case AvplayerStatus.PLAYING: - this.setBright(); this.status = CommonConstants.STATUS_START; this.watchStatus(); break; @@ -180,8 +181,13 @@ export class VideoPlayer { this.sendBufferingUpdate(infoType, value); }); - this.avPlayer.on(Events.ERROR, (err: Object) => { + this.avPlayer.on(Events.ERROR, (err: BusinessError) => { Log.e(TAG, "avPlayer Events.ERROR: " + JSON.stringify(err)); + // 播放直播视频时,设置 loop 会报错,而 loop 一定会设置(video_player.dart 中初始化之后会 _applyLooping),所以屏蔽掉该报错 + // message: Unsupport Capability: The stream is live stream, not support loop + if(err.code == 801) { + return; + } this.avPlayer?.reset(); this.sendError(err); }) @@ -195,6 +201,9 @@ export class VideoPlayer { this.avPlayer.release(); this.eventChannel?.setStreamHandler(null); } + if (this.fd != null) { + fs.closeSync(this.fd!); + } } @@ -215,7 +224,7 @@ export class VideoPlayer { seekTo(position: number) { if (this.avPlayer !== null) { - this.avPlayer.seek(position, media.SeekMode.SEEK_PREV_SYNC); + this.avPlayer.seek(position, media.SeekMode.SEEK_CLOSEST); } } @@ -563,14 +572,25 @@ export class VideoPlayer { sendError(error: Object): void { this.eventSink?.error("videoError", "video player had error!", error); } + + getIUri(): string { + let iUrl = this.iUrl; + const ohosFilePrefix = 'file://'; + if (iUrl != null && iUrl.startsWith(ohosFilePrefix)) { + this.fd = fs.openSync(iUrl, fs.OpenMode.READ_ONLY).fd; + iUrl = `fd://${this.fd!.toString()}`; + } + return iUrl ?? ''; + } } class StreamHandlerImpl implements StreamHandler { private eventSink: QueuingEventSink | null = null; - constructor(eventSink: QueuingEventSink ) { + constructor(eventSink: QueuingEventSink) { this.eventSink = eventSink; } + onListen(args: Object, events: EventSink): void { this.eventSink?.setDelegate(events); } diff --git a/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayerApiImpl.ets b/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayerApiImpl.ets index 69437d5cec69c8fa460561f25e5000049a82af12..b73524cb3994257fa497872b2dd69f910d9b30a3 100644 --- a/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayerApiImpl.ets +++ b/packages/video_player/video_player_ohos/ohos/src/main/ets/components/videoplayer/VideoPlayerApiImpl.ets @@ -36,6 +36,9 @@ import resourceManager from '@ohos.resourceManager'; import common from '@ohos.app.ability.common'; import { media } from '@kit.MediaKit'; import { EventChannel } from '@ohos/flutter_ohos'; +import { GlobalContext } from './util/GlobalContext'; +import { window } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; const TAG: string = "VideoPlayerApiImpl"; export class VideoPlayerApiImpl { @@ -43,6 +46,7 @@ export class VideoPlayerApiImpl { private flutterState: FlutterState | null = null; private binding: AbilityPluginBinding | null = null; private AudioFocus: Boolean = false; + private pixelMaps: HashMap = new HashMap(); constructor(flutterState: FlutterState | null, binding: AbilityPluginBinding | null) { this.flutterState = flutterState; @@ -67,6 +71,8 @@ export class VideoPlayerApiImpl { } async create(arg: CreateMessage): Promise { + let windowClass = await window.getLastWindow(this.getContext()) + GlobalContext.getContext().setObject("windowClass", windowClass) Log.i(TAG, "enter create"); if (this.flutterState == null) { throw new Error("Illegal flutterState null."); @@ -77,7 +83,30 @@ export class VideoPlayerApiImpl { let asset: string = arg.getAsset(); let textureId: number = flutterRenderer.getTextureId(); Log.i(TAG, "enter getRawFd, textureId=" + textureId); - let surfaceTextureEntry: SurfaceTextureEntry = flutterRenderer.registerTexture(textureId); + let surfaceTextureEntry: SurfaceTextureEntry = flutterRenderer.registerTexture(textureId); + if (asset != null) { + let avImageGenerator = await media.createAVImageGenerator(); + avImageGenerator.fdSrc = await this.getContext().resourceManager.getRawFd("flutter_assets/" + asset); + let pixelMap = await avImageGenerator.fetchFrameByTime(0, media.AVImageQueryOptions.AV_IMAGE_QUERY_NEXT_SYNC, { + width: -1, + height: -1 + }); + this.pixelMaps.set(JSON.stringify(arg), pixelMap); + avImageGenerator.release(); + flutterRenderer.setTextureBackGroundPixelMap(textureId, this.pixelMaps.get(JSON.stringify(arg))); + } else if (uri != null && uri.startsWith("fd://")) { + let avImageGenerator = await media.createAVImageGenerator(); + avImageGenerator.fdSrc = { + fd: Number.parseInt(uri.replace("fd://", "")) + }; + let pixelMap = await avImageGenerator.fetchFrameByTime(0, media.AVImageQueryOptions.AV_IMAGE_QUERY_NEXT_SYNC, { + width: -1, + height: -1 + }); + this.pixelMaps.set(JSON.stringify(arg), pixelMap); + avImageGenerator.release(); + flutterRenderer.setTextureBackGroundPixelMap(textureId, this.pixelMaps.get(JSON.stringify(arg))); + } let eventChannel: EventChannel = new EventChannel(this.flutterState.getBinaryMessenger(), "flutter.io/videoPlayer/videoEvents" + textureId.toString()); if (asset != null) { let rawFileDescriptor: resourceManager.RawFileDescriptor = await this.getContext().resourceManager.getRawFd("flutter_assets/" + asset); diff --git a/packages/video_player/video_player_ohos/pubspec.yaml b/packages/video_player/video_player_ohos/pubspec.yaml index 415a9269dc0c46f5f03cac93269e294fbaa3e32d..90605573c994212cfaa117bdafdd1a92a6b2a160 100644 --- a/packages/video_player/video_player_ohos/pubspec.yaml +++ b/packages/video_player/video_player_ohos/pubspec.yaml @@ -31,7 +31,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.19.6 <3.0.0' + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/legacy/webview.dart b/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/legacy/webview.dart index 8b782dfd2cb738c3d466cf0e86b25595778b3903..468766e19fc5466ff4db46d3d803613aa31c5c53 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/legacy/webview.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/legacy/webview.dart @@ -26,6 +26,8 @@ import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_ // ignore: implementation_imports import 'package:webview_flutter_wkwebview/src/webview_flutter_wkwebview_legacy.dart'; +import 'package:webview_flutter_ohos/src/webview_flutter_ohos_legacy.dart'; + /// Optional callback invoked when a web view is first created. [controller] is /// the [WebViewController] for the created web view. typedef WebViewCreatedCallback = void Function(WebViewController controller); @@ -132,8 +134,13 @@ class WebView extends StatefulWidget { switch (defaultTargetPlatform) { case TargetPlatform.android: _platform = SurfaceAndroidWebView(); + break; case TargetPlatform.iOS: _platform = CupertinoWebView(); + break; + case TargetPlatform.ohos: + _platform = SurfaceOhosWebView(); + break; // ignore: no_default_cases default: throw UnsupportedError( diff --git a/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/webview_flutter_legacy.dart b/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/webview_flutter_legacy.dart index a6bb0663aecdffe1c1053ccebeb6b73ee654366d..a3c504e4c188460a6b030a147a1bcfa154b5eb7a 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/webview_flutter_legacy.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter/lib/src/webview_flutter_legacy.dart @@ -15,6 +15,7 @@ export 'package:webview_flutter_android/src/webview_flutter_android_legacy.dart'; export 'package:webview_flutter_wkwebview/src/webview_flutter_wkwebview_legacy.dart'; +export 'package:webview_flutter_ohos/src/webview_flutter_ohos_legacy.dart'; export 'legacy/platform_interface.dart'; export 'legacy/webview.dart'; diff --git a/packages/webview_flutter-v4.4.4/webview_flutter/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter/pubspec.yaml index 1d33a6053f18550ea2f8f653a0d6d7865c302f77..a78d12a27f06460996250081baeb040aa158bb31 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter/pubspec.yaml @@ -18,7 +18,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 4.4.4 environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" flutter: diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter_android/example/pubspec.yaml index c864bc4759a83b0f8307417c9f11bcf040bcfd9a..459c264d1daf7218bc2f19d07733eead9cb038ca 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter_android/example/pubspec.yaml @@ -16,7 +16,7 @@ description: Demonstrates how to use the webview_flutter_android plugin. publish_to: none environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" dependencies: diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_android/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter_android/pubspec.yaml index ba13e409d462c22042da1641bfa36dab13310e4c..3f29afd88bdcf8dc264331996f0449c44387170b 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter_android/pubspec.yaml @@ -18,7 +18,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 3.13.2 environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" flutter: diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/.gitignore b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..6665baf5ad7de7fd7352c04cfa1b6d9e318a73c9 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/.gitignore +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/build-profile.json5 b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/build-profile.json5 index e8c7d7eb0de5e1a65194730cc12e2a4c3d3e4a92..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/build-profile.json5 +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/build-profile.json5 @@ -1,18 +1,3 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - { "app": { "signingConfigs": [], @@ -20,9 +5,8 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", - "runtimeOS": "HarmonyOS", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" } ] }, diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz deleted file mode 100644 index 65b0d24f94d2aecc1099f8f8220beec695bfb779..0000000000000000000000000000000000000000 Binary files a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-3.0.9-s.tgz and /dev/null differ diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz deleted file mode 100644 index e2e499e18dfcd05e1e275579d11697640eb80323..0000000000000000000000000000000000000000 Binary files a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz and /dev/null differ diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/rollup.tgz b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/rollup.tgz deleted file mode 100644 index b224a37a5f69fd22f58c7a28151742eafe7e6317..0000000000000000000000000000000000000000 Binary files a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/dependencies/rollup.tgz and /dev/null differ diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets index 25d4c71ff3cd584f5d64f6f8c0ac864928c234c4..cf19953c0f6f188ae738047f9810bb202812c480 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -7,7 +7,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, +* distributed under the License is distributed on an "AS IS" BASIS , * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -1,21 +1,5 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100644 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw deleted file mode 100755 index 1f9378f2393618e98c87f3a0c4a70477c64da2be..0000000000000000000000000000000000000000 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw.bat b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 015ad7171d03a3c644d8ca0202c6d72313ba2a34..0000000000000000000000000000000000000000 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/oh-package.json5 b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/oh-package.json5 index 315df7203af813f7da1cbb5a3819d121081032fa..a8af3823de9add0ff16aa5b1b10f7db123531cea 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/oh-package.json5 +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/example/ohos/oh-package.json5 @@ -1,19 +1,5 @@ -/* - * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - { + "modelVersion": "5.0.0", "license": "", "devDependencies": { "@ohos/hypium": "1.0.6" @@ -24,4 +10,4 @@ "main": "", "version": "1.0.0", "dependencies": {} -} +} \ No newline at end of file diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart new file mode 100644 index 0000000000000000000000000000000000000000..5fcd18a67cf50b963017dfe08f93725419477248 --- /dev/null +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart @@ -0,0 +1,83 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart'; +import '../instance_manager.dart'; +import 'webview_ohos_widget.dart'; + +/// Builds an Ohos webview. +/// +/// This is used as the default implementation for [WebView.platform] on Ohos. It uses +/// an [OhosView] to embed the webview in the widget hierarchy, and uses a method channel to +/// communicate with the platform code. +class OhosWebView implements WebViewPlatform { + /// Constructs an [OhosWebView]. + OhosWebView({@visibleForTesting InstanceManager? instanceManager}) + : instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Maintains instances used to communicate with the native objects they + /// represent. + @protected + final InstanceManager instanceManager; + + @override + Widget build({ + required BuildContext context, + required CreationParams creationParams, + required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + required JavascriptChannelRegistry javascriptChannelRegistry, + WebViewPlatformCreatedCallback? onWebViewPlatformCreated, + Set>? gestureRecognizers, + }) { + return WebViewOhosWidget( + creationParams: creationParams, + callbacksHandler: webViewPlatformCallbacksHandler, + javascriptChannelRegistry: javascriptChannelRegistry, + onBuildWidget: (WebViewOhosPlatformController controller) { + return GestureDetector( + // We prevent text selection by intercepting the long press event. + // This is a temporary stop gap due to issues with text selection on Ohos: + // https://github.com/flutter/flutter/issues/24585 - the text selection + // dialog is not responding to touch events. + // https://github.com/flutter/flutter/issues/24584 - the text selection + // handles are not showing. + // TODO(amirh): remove this when the issues above are fixed. + onLongPress: () {}, + excludeFromSemantics: true, + child: OhosView( + viewType: 'plugins.flutter.io/webview', + onPlatformViewCreated: (int id) { + if (onWebViewPlatformCreated != null) { + onWebViewPlatformCreated(controller); + } + }, + gestureRecognizers: gestureRecognizers, + layoutDirection: + Directionality.maybeOf(context) ?? TextDirection.rtl, + creationParams: instanceManager.getIdentifier(controller.webView), + creationParamsCodec: const StandardMessageCodec(), + ), + ); + }, + ); + } + + @override + Future clearCookies() { + if (WebViewCookieManagerPlatform.instance == null) { + throw Exception( + 'Could not clear cookies as no implementation for WebViewCookieManagerPlatform has been registered.'); + } + return WebViewCookieManagerPlatform.instance!.clearCookies(); + } +} diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart new file mode 100644 index 0000000000000000000000000000000000000000..2474255e5a596312b28ab7c6b58ba0744627a881 --- /dev/null +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart @@ -0,0 +1,44 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart' as ohos_webview; + +/// Handles all cookie operations for the current platform. +class WebViewOhosCookieManager extends WebViewCookieManagerPlatform { + /// Constructs a [WebViewOhosCookieManager]. + WebViewOhosCookieManager({ + @visibleForTesting ohos_webview.CookieManager? cookieManager, + }) : _cookieManager = cookieManager ?? ohos_webview.CookieManager.instance; + + final ohos_webview.CookieManager _cookieManager; + + @override + Future clearCookies() => _cookieManager.removeAllCookies(); + + @override + Future setCookie(WebViewCookie cookie) { + if (!_isValidPath(cookie.path)) { + throw ArgumentError( + 'The path property for the provided cookie was not given a legal value.'); + } + return _cookieManager.setCookie( + cookie.domain, + '${Uri.encodeComponent(cookie.name)}=${Uri.encodeComponent(cookie.value)}; path=${cookie.path}', + ); + } + + bool _isValidPath(String path) { + // Permitted ranges based on RFC6265bis: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-02#section-4.1.1 + for (final int char in path.codeUnits) { + if ((char < 0x20 || char > 0x3A) && (char < 0x3C || char > 0x7E)) { + return false; + } + } + return true; + } +} diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..36d9ac9366dfcabbef3c62b74bc85c7bfeb94d19 --- /dev/null +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart @@ -0,0 +1,668 @@ +// Copyright 2013 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. + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart' as ohos_webview; +import '../weak_reference_utils.dart'; +import 'webview_ohos_cookie_manager.dart'; + +/// Creates a [Widget] with a [ohos_webview.WebView]. +class WebViewOhosWidget extends StatefulWidget { + /// Constructs a [WebViewOhosWidget]. + const WebViewOhosWidget({ + super.key, + required this.creationParams, + required this.callbacksHandler, + required this.javascriptChannelRegistry, + required this.onBuildWidget, + @visibleForTesting this.webViewProxy = const WebViewProxy(), + @visibleForTesting + this.flutterAssetManager = const ohos_webview.FlutterAssetManager(), + @visibleForTesting this.webStorage, + }); + + /// Initial parameters used to setup the WebView. + final CreationParams creationParams; + + /// Handles callbacks that are made by [ohos_webview.WebViewClient], [ohos_webview.DownloadListener], and [ohos_webview.WebChromeClient]. + final WebViewPlatformCallbacksHandler callbacksHandler; + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; + + /// Handles constructing [ohos_webview.WebView]s and calling static methods. + /// + /// This should only be changed for testing purposes. + final WebViewProxy webViewProxy; + + /// Manages access to Flutter assets that are part of the Ohos App bundle. + /// + /// This should only be changed for testing purposes. + final ohos_webview.FlutterAssetManager flutterAssetManager; + + /// Callback to build a widget once [ohos_webview.WebView] has been initialized. + final Widget Function(WebViewOhosPlatformController controller) + onBuildWidget; + + /// Manages the JavaScript storage APIs. + final ohos_webview.WebStorage? webStorage; + + @override + State createState() => _WebViewOhosWidgetState(); +} + +class _WebViewOhosWidgetState extends State { + late final WebViewOhosPlatformController controller; + + @override + void initState() { + super.initState(); + controller = WebViewOhosPlatformController( + creationParams: widget.creationParams, + callbacksHandler: widget.callbacksHandler, + javascriptChannelRegistry: widget.javascriptChannelRegistry, + webViewProxy: widget.webViewProxy, + flutterAssetManager: widget.flutterAssetManager, + webStorage: widget.webStorage, + ); + } + + @override + Widget build(BuildContext context) { + return widget.onBuildWidget(controller); + } +} + +/// Implementation of [WebViewPlatformController] with the Ohos WebView api. +class WebViewOhosPlatformController extends WebViewPlatformController { + /// Construct a [WebViewOhosPlatformController]. + WebViewOhosPlatformController({ + required CreationParams creationParams, + required this.callbacksHandler, + required this.javascriptChannelRegistry, + @visibleForTesting this.webViewProxy = const WebViewProxy(), + @visibleForTesting + this.flutterAssetManager = const ohos_webview.FlutterAssetManager(), + @visibleForTesting ohos_webview.WebStorage? webStorage, + }) : webStorage = webStorage ?? ohos_webview.WebStorage.instance, + assert(creationParams.webSettings?.hasNavigationDelegate != null), + super(callbacksHandler) { + webView = webViewProxy.createWebView(); + + webView.settings.setDomStorageEnabled(true); + webView.settings.setJavaScriptCanOpenWindowsAutomatically(true); + webView.settings.setSupportMultipleWindows(true); + webView.settings.setLoadWithOverviewMode(true); + webView.settings.setUseWideViewPort(true); + webView.settings.setDisplayZoomControls(false); + webView.settings.setBuiltInZoomControls(true); + + _setCreationParams(creationParams); + webView.setDownloadListener(downloadListener); + webView.setWebChromeClient(webChromeClient); + webView.setWebViewClient(webViewClient); + + final String? initialUrl = creationParams.initialUrl; + if (initialUrl != null) { + loadUrl(initialUrl, {}); + } + } + + final Map _javaScriptChannels = + {}; + + late final ohos_webview.WebViewClient _webViewClient = + webViewProxy.createWebViewClient( + onPageStarted: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?.callbacksHandler.onPageStarted(url); + }; + }), + onPageFinished: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?.callbacksHandler.onPageFinished(url); + }; + }), + onReceivedError: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return ( + _, + int errorCode, + String description, + String failingUrl, + ) { + weakReference.target?.callbacksHandler + .onWebResourceError(WebResourceError( + errorCode: errorCode, + description: description, + failingUrl: failingUrl, + errorType: _errorCodeToErrorType(errorCode), + )); + }; + }), + onReceivedRequestError: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return ( + _, + ohos_webview.WebResourceRequest request, + ohos_webview.WebResourceError error, + ) { + if (request.isForMainFrame) { + weakReference.target?.callbacksHandler + .onWebResourceError(WebResourceError( + errorCode: error.errorCode, + description: error.description, + failingUrl: request.url, + errorType: _errorCodeToErrorType(error.errorCode), + )); + } + }; + }), + urlLoading: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?._handleNavigationRequest( + url: url, + isForMainFrame: true, + ); + }; + }), + requestLoading: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, ohos_webview.WebResourceRequest request) { + weakReference.target?._handleNavigationRequest( + url: request.url, + isForMainFrame: request.isForMainFrame, + ); + }; + }), + ); + + bool _hasNavigationDelegate = false; + bool _hasProgressTracking = false; + + /// Represents the WebView maintained by platform code. + late final ohos_webview.WebView webView; + + /// Handles callbacks that are made by [ohos_webview.WebViewClient], [ohos_webview.DownloadListener], and [ohos_webview.WebChromeClient]. + final WebViewPlatformCallbacksHandler callbacksHandler; + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; + + /// Handles constructing [ohos_webview.WebView]s and calling static methods. + /// + /// This should only be changed for testing purposes. + final WebViewProxy webViewProxy; + + /// Manages access to Flutter assets that are part of the Ohos App bundle. + /// + /// This should only be changed for testing purposes. + final ohos_webview.FlutterAssetManager flutterAssetManager; + + /// Receives callbacks when content should be downloaded instead. + @visibleForTesting + late final ohos_webview.DownloadListener downloadListener = + ohos_webview.DownloadListener( + onDownloadStart: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return ( + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) { + weakReference.target?._handleNavigationRequest( + url: url, + isForMainFrame: true, + ); + }; + }, + ), + ); + + /// Handles JavaScript dialogs, favicons, titles, new windows, and the progress for [ohos_webview.WebView]. + @visibleForTesting + late final ohos_webview.WebChromeClient webChromeClient = + ohos_webview.WebChromeClient( + onProgressChanged: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return (_, int progress) { + final WebViewOhosPlatformController? controller = + weakReference.target; + if (controller != null && controller._hasProgressTracking) { + controller.callbacksHandler.onProgress(progress); + } + }; + }, + )); + + /// Manages the JavaScript storage APIs. + final ohos_webview.WebStorage webStorage; + + /// Receive various notifications and requests for [ohos_webview.WebView]. + @visibleForTesting + ohos_webview.WebViewClient get webViewClient => _webViewClient; + + @override + Future loadHtmlString(String html, {String? baseUrl}) { + return webView.loadDataWithBaseUrl( + baseUrl: baseUrl, + data: html, + mimeType: 'text/html', + ); + } + + @override + Future loadFile(String absoluteFilePath) { + final String url = absoluteFilePath.startsWith('file://') + ? absoluteFilePath + : 'file://$absoluteFilePath'; + + webView.settings.setAllowFileAccess(true); + return webView.loadUrl(url, {}); + } + + @override + Future loadFlutterAsset(String key) async { + final String assetFilePath = + await flutterAssetManager.getAssetFilePathByName(key); + final List pathElements = assetFilePath.split('/'); + final String fileName = pathElements.removeLast(); + final List paths = + await flutterAssetManager.list(pathElements.join('/')); + + if (!paths.contains(fileName)) { + throw ArgumentError( + 'Asset for key "$key" not found.', + 'key', + ); + } + +/* return webView.loadUrl( + 'file:///ohos_asset/$assetFilePath', + {}, + );*/ + + webView.settings.setAllowFileAccess(true); + final String url = "resources/rawfile/" + assetFilePath; + return webView.loadUrl(url, {}); + } + + @override + Future loadUrl( + String url, + Map? headers, + ) { + return webView.loadUrl(url, headers ?? {}); + } + + /// When making a POST request, headers are ignored. As a workaround, make + /// the request manually and load the response data using [loadHTMLString]. + @override + Future loadRequest( + WebViewRequest request, + ) async { + if (!request.uri.hasScheme) { + throw ArgumentError('WebViewRequest#uri is required to have a scheme.'); + } + switch (request.method) { + case WebViewRequestMethod.get: + return webView.loadUrl(request.uri.toString(), request.headers); + case WebViewRequestMethod.post: + return webView.postUrl( + request.uri.toString(), request.body ?? Uint8List(0)); + } + // The enum comes from a different package, which could get a new value at + // any time, so a fallback case is necessary. Since there is no reasonable + // default behavior, throw to alert the client that they need an updated + // version. This is deliberately outside the switch rather than a `default` + // so that the linter will flag the switch as needing an update. + // ignore: dead_code + throw UnimplementedError( + 'This version of webview_ohos_widget currently has no ' + 'implementation for HTTP method ${request.method.serialize()} in ' + 'loadRequest.'); + } + + @override + Future currentUrl() => webView.getUrl(); + + @override + Future canGoBack() => webView.canGoBack(); + + @override + Future canGoForward() => webView.canGoForward(); + + @override + Future goBack() => webView.goBack(); + + @override + Future goForward() => webView.goForward(); + + @override + Future reload() => webView.reload(); + + @override + Future clearCache() { + webView.clearCache(true); + return webStorage.deleteAllData(); + } + + @override + Future updateSettings(WebSettings setting) async { + _hasProgressTracking = setting.hasProgressTracking ?? _hasProgressTracking; + await Future.wait(>[ + _setUserAgent(setting.userAgent), + if (setting.hasNavigationDelegate != null) + _setHasNavigationDelegate(setting.hasNavigationDelegate!), + if (setting.javascriptMode != null) + _setJavaScriptMode(setting.javascriptMode!), + if (setting.debuggingEnabled != null) + _setDebuggingEnabled(setting.debuggingEnabled!), + if (setting.zoomEnabled != null) _setZoomEnabled(setting.zoomEnabled!), + ]); + } + + @override + Future evaluateJavascript(String javascript) async { + return runJavascriptReturningResult(javascript); + } + + @override + Future runJavascript(String javascript) async { + await webView.evaluateJavascript(javascript); + } + + @override + Future runJavascriptReturningResult(String javascript) async { + return await webView.evaluateJavascript(javascript) ?? ''; + } + + @override + Future addJavascriptChannels(Set javascriptChannelNames) { + return Future.wait( + javascriptChannelNames.where( + (String channelName) { + return !_javaScriptChannels.containsKey(channelName); + }, + ).map>( + (String channelName) { + final WebViewOhosJavaScriptChannel javaScriptChannel = + WebViewOhosJavaScriptChannel( + channelName, javascriptChannelRegistry); + _javaScriptChannels[channelName] = javaScriptChannel; + return webView.addJavaScriptChannel(javaScriptChannel); + }, + ), + ); + } + + @override + Future removeJavascriptChannels( + Set javascriptChannelNames, + ) { + return Future.wait( + javascriptChannelNames.where( + (String channelName) { + return _javaScriptChannels.containsKey(channelName); + }, + ).map>( + (String channelName) { + final WebViewOhosJavaScriptChannel javaScriptChannel = + _javaScriptChannels[channelName]!; + _javaScriptChannels.remove(channelName); + return webView.removeJavaScriptChannel(javaScriptChannel); + }, + ), + ); + } + + @override + Future getTitle() => webView.getTitle(); + + @override + Future scrollTo(int x, int y) => webView.scrollTo(x, y); + + @override + Future scrollBy(int x, int y) => webView.scrollBy(x, y); + + @override + Future getScrollX() => webView.getScrollX(); + + @override + Future getScrollY() => webView.getScrollY(); + + void _setCreationParams(CreationParams creationParams) { + final WebSettings? webSettings = creationParams.webSettings; + if (webSettings != null) { + updateSettings(webSettings); + } + + final String? userAgent = creationParams.userAgent; + if (userAgent != null) { + webView.settings.setUserAgentString(userAgent); + } + + webView.settings.setMediaPlaybackRequiresUserGesture( + creationParams.autoMediaPlaybackPolicy != + AutoMediaPlaybackPolicy.always_allow, + ); + + final Color? backgroundColor = creationParams.backgroundColor; + if (backgroundColor != null) { + //webView.setBackgroundColor(backgroundColor); + } + + addJavascriptChannels(creationParams.javascriptChannelNames); + + // TODO(BeMacized): Remove once platform implementations + // are able to register themselves (Flutter >=2.8), + // https://github.com/flutter/flutter/issues/94224 + WebViewCookieManagerPlatform.instance ??= WebViewOhosCookieManager(); + + creationParams.cookies + .forEach(WebViewCookieManagerPlatform.instance!.setCookie); + } + + Future _setHasNavigationDelegate(bool hasNavigationDelegate) { + _hasNavigationDelegate = hasNavigationDelegate; + return _webViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading( + hasNavigationDelegate, + ); + } + + Future _setJavaScriptMode(JavascriptMode mode) { + switch (mode) { + case JavascriptMode.disabled: + return webView.settings.setJavaScriptEnabled(false); + case JavascriptMode.unrestricted: + return webView.settings.setJavaScriptEnabled(true); + } + } + + Future _setDebuggingEnabled(bool debuggingEnabled) { + return webViewProxy.setWebContentsDebuggingEnabled(debuggingEnabled); + } + + Future _setUserAgent(WebSetting userAgent) { + if (userAgent.isPresent) { + // If the string is empty, the system default value will be used. + return webView.settings.setUserAgentString(userAgent.value ?? ''); + } + + return Future.value(); + } + + Future _setZoomEnabled(bool zoomEnabled) { + return webView.settings.setSupportZoom(zoomEnabled); + } + + static WebResourceErrorType _errorCodeToErrorType(int errorCode) { + switch (errorCode) { + case ohos_webview.WebViewClient.errorAuthentication: + return WebResourceErrorType.authentication; + case ohos_webview.WebViewClient.errorBadUrl: + return WebResourceErrorType.badUrl; + case ohos_webview.WebViewClient.errorConnect: + return WebResourceErrorType.connect; + case ohos_webview.WebViewClient.errorFailedSslHandshake: + return WebResourceErrorType.failedSslHandshake; + case ohos_webview.WebViewClient.errorFile: + return WebResourceErrorType.file; + case ohos_webview.WebViewClient.errorFileNotFound: + return WebResourceErrorType.fileNotFound; + case ohos_webview.WebViewClient.errorHostLookup: + return WebResourceErrorType.hostLookup; + case ohos_webview.WebViewClient.errorIO: + return WebResourceErrorType.io; + case ohos_webview.WebViewClient.errorProxyAuthentication: + return WebResourceErrorType.proxyAuthentication; + case ohos_webview.WebViewClient.errorRedirectLoop: + return WebResourceErrorType.redirectLoop; + case ohos_webview.WebViewClient.errorTimeout: + return WebResourceErrorType.timeout; + case ohos_webview.WebViewClient.errorTooManyRequests: + return WebResourceErrorType.tooManyRequests; + case ohos_webview.WebViewClient.errorUnknown: + return WebResourceErrorType.unknown; + case ohos_webview.WebViewClient.errorUnsafeResource: + return WebResourceErrorType.unsafeResource; + case ohos_webview.WebViewClient.errorUnsupportedAuthScheme: + return WebResourceErrorType.unsupportedAuthScheme; + case ohos_webview.WebViewClient.errorUnsupportedScheme: + return WebResourceErrorType.unsupportedScheme; + } + + if (errorCode < 0) { + return WebResourceErrorType.unknown; + } + + throw ArgumentError( + 'Could not find a WebResourceErrorType for errorCode: $errorCode', + ); + } + + void _handleNavigationRequest({ + required String url, + required bool isForMainFrame, + }) { + if (!_hasNavigationDelegate) { + return; + } + + final FutureOr returnValue = callbacksHandler.onNavigationRequest( + url: url, + isForMainFrame: isForMainFrame, + ); + + if (returnValue is bool && returnValue) { + loadUrl(url, {}); + } else if (returnValue is Future) { + returnValue.then((bool shouldLoadUrl) { + if (shouldLoadUrl) { + loadUrl(url, {}); + } + }); + } + } +} + +/// Exposes a channel to receive calls from javaScript. +class WebViewOhosJavaScriptChannel + extends ohos_webview.JavaScriptChannel { + /// Creates a [WebViewOhosJavaScriptChannel]. + WebViewOhosJavaScriptChannel( + super.channelName, + this.javascriptChannelRegistry, + ) : super( + postMessage: withWeakReferenceTo( + javascriptChannelRegistry, + (WeakReference weakReference) { + return (String message) { + weakReference.target?.onJavascriptChannelMessage( + channelName, + message, + ); + }; + }, + ), + ); + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; +} + +/// Handles constructing [ohos_webview.WebView]s and calling static methods. +/// +/// This should only be used for testing purposes. +@visibleForTesting +class WebViewProxy { + /// Creates a [WebViewProxy]. + const WebViewProxy(); + + /// Constructs a [ohos_webview.WebView]. + ohos_webview.WebView createWebView() { + return ohos_webview.WebView(); + } + + /// Constructs a [ohos_webview.WebViewClient]. + ohos_webview.WebViewClient createWebViewClient({ + void Function(ohos_webview.WebView webView, String url)? onPageStarted, + void Function(ohos_webview.WebView webView, String url)? onPageFinished, + void Function( + ohos_webview.WebView webView, + ohos_webview.WebResourceRequest request, + ohos_webview.WebResourceError error, + )? onReceivedRequestError, + void Function( + ohos_webview.WebView webView, + int errorCode, + String description, + String failingUrl, + )? onReceivedError, + void Function(ohos_webview.WebView webView, + ohos_webview.WebResourceRequest request)? + requestLoading, + void Function(ohos_webview.WebView webView, String url)? urlLoading, + }) { + return ohos_webview.WebViewClient( + onPageStarted: onPageStarted, + onPageFinished: onPageFinished, + onReceivedRequestError: onReceivedRequestError, + onReceivedError: onReceivedError, + requestLoading: requestLoading, + urlLoading: urlLoading, + ); + } + + /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. + /// + /// This flag can be enabled in order to facilitate debugging of web layouts + /// and JavaScript code running inside WebViews. Please refer to + /// [ohos_webview.WebView] documentation for the debugging guide. The + /// default is false. + /// + /// See [ohos_webview.WebView].setWebContentsDebuggingEnabled. + Future setWebContentsDebuggingEnabled(bool enabled) { + return ohos_webview.WebView.setWebContentsDebuggingEnabled(enabled); + } +} diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart new file mode 100644 index 0000000000000000000000000000000000000000..dca266fd27e9268b979b9bd3183e076a547db82e --- /dev/null +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart @@ -0,0 +1,119 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart'; +import 'webview_ohos.dart'; +import 'webview_ohos_widget.dart'; + +/// Ohos [WebViewPlatform] that uses [OhosViewSurface] to build the +/// [WebView] widget. +/// +/// To use this, set [WebView.platform] to an instance of this class. +/// +/// This implementation uses [OhosViewSurface] to render the [WebView] on +/// Ohos. It solves multiple issues related to accessibility and interaction +/// with the [WebView] at the cost of some performance on Ohos versions below +/// 10. +/// +/// To support transparent backgrounds on all Ohos devices, this +/// implementation uses hybrid composition when the opacity of +/// `CreationParams.backgroundColor` is less than 1.0. See +/// https://github.com/flutter/flutter/wiki/Hybrid-Composition for more +/// information. +class SurfaceOhosWebView extends OhosWebView { + /// Constructs a [SurfaceOhosWebView]. + SurfaceOhosWebView({@visibleForTesting super.instanceManager}); + + @override + Widget build({ + required BuildContext context, + required CreationParams creationParams, + required JavascriptChannelRegistry javascriptChannelRegistry, + WebViewPlatformCreatedCallback? onWebViewPlatformCreated, + Set>? gestureRecognizers, + required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + }) { + return WebViewOhosWidget( + creationParams: creationParams, + callbacksHandler: webViewPlatformCallbacksHandler, + javascriptChannelRegistry: javascriptChannelRegistry, + onBuildWidget: (WebViewOhosPlatformController controller) { + return PlatformViewLink( + viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return OhosViewSurface( + controller: controller as OhosViewController, + gestureRecognizers: gestureRecognizers ?? + const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + final Color? backgroundColor = creationParams.backgroundColor; + return _createViewController( + // On some Ohos devices, transparent backgrounds can cause + // rendering issues on the non hybrid composition + // OhosViewSurface. This switches the WebView to Hybrid + // Composition when the background color is not 100% opaque. + hybridComposition: + backgroundColor != null && backgroundColor.opacity < 1.0, + id: params.id, + viewType: 'plugins.flutter.io/webview', + // WebView content is not affected by the Ohos view's layout direction, + // we explicitly set it here so that the widget doesn't require an ambient + // directionality. + layoutDirection: + Directionality.maybeOf(context) ?? TextDirection.ltr, + webViewIdentifier: + instanceManager.getIdentifier(controller.webView)!, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..addOnPlatformViewCreatedListener((int id) { + if (onWebViewPlatformCreated != null) { + onWebViewPlatformCreated(controller); + } + }) + ..create(); + }, + ); + }, + ); + } + + OhosViewController _createViewController({ + required bool hybridComposition, + required int id, + required String viewType, + required TextDirection layoutDirection, + required int webViewIdentifier, + }) { + if (hybridComposition) { + return PlatformViewsService.initExpensiveOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: webViewIdentifier, + creationParamsCodec: const StandardMessageCodec(), + ); + } + return PlatformViewsService.initSurfaceOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: webViewIdentifier, + creationParamsCodec: const StandardMessageCodec(), + ); + } +} diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.dart index 1bb9bd550eeb8e1f0e254b747e8cd06bff08a8d7..fd64fbee1269322e3947cd73811d82b435bcfca7 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.dart @@ -444,11 +444,6 @@ class WebView extends View { return api.setWebChromeClientFromInstance(this, client); } - /// Sets the background color of this WebView. - Future setBackgroundColor(Color color) { - return api.setBackgroundColorFromInstance(this, color.value); - } - @override WebView copy() { return WebView.detached( @@ -598,6 +593,11 @@ class WebSettings extends OhosObject { return api.setSupportMultipleWindowsFromInstance(this, support); } + /// Sets the background color of this WebView. + Future setBackgroundColor(Color color) { + return api.setBackgroundColorFromInstance(this, color.value); + } + /// Tells the WebView to enable JavaScript execution. /// /// The default is false. @@ -797,53 +797,56 @@ class WebViewClient extends OhosObject { super.instanceManager, }) : super.detached(); + /// @ohos.web.netErrorList (ArkWeb网络协议栈错误列表) + /// https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-neterrorlist-V5 + /// User authentication failed on server. - static const int errorAuthentication = 2300094; + static const int errorAuthentication = -100; /// Malformed URL. - static const int errorBadUrl = 2300003; + static const int errorBadUrl = -300; /// Failed to connect to the server. - static const int errorConnect = 2300007; + static const int errorConnect = -106; /// Failed to perform SSL handshake. - static const int errorFailedSslHandshake = -11; + static const int errorFailedSslHandshake = -148; /// Generic file error. - static const int errorFile = -13; + static const int errorFile = -16; /// File not found. - static const int errorFileNotFound = 2301002; + static const int errorFileNotFound = -808; /// Server or proxy hostname lookup failed. - static const int errorHostLookup = 2300005; + static const int errorHostLookup = -121; /// Failed to read or write to the server. - static const int errorIO = -7; + static const int errorIO = -1; /// User authentication failed on proxy. - static const int errorProxyAuthentication = -5; + static const int errorProxyAuthentication = -115; /// Too many redirects. - static const int errorRedirectLoop = 2300047; + static const int errorRedirectLoop = -303; /// Connection timed out. - static const int errorTimeout = 2300028; + static const int errorTimeout = -409; /// Too many requests during this load. - static const int errorTooManyRequests = 21900004; + static const int errorTooManyRequests = -114; /// Generic error. - static const int errorUnknown = 2300999; + static const int errorUnknown = -9; /// Resource load was canceled by Safe Browsing. - static const int errorUnsafeResource = -16; + static const int errorUnsafeResource = -311; /// Unsupported authentication scheme (not basic or digest). - static const int errorUnsupportedAuthScheme = -3; + static const int errorUnsupportedAuthScheme = -339; /// Unsupported URI scheme. - static const int errorUnsupportedScheme = -10; + static const int errorUnsupportedScheme = -301; /// Pigeon Host Api implementation for [WebViewClient]. @visibleForTesting diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.g.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.g.dart index b6279f63dee3d4f222ea31739703841c3297f9b3..7aeafda4505f0921b034132a0d81c3d6ad4df341 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.g.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview.g.dart @@ -1089,28 +1089,6 @@ class WebViewHostApi { } } - Future setBackgroundColor(int arg_instanceId, int arg_color) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_ohos.WebViewHostApi.setBackgroundColor', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_color]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } } /// Flutter API for `WebView`. @@ -1254,6 +1232,29 @@ class WebSettingsHostApi { } } + Future setBackgroundColor(int arg_instanceId, int arg_color) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebSettingsHostApi.setBackgroundColor', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_color]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + Future setJavaScriptEnabled(int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.webview_flutter_ohos.WebSettingsHostApi.setJavaScriptEnabled', diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart index 85c28b3e9e9b8a1b82aa42ad58b288734eca69e9..7b904467a891287031fe9ddb9acf9c1cf5cdf8b5 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart @@ -391,10 +391,6 @@ class WebViewHostApiImpl extends WebViewHostApi { ); } - /// Helper method to convert instances ids to objects. - Future setBackgroundColorFromInstance(WebView instance, int color) { - return setBackgroundColor(instanceManager.getIdentifier(instance)!, color); - } } /// Flutter API implementation for [WebView]. @@ -471,6 +467,11 @@ class WebSettingsHostApiImpl extends WebSettingsHostApi { instanceManager.getIdentifier(instance)!, support); } + /// Helper method to convert instances ids to objects. + Future setBackgroundColorFromInstance(WebSettings instance, int color) { + return setBackgroundColor(instanceManager.getIdentifier(instance)!, color); + } + /// Helper method to convert instances ids to objects. Future setJavaScriptEnabledFromInstance( WebSettings instance, diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_controller.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_controller.dart index 34002c982f8870728f44ebdd5a66d16709c342c1..70eae99b629db9a1728f6338dcf8d3a81737f5b4 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_controller.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/ohos_webview_controller.dart @@ -512,7 +512,7 @@ class OhosWebViewController extends PlatformWebViewController { @override Future setBackgroundColor(Color color) => - _webView.setBackgroundColor(color); + _webView.settings.setBackgroundColor(color); @override Future setJavaScriptMode(JavaScriptMode javaScriptMode) => @@ -922,19 +922,60 @@ class OhosWebViewWidget extends PlatformWebViewWidget { @override Widget build(BuildContext context) { _trySetDefaultOnShowCustomWidgetCallbacks(context); - return OhosView( + return PlatformViewLink( + // Setting a default key using `params` ensures the `PlatformViewLink` + // recreates the PlatformView when changes are made. key: _ohosParams.key ?? ValueKey( params as OhosWebViewWidgetCreationParams), viewType: 'plugins.flutter.io/webview', - layoutDirection: _ohosParams.layoutDirection, - creationParams: _ohosParams.instanceManager.getIdentifier( - (_ohosParams.controller as OhosWebViewController)._webView), - creationParamsCodec: const StandardMessageCodec(), - gestureRecognizers: _ohosParams.gestureRecognizers, + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return OhosViewSurface( + controller: controller as OhosViewController, + gestureRecognizers: _ohosParams.gestureRecognizers, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initOhosView( + params, + displayWithHybridComposition: + _ohosParams.displayWithHybridComposition, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, ); } + OhosViewController _initOhosView( + PlatformViewCreationParams params, { + required bool displayWithHybridComposition, + }) { + if (displayWithHybridComposition) { + return _ohosParams.platformViewsServiceProxy.initExpensiveOhosView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: _ohosParams.layoutDirection, + creationParams: _ohosParams.instanceManager.getIdentifier( + (_ohosParams.controller as OhosWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } else { + return _ohosParams.platformViewsServiceProxy.initSurfaceOhosView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: _ohosParams.layoutDirection, + creationParams: _ohosParams.instanceManager.getIdentifier( + (_ohosParams.controller as OhosWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } + } + // Attempt to handle custom views with a default implementation if it has not // been set. void _trySetDefaultOnShowCustomWidgetCallbacks(BuildContext context) { @@ -1010,13 +1051,30 @@ class OhosCustomViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return OhosView( + return PlatformViewLink( key: key, viewType: 'plugins.flutter.io/webview', - layoutDirection: TextDirection.ltr, - creationParams: instanceManager.getIdentifier(customView), - creationParamsCodec: const StandardMessageCodec(), - gestureRecognizers: const >{}, + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return OhosViewSurface( + controller: controller as OhosViewController, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + gestureRecognizers: const >{}, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initOhosView( + params, + displayWithHybridComposition: false, + platformViewsServiceProxy: platformViewsServiceProxy, + view: customView, + instanceManager: instanceManager, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, ); } } @@ -1031,14 +1089,23 @@ OhosViewController _initOhosView( }) { final int? instanceId = instanceManager.getIdentifier(view); - return platformViewsServiceProxy.initOhosView( + if (displayWithHybridComposition) { + return platformViewsServiceProxy.initExpensiveOhosView( id: params.id, viewType: 'plugins.flutter.io/webview', layoutDirection: layoutDirection, creationParams: instanceId, creationParamsCodec: const StandardMessageCodec(), ); - + } else { + return platformViewsServiceProxy.initSurfaceOhosView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: layoutDirection, + creationParams: instanceId, + creationParamsCodec: const StandardMessageCodec(), + ); + } } @@ -1100,6 +1167,10 @@ class OhosWebResourceError extends WebResourceError { return WebResourceErrorType.unsupportedScheme; } + if (errorCode < 0) { + return WebResourceErrorType.unknown; + } + throw ArgumentError( 'Could not find a WebResourceErrorType for errorCode: $errorCode', ); diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart index c1f36763a243ebe78b39622b05fb8d5cd5aa4567..facc9a3dc9c0e38ff65d6734843f512c83fe2828 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart @@ -24,8 +24,8 @@ class PlatformViewsServiceProxy { /// Constructs a [PlatformViewsServiceProxy]. const PlatformViewsServiceProxy(); - /// Proxy method for [PlatformViewsService.initOhosView]. - OhosViewController initOhosView({ + /// Proxy method for [PlatformViewsService.initExpensiveOhosView]. + ExpensiveOhosViewController initExpensiveOhosView({ required int id, required String viewType, required TextDirection layoutDirection, @@ -33,13 +33,32 @@ class PlatformViewsServiceProxy { MessageCodec? creationParamsCodec, VoidCallback? onFocus, }) { - return PlatformViewsService.initOhosView( - id: id, - viewType: viewType, - layoutDirection: layoutDirection, - creationParams: creationParams, - creationParamsCodec: creationParamsCodec, - onFocus: onFocus, - ); + return PlatformViewsService.initExpensiveOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); + } + + /// Proxy method for [PlatformViewsService.initSurfaceOhosView]. + SurfaceOhosViewController initSurfaceOhosView({ + required int id, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + VoidCallback? onFocus, + }) { + return PlatformViewsService.initSurfaceOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); } } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart new file mode 100644 index 0000000000000000000000000000000000000000..8a24d7039607573abe0f4007ab6f4b13769b6a0f --- /dev/null +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart @@ -0,0 +1,7 @@ +// Copyright 2013 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. + +export 'legacy/webview_ohos.dart'; +export 'legacy/webview_ohos_cookie_manager.dart'; +export 'legacy/webview_surface_ohos.dart'; diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets index e7f746ce2c1dc9153261791d5d0d219f4250a07f..b7130258041111c85a92bb33c68eacc740879088 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets @@ -50,7 +50,7 @@ export class CookieManagerHostApiImpl extends CookieManagerHostApi { } removeAllCookies(identifier: number, result: Result ) { - web_webview.WebCookieManager.deleteEntireCookie() + web_webview.WebCookieManager.clearAllCookiesSync() result.success(true) } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets index 274af8efc1b3d3f643dbfc425bc488bc4c3de241..089728112143e20ed3dfabd109634fe4fd11cc1b 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets @@ -303,8 +303,6 @@ export abstract class WebViewHostApi { abstract setWebChromeClient(instanceId: number, clientInstanceId: number); - abstract setBackgroundColor(instanceId: number, color: number); - static getCodec(): MessageCodec { return WebViewHostApiCodec.INSTANCE; } @@ -1066,38 +1064,6 @@ export abstract class WebViewHostApi { channel.setMessageHandler(null); } } - { - const channel: BasicMessageChannel = - new BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.WebViewHostApi.setBackgroundColor", - WebViewHostApi.getCodec() - ); - if (api != null) { - channel.setMessageHandler( - { - onMessage: (message: ESObject, reply: Reply) => { - let wrapped: ArrayList = new ArrayList(); - const args: Array = message; - const instanceIdArg: number = args[0]; - const colorArg: number = args[1]; - try { - api.setBackgroundColor( - instanceIdArg, - colorArg - ); - wrapped.insert(null, 0); - } catch (err) { - const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); - wrapped = wrappedError; - } - reply.reply(wrapped.convertToArray()); - } - } - ) - } else { - channel.setMessageHandler(null); - } - } } } @@ -2027,6 +1993,8 @@ export abstract class WebSettingsHostApi { abstract setSupportMultipleWindows(instanceId: number, support: boolean): void; + abstract setBackgroundColor(instanceId: number, color: number); + abstract setJavaScriptEnabled(instanceId: number, flag: boolean): void; abstract setUserAgentString(instanceId: number, userAgentString: string): void; @@ -2047,7 +2015,7 @@ export abstract class WebSettingsHostApi { abstract setTextZoom(instanceId: number, textZoom: number): void; - abstract getUserAgentString(instanceId: number): string; + abstract getUserAgentString(instanceId: number): Promise; static getCodec(): MessageCodec { return new StandardMessageCodec(); @@ -2179,6 +2147,38 @@ export abstract class WebSettingsHostApi { channel.setMessageHandler(null); } } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.WebSettingsHostApi.setBackgroundColor", + WebViewHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + { + onMessage: (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const colorArg: number = args[1]; + try { + api.setBackgroundColor( + instanceIdArg, + colorArg + ); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + } + ) + } else { + channel.setMessageHandler(null); + } + } { const channel: BasicMessageChannel = new BasicMessageChannel( @@ -2509,12 +2509,12 @@ export abstract class WebSettingsHostApi { if (api != null) { channel.setMessageHandler( { - onMessage: (message: ESObject, reply: Reply) => { + onMessage: async (message: ESObject, reply: Reply) => { let wrapped: ArrayList = new ArrayList(); const args: Array = message; const instanceIdArg: number = args[0]; try { - let output: string = api.getUserAgentString(instanceIdArg); + let output: string = await api.getUserAgentString(instanceIdArg); wrapped.insert(output, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); @@ -2753,8 +2753,8 @@ export abstract class CookieManagerHostApi { const identifierArg: number = args[0]; const resultCallback: Result = new ResultBuilder( (result: Boolean) => { - wrapped.insert(null, 0); - reply.reply(wrapped); + wrapped.insert(result, 0); + reply.reply(wrapped.convertToArray()); }, (err) => { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); reply.reply(wrappedError.convertToArray()); @@ -3121,7 +3121,7 @@ export abstract class JavaScriptChannelHostApi { const channelNameArg: string = args[1]; try { api.create(instanceIdArg, channelNameArg); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; @@ -3163,7 +3163,7 @@ export abstract class OhosObjectHostApi { const identifierArg: number = args[0]; try { api.dispose(identifierArg); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; @@ -3229,7 +3229,7 @@ export abstract class InstanceManagerHostApi { const channel: BasicMessageChannel = new BasicMessageChannel( - binaryMessenger, "dev.flutter.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec() + binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec() ); if (api != null) { @@ -3241,7 +3241,7 @@ export abstract class InstanceManagerHostApi { try { api.clear(); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets index bbffe2e34ac483ff06c17c0a05c65168a9385bf3..32e6c16b7e32d0510b821911f720570112c2ef82 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets @@ -104,7 +104,7 @@ export class InstanceManager { getIdentifier(instance: Object): number { this.logWarningIfFinalizationListenerHasStopped(); - const identifier: number = this.identifiers.get(instance) || -1; + const identifier: number = this.identifiers.get(instance) ?? -1; return identifier; } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets index 9fc0821650bf0a7c548d9abb8dc32e1bde639efa..94cfb5e430d21f33f6e4c5ae854d5a6f6950964c 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets @@ -31,10 +31,6 @@ export class OhosObjectHostApiImpl extends OhosObjectHostApi { } dispose(identifier: number) { - const instance: ESObject = this.instanceManager.getInstance(identifier); - if (instance instanceof WebViewPlatformView) { - (instance as ESObject).destroy(); - } this.instanceManager.remove(identifier); } } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets index 2bb2b0b49a7604a0355ed6c2b14917e0f45038fe..e42c08b8d61136d06a3ceccd2d5cbff1baa4e9ec 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets @@ -14,62 +14,87 @@ */ import web_webview from '@ohos.web.webview' -import { DynamicUtils } from "./DynamicUtils" - -import { BuilderParams, DVModelParameters } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' +import { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView'; +import { WebViewPlatformView } from './WebViewHostApiImpl'; +import { Any } from '@ohos/flutter_ohos'; @Component export struct OhosWebView { - @Prop params: DVModelParameters = new DVModelParameters(); - controller: web_webview.WebviewController = new web_webview.WebviewController() + @Prop params: Params; + webView: WebViewPlatformView = this.params.platformView as WebViewPlatformView; + controller: web_webview.WebviewController = this.webView.getController(); + + @State textZoomRatio: number = this.webView.getWebSettings().getTextZoom(); + @State disposed: boolean = false; + + aboutToAppear() { + this.webView.getWebSettings().onTextZoomChanged((ratio: number) => { + this.textZoomRatio = ratio; + }); + this.webView.setOnDisposeCallback(() => { + this.disposed = true; + }); + } build() { Column() { - Web( - { - src: DynamicUtils.getParams(this.params, "src"), - controller: this.controller - }) - .onDownloadStart(DynamicUtils.getParams(this.params, "onDownloadStart")) - .onPageBegin(DynamicUtils.getParams(this.params, "onPageBegin")) - .onPageEnd(DynamicUtils.getParams(this.params, "onPageEnd")) - .onErrorReceive(DynamicUtils.getParams(this.params, "onErrorReceive")) - .onLoadIntercept(DynamicUtils.getParams(this.params, "onLoadIntercept")) - .onRefreshAccessedHistory(DynamicUtils.getParams(this.params, "onRefreshAccessedHistory")) - .onProgressChange(DynamicUtils.getParams(this.params, "onProgressChange")) - .onGeolocationShow(DynamicUtils.getParams(this.params, "onGeolocationShow")) - .onGeolocationHide(DynamicUtils.getParams(this.params, "onGeolocationHide")) - .onShowFileSelector(DynamicUtils.getParams(this.params, "onShowFileSelector")) - .onPermissionRequest(DynamicUtils.getParams(this.params, "onPermissionRequest")) - .onConsole(DynamicUtils.getParams(this.params, "onConsoleMessage")) - // .onWindowNew(DynamicUtils.getParams(this.params, "onWindowNew")) - .onWindowExit(DynamicUtils.getParams(this.params, "onWindowExit")) - .domStorageAccess(DynamicUtils.getParams(this.params, "domStorageAccess")) - .allowWindowOpenMethod(DynamicUtils.getParams(this.params, "allowWindowOpenMethod")) - .multiWindowAccess(DynamicUtils.getParams(this.params, "multiWindowAccess")) - .javaScriptAccess(DynamicUtils.getParams(this.params, "javaScriptAccess")) - .mediaPlayGestureAccess(DynamicUtils.getParams(this.params, "mediaPlayGestureAccess")) - .zoomAccess(DynamicUtils.getParams(this.params, "zoomAccess")) - .overviewModeAccess(DynamicUtils.getParams(this.params, "overviewModeAccess")) - .wideViewModeAccess(DynamicUtils.getParams(this.params, "wideViewModeAccess")) - .fileAccess(DynamicUtils.getParams(this.params, "fileAccess")) - .textZoomRatio(DynamicUtils.getParams(this.params, "textZoomRatio")) - .onScroll(DynamicUtils.getParams(this.params, "onScroll")) - .onWindowNew((event) => { - let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); - let dialogController: CustomDialogController = new CustomDialogController({ - builder: NewWebView({ webViewController: newWebViewController }) + if (!this.disposed) { + Web( + { + src: this.webView.getUrl(), + controller: this.controller + }) + .backgroundColor(this.webView.getWebSettings().getBackgroundColor()) + .onDownloadStart(this.webView.onDownloadStart) + .onPageBegin(this.webView.onPageBegin) + .onPageEnd(this.webView.onPageEnd) + .onErrorReceive(this.webView.onErrorReceive) + .onRefreshAccessedHistory(this.webView.onRefreshAccessedHistory) + .onProgressChange(this.webView.onProgressChange) + .onGeolocationShow(this.webView.onGeolocationShow) + .onGeolocationHide(this.webView.onGeolocationHide) + .onShowFileSelector(this.webView.onShowFileSelector) + .onPermissionRequest(this.webView.onPermissionRequest) + .onConsole(this.webView.onConsoleMessage) + .onWindowExit(this.webView.onWindowExit) + .domStorageAccess(this.webView.getWebSettings().getDomStorageEnabled()) + .allowWindowOpenMethod(this.webView.getWebSettings().getJavaScriptCanOpenWindowsAutomatically()) + .multiWindowAccess(false) + .javaScriptAccess(this.webView.getWebSettings().getJavaScriptEnabled()) + .mediaPlayGestureAccess(this.webView.getWebSettings().getMediaPlaybackRequiresUserGesture()) + .zoomAccess(this.webView.getWebSettings().getSupportZoom()) + .overviewModeAccess(this.webView.getWebSettings().getLoadWithOverviewMode()) + .wideViewModeAccess(this.webView.getWebSettings().getUseWideViewPort()) + .fileAccess(this.webView.getWebSettings().getAllowFileAccess()) + .textZoomRatio(this.textZoomRatio) + .onScroll(this.webView.onScroll) + .onControllerAttached(this.webView.onControllerAttached) + .onWindowNew((event: Any) => { + let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); + let dialogController: CustomDialogController = new CustomDialogController({ + builder: NewWebView({ webViewController: newWebViewController }) + }) + dialogController.open(); + event.handler.setWebController(newWebViewController); }) - dialogController.open(); - event.handler.setWebController(newWebViewController); - }) + .mixedMode(MixedMode.All) + .onOverrideUrlLoading(this.webView.onOverrideUrlLoading) + .gesture( + PinchGesture({ fingers: 2 }) + .onActionUpdate((event: GestureEvent) => { + if (event && this.webView.getWebSettings().getSupportZoom()) { + this.controller.zoom(event.scale); + } + }) + ) + } } } } @Builder -export function buildOhosWebView(param: BuilderParams) { - OhosWebView({ params: param.params, controller: DynamicUtils.getParams(param.params, "controller") }) +export function WebBuilder(params: Params) { + OhosWebView({ params: params,webView : params.platformView as WebViewPlatformView , controller : (params.platformView as WebViewPlatformView).getController()}) } @CustomDialog diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets index b4cb86154be817d34bc8d599d4356fdfee388d50..388420aeb00df29e62c1aaddf07c88a5710aed2e 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets @@ -18,33 +18,59 @@ import { InstanceManager } from './InstanceManager'; import { WebViewPlatformView } from './WebViewHostApiImpl'; export interface WebSettings { - setDomStorageEnabled(flag: boolean) : void; + setDomStorageEnabled(flag: boolean): void; - setJavaScriptCanOpenWindowsAutomatically(flag: boolean) : void; + getDomStorageEnabled(): boolean; - setSupportMultipleWindows(support: boolean) : void; + setJavaScriptCanOpenWindowsAutomatically(flag: boolean): void; - setJavaScriptEnabled(flag: boolean) : void; + getJavaScriptCanOpenWindowsAutomatically(): boolean; - setUserAgentString(userAgentString: string) : void; + setSupportMultipleWindows(support: boolean): void; - setMediaPlaybackRequiresUserGesture(require: boolean) : void; + getSupportMultipleWindows(): boolean; - setSupportZoom(support: boolean) : void; + setBackgroundColor(color: number): void; - setLoadWithOverviewMode(overview: boolean) : void; + getBackgroundColor(): string; - setUseWideViewPort(use: boolean) : void; + setJavaScriptEnabled(flag: boolean): void; - setDisplayZoomControls(enabled: boolean) : void; + getJavaScriptEnabled(): boolean; - setBuiltInZoomControls(enabled: boolean) : void; + setUserAgentString(userAgentString: string): void; - setAllowFileAccess(enabled: boolean) : void; + setMediaPlaybackRequiresUserGesture(require: boolean): void; - setTextZoom(textZoom: number) : void; + getMediaPlaybackRequiresUserGesture(): boolean; - getUserAgentString(): string + setSupportZoom(support: boolean): void; + + getSupportZoom(): boolean; + + setLoadWithOverviewMode(overview: boolean): void; + + getLoadWithOverviewMode(): boolean; + + setUseWideViewPort(use: boolean): void; + + getUseWideViewPort(): boolean; + + setDisplayZoomControls(enabled: boolean): void; + + setBuiltInZoomControls(enabled: boolean): void; + + setAllowFileAccess(enabled: boolean): void; + + getAllowFileAccess(): boolean; + + setTextZoom(textZoom: number): void; + + getTextZoom(): number; + + getUserAgentString(): Promise + + onTextZoomChanged(callback: (ratio: number) => void): void; } export class WebSettingsCreator { @@ -85,6 +111,11 @@ export class WebSettingsHostApiImpl extends WebSettingsHostApi { webSettings.setSupportMultipleWindows(support); } + setBackgroundColor(instanceId: number, color: number) { + const webSettings:WebSettings = this.instanceManager.getInstance(instanceId); + webSettings.setBackgroundColor(color); + } + setJavaScriptEnabled(instanceId: number, flag: boolean) { const webSettings:WebSettings = this.instanceManager.getInstance(instanceId); webSettings.setJavaScriptEnabled(flag); @@ -135,7 +166,7 @@ export class WebSettingsHostApiImpl extends WebSettingsHostApi { webSettings.setTextZoom(textZoom); } - getUserAgentString(instanceId: number): string { + getUserAgentString(instanceId: number): Promise { const webSettings:WebSettings = this.instanceManager.getInstance(instanceId); return webSettings.getUserAgentString(); } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets index e075b8e0ed4454ff7ead846ca8be6a824af808c6..0732e12061f2d6c4c713053624b5bfe184a9e119 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets @@ -55,7 +55,7 @@ export class WebViewClientImpl implements WebViewClient { } shouldOverrideUrlLoading(view: WebViewPlatformView, request: WebResourceRequest): boolean { - view.setReturnValueForShouldOverrideUrlLoading(this.returnValueForShouldOverrideUrlLoading); + this.flutterApi.requestLoadingImpl(this, view, request, this.emptyReply); return this.returnValueForShouldOverrideUrlLoading; } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets index c961bc61c87b3a46eb174b724a750f8d8c0819d2..7216a83ebe0749ff0eac4388f82da6dcfc918557 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets @@ -13,11 +13,11 @@ * limitations under the License. */ -import PlatformView from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView' +import PlatformView, { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView' import { DVModel, DVModelParameters } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' import { Result, WebViewHostApi, WebViewPoint } from './GeneratedOhosWebView' import web_webview from '@ohos.web.webview' -import { buildOhosWebView, OhosWebView } from './OhosWebView' +import { WebBuilder, OhosWebView } from './OhosWebView' import { createDVModelFromJson } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicViewJson' import { DVModelJson } from "./DynamicUtils" import { InstanceManager } from './InstanceManager' @@ -73,39 +73,31 @@ export class WebViewHostApiImpl extends WebViewHostApi { webView.getController().loadData(data, mimeType, encoding); } - loadDataWithBaseUrl( + async loadDataWithBaseUrl( instanceId: number, baseUrl: string, data: string, mimeType: string, encoding: string, historyUrl: string - ): void { + ): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); - + await webView.waitControllerAttached(); try { webView.getController().loadData(data, mimeType, encoding, baseUrl == null ? "" : baseUrl , historyUrl == null ? "" : historyUrl); } catch (err) { Log.e(TAG, "loadDataWithBaseUrl err = " + err); - setTimeout( - () => { - this.loadDataWithBaseUrl(instanceId,baseUrl, data, mimeType, encoding, historyUrl); - }, 500 - ) } } - loadUrl(instanceId: number, url: string, headers: Map): void { + async loadUrl(instanceId: number, url: string, headers: Map): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); + await webView.waitControllerAttached(); try { if (url.startsWith("resources/rawfile/")) { webView.getController().loadUrl($rawfile(url.replace("resources/rawfile/","")), this.toWebHeaders(headers)); }else { webView.getController().loadUrl(url, this.toWebHeaders(headers)); } + webView.setUrl(webView.getController().getUrl()); } catch (err) { Log.e(TAG, "loadUrl err = " + err); - setTimeout( - () => { - this.loadUrl(instanceId, url, headers); - }, 500 - ) } } @@ -123,9 +115,14 @@ export class WebViewHostApiImpl extends WebViewHostApi { return result; } - postUrl(instanceId: number, url: string, data: Uint8Array): void { - // TODO:确认实现方式 + async postUrl(instanceId: number, url: string, data: Uint8Array): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); + await webView.waitControllerAttached(); + try { + webView.getController().postUrl(url,data.buffer); + } catch (err) { + Log.e(TAG, "postUrl err = " + err); + } } getUrl(instanceId: number): string { @@ -220,9 +217,10 @@ export class WebViewHostApiImpl extends WebViewHostApi { webView.setWebViewClient(this.instanceManager.getInstance(webViewClientInstanceId)); } - addJavaScriptChannel(instanceId: number, javaScriptChannelInstanceId: number): void { + async addJavaScriptChannel(instanceId: number, javaScriptChannelInstanceId: number): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); const javaScriptChannel: JavaScriptChannel = this.instanceManager.getInstance(javaScriptChannelInstanceId); + await webView.waitControllerAttached(); try { webView.getController().registerJavaScriptProxy( { @@ -233,13 +231,9 @@ export class WebViewHostApiImpl extends WebViewHostApi { javaScriptChannel.getJavaScriptChannelName(), ["postMessage"] ) + webView.getController().refresh() } catch (err) { Log.e(TAG, "addJavaScriptChannel err = " + err); - setTimeout( - () => { - this.addJavaScriptChannel(instanceId, javaScriptChannelInstanceId) - }, 500 - ) } } @@ -259,10 +253,6 @@ export class WebViewHostApiImpl extends WebViewHostApi { webView.setWebChromeClient(this.instanceManager.getInstance(clientInstanceId)); } - setBackgroundColor(instanceId: number, color: number) { - //TODO:Web ground - } - getInstanceManager(): InstanceManager { return this.instanceManager; } @@ -274,6 +264,8 @@ export class WebViewPlatformView extends PlatformView { private controller: web_webview.WebviewController = new web_webview.WebviewController(); + private tempUrl: string = ""; + private downloadListener: DownloadListener = {} as ESObject; private webChromeClient: WebChromeClient | null = null; @@ -290,8 +282,12 @@ export class WebViewPlatformView extends PlatformView { private returnValueForShouldOverrideUrlLoading: boolean = false; - private onDownloadStart = (event: ESObject) => { - if (this.downloadListener) { + private controllerAttached: boolean = false; + + private onDisposeCallback?: () => void; + + onDownloadStart = (event: ESObject) => { + if (this.downloadListener && this.downloadListener.onDownloadStart) { this.downloadListener.onDownloadStart( event.url, event.userAgent, @@ -302,133 +298,132 @@ export class WebViewPlatformView extends PlatformView { } } - private onPageBegin = (event: ESObject) => { + onPageBegin = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onPageStarted(this, event.url); } } - private onPageEnd = (event: ESObject) => { + onPageEnd = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onPageFinished(this, event.url); } } - private onErrorReceive = (event: ESObject) => { + onErrorReceive = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onReceivedError(this, event.request, event.error); } } - private onLoadIntercept = (event: ESObject) => { - Log.i(TAG, "onLoadIntercept event = " + JSON.stringify(event)) + onOverrideUrlLoading = (request: WebResourceRequest) => { + Log.i(TAG, "onOverrideUrlLoading request = " + JSON.stringify(request)) + if(request.getRequestUrl() == 'loaded:///'){ + return true; + } if (this.webViewClint) { - // this.webViewClint.shouldOverrideUrlLoading(this, event.data); - return this.returnValueForShouldOverrideUrlLoading; + return this.webViewClint.shouldOverrideUrlLoading(this, request); } return false; } - private onRefreshAccessedHistory = (event: ESObject) => { + onRefreshAccessedHistory = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.doUpdateVisitedHistory(this, event.url, event.isRefreshed); } } - private onProgressChange = (event: ESObject) => { + onProgressChange = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onProgressChanged(this, event.newProgress) } } - private onGeolocationShow = (event: ESObject) => { + onGeolocationShow = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onGeolocationPermissionsShowPrompt(event.origin, event.geolocation) } } - private onGeolocationHide = () => { + onGeolocationHide = () => { if (this.webChromeClient) { this.webChromeClient.onGeolocationPermissionsHidePrompt(); } } - private onShowFileSelector = (event: ESObject) => { + onShowFileSelector = (event: ESObject) => { if (this.webChromeClient) { return this.webChromeClient.onShowFileChooser(this, event.result, event.fileSelector) } return false; } - private onPermissionRequest = (event: ESObject) => { + onPermissionRequest = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onPermissionRequest(event.request); } } - private onConsoleMessage = (event: ESObject) => { - if (this.webChromeClient) { - return this.webChromeClient.onConsoleMessage(event.message); + onConsoleMessage = (event: ESObject) => { + let message:ConsoleMessage = event.message; + if (message.getMessageLevel() == MessageLevel.Error || message.getMessageLevel() == MessageLevel.Warn) { + if (this.webChromeClient) { + this.webChromeClient.onConsoleMessage(event.message); + } + } else { + Log.d(TAG, "logLevel: " + message.getMessageLevel() + " "+ message.getMessage()); } - return false; + return true; } - private onWindowNew = (event: ESObject) => { + onWindowNew = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onCreateWindow(this, event.isAlert, event.isUserTrigger, event.handler) } } - private onWindowExit = () => { + onWindowExit = () => { if (this.dialogController) { this.dialogController.close(); } } - private onScroll = (event: ESObject) => { + onScroll = (event: ESObject) => { this.scrollX = event.xOffset; this.scrollY = event.yOffset; } - ohosWebView: DVModelJson = new DVModelJson( - "other", - [], - { - src: "", - controller: this.controller, - onDownloadStart: this.onDownloadStart, - onPageBegin: this.onPageBegin, - onPageEnd: this.onPageEnd, - onErrorReceive: this.onErrorReceive, - onLoadIntercept: this.onLoadIntercept, - onRefreshAccessedHistory: this.onRefreshAccessedHistory, - onProgressChange: this.onProgressChange, - onGeolocationShow: this.onGeolocationShow, - onGeolocationHide: this.onGeolocationHide, - onShowFileSelector: this.onShowFileSelector, - onPermissionRequest: this.onPermissionRequest, - onConsoleMessage: this.onConsoleMessage, - onWindowNew: this.onWindowNew, - onWindowExit: this.onWindowExit, - onScroll: this.onScroll - }, - {}, - buildOhosWebView - ) - - private ohosWebViewModel = createDVModelFromJson(this.ohosWebView); - - getView(): DVModel { - return this.ohosWebViewModel; + onControllerAttached = () => { + Log.d(TAG, "onControllerAttached"); + this.controllerAttached = true + } + + + setOnDisposeCallback(callback: () => void) { + this.onDisposeCallback = callback; + } + + getView(): WrappedBuilder<[Params]> { + return new WrappedBuilder(WebBuilder); } dispose(): void { + this.controller.stopAllMedia(); + this.onDisposeCallback && this.onDisposeCallback(); } getController(): web_webview.WebviewController { return this.controller; } + setUrl(url: string): void { + this.tempUrl = url; + } + + getUrl(): string { + return this.tempUrl; + } + getWebCookieManager(): web_webview.WebCookieManager { return this.WebCookieManager } @@ -457,7 +452,7 @@ export class WebViewPlatformView extends PlatformView { if (this.webSettings == null) { this.webSettings = new WebSettingsImpl(this); } - return this.webSettings; + return this.webSettings!; } getScrollX(): number { @@ -471,6 +466,28 @@ export class WebViewPlatformView extends PlatformView { setReturnValueForShouldOverrideUrlLoading(value: boolean) { this.returnValueForShouldOverrideUrlLoading = value; } + + async waitControllerAttached() { + if (!this.controllerAttached) { + await this.checkControllerAttached() + } + } + + checkControllerAttached(): Promise { + return new Promise((resolve, reject) => { + try { + let intervalId = setInterval(() => { + if (this.controllerAttached) { + clearInterval(intervalId) + resolve() + } + }, 20) + } catch (err) { + reject() + } + }) + } + } export class WebViewProxy { @@ -485,47 +502,102 @@ export class WebViewProxy { class WebSettingsImpl implements WebSettings { private webView: WebViewPlatformView; - private params: DVModelParameters; + params: DVModelParameters = new DVModelParameters; + domStorageAccess: boolean = false; + allowWindowOpenMethod : boolean = false; + multiWindowAccess : boolean = false; + backgroundColor : string = ""; + javaScriptAccess : boolean = false; + mediaPlayGestureAccess : boolean = false; + zoomAccess : boolean = true; + overviewModeAccess : boolean = false; + wideViewModeAccess: boolean = false; + fileAccess : boolean = true; + textZoomRatio : number = 0; + textZoomRatioCallback?: (ratio: number) => void; + constructor(webView: WebViewPlatformView) { this.webView = webView; - this.params = webView.getView().params; } setDomStorageEnabled(flag: boolean) { - DynamicUtils.setParams(this.params, "domStorageAccess", flag); + this.domStorageAccess = flag; + } + + getDomStorageEnabled() : boolean{ + return this.domStorageAccess; } setJavaScriptCanOpenWindowsAutomatically(flag: boolean) { - DynamicUtils.setParams(this.params, "allowWindowOpenMethod", flag); + this.allowWindowOpenMethod = flag; + } + + getJavaScriptCanOpenWindowsAutomatically() : boolean{ + return this.allowWindowOpenMethod; } setSupportMultipleWindows(support: boolean) { - DynamicUtils.setParams(this.params, "multiWindowAccess", support); + this.multiWindowAccess = support; + } + + getSupportMultipleWindows() : boolean{ + return this.multiWindowAccess; + } + + setBackgroundColor(color: number) { + // number 无法实现透明度,所以转成 string + let colorStr = `#${color.toString(16).padStart(8, '0')}`; + this.backgroundColor = colorStr; + } + + getBackgroundColor() : string{ + return this.backgroundColor; } setJavaScriptEnabled(flag: boolean) { - DynamicUtils.setParams(this.params, "javaScriptAccess", flag); + this.javaScriptAccess = flag; } - setUserAgentString(userAgentString: string) { + getJavaScriptEnabled() : boolean { + return this.javaScriptAccess; + } + + async setUserAgentString(userAgentString: string) { + await this.webView.waitControllerAttached(); this.webView.getController().setCustomUserAgent(userAgentString); } setMediaPlaybackRequiresUserGesture(require: boolean) { - DynamicUtils.setParams(this.params, "mediaPlayGestureAccess", require); + this.mediaPlayGestureAccess = require; + } + + getMediaPlaybackRequiresUserGesture() : boolean{ + return this.mediaPlayGestureAccess; } setSupportZoom(support: boolean) { - DynamicUtils.setParams(this.params, "zoomAccess", support); + this.zoomAccess = support; + } + + getSupportZoom() : boolean{ + return this.zoomAccess; } setLoadWithOverviewMode(overview: boolean) { - DynamicUtils.setParams(this.params, "overviewModeAccess", overview); + this.overviewModeAccess = overview; + } + + getLoadWithOverviewMode() : boolean { + return this.overviewModeAccess; } setUseWideViewPort(use: boolean) { - DynamicUtils.setParams(this.params, "wideViewModeAccess", use); + this.wideViewModeAccess = use; + } + + getUseWideViewPort() : boolean { + return this.wideViewModeAccess; } setDisplayZoomControls(enabled: boolean) { @@ -537,13 +609,29 @@ class WebSettingsImpl implements WebSettings { } setAllowFileAccess(enabled: boolean) { - DynamicUtils.setParams(this.params, "fileAccess", enabled); + this.fileAccess = enabled; + } + + getAllowFileAccess() : boolean { + return this.fileAccess; } setTextZoom(textZoom: number) { - DynamicUtils.setParams(this.params, "textZoomRatio", textZoom); + this.textZoomRatio = textZoom; + this.textZoomRatioCallback && this.textZoomRatioCallback(textZoom); } - getUserAgentString(): string { + + async getUserAgentString(): Promise { + await this.webView.waitControllerAttached(); return this.webView.getController().getCustomUserAgent(); } + + getTextZoom() : number{ + return this.textZoomRatio; + } + + onTextZoomChanged(callback: (ratio: number) => void): void { + this.textZoomRatioCallback = callback; + } + } \ No newline at end of file diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/pubspec.yaml index c61697bce4028bed7dfaace81bb934f581fae369..020d7ba8e1d6d314e66dcc7c3f2758200a411d26 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/pubspec.yaml @@ -18,7 +18,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 3.13.2 environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" flutter: diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/example/pubspec.yaml index 9d8497597efa6f2d3b3699fe648de7099d435cd2..f2e9fda17141736656420c1e44f33a5718ec5f63 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/example/pubspec.yaml @@ -16,7 +16,7 @@ description: Demonstrates how to use the webview_flutter_wkwebview plugin. publish_to: none environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" dependencies: diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/pubspec.yaml index a96a44a07a3a40d73aa6af72e3040e27fbe848b0..d3e39633e9faaca7c86e280f2737325fedc319f2 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter-v4.4.4/webview_flutter_wkwebview/pubspec.yaml @@ -18,7 +18,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 3.10.1 environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" flutter: diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md index 6d0d35f6b63e437b9e281531135343f77e319ea1..792fb444fae598b79448b6136a1f52e7894989a3 100644 --- a/packages/webview_flutter/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md @@ -1,3 +1,33 @@ +## 4.6.0 + +* Adds support for custom handling of JavaScript dialogs. See + `WebViewController.setOnJavaScriptAlertDialog`, `WebViewController.setOnJavaScriptConfirmDialog` + and `WebViewController.setOnJavaScriptTextInputDialog`. +## 4.4.4 + +* Updates minimum required plugin_platform_interface version to 2.1.7. + +## 4.4.3 + +* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. +* Fixes new lint warnings. + +## 4.4.2 + +* Fixes `use_build_context_synchronously` lint violations in the example app. + +## 4.4.1 + +* Exposes `JavaScriptLogLevel` from platform interface. + +## 4.4.0 + +* Adds support to register a callback to receive JavaScript console messages. See `WebViewController.setOnConsoleMessage`. + +## 4.3.0 + +* Adds support to retrieve the user agent. See `WebViewController.getUserAgent`. + ## 4.2.4 * Adds pub topics to package metadata. diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/legacy/webview_flutter_test.dart index a1fa2f5fb0b98720142af9a0342cd5c55ded7aa2..7f30a2b50386fde90b7e2e35b6b1001694f91a0c 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/legacy/webview_flutter_test.dart @@ -144,11 +144,9 @@ Future main() async { 'test_header': 'flutter_test_header' }; await controller.loadUrl(headersUrl, headers: headers); - final String? currentUrl = await controller.currentUrl(); - expect(currentUrl, headersUrl); - await pageStarts.stream.firstWhere((String url) => url == currentUrl); - await pageLoads.stream.firstWhere((String url) => url == currentUrl); + await pageStarts.stream.firstWhere((String url) => url == headersUrl); + await pageLoads.stream.firstWhere((String url) => url == headersUrl); final String content = await controller .runJavascriptReturningResult('document.documentElement.innerText'); diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart index 22cbbeaac143f7fd9073ea9af507554fb701361d..d851aaeabeb72c3848afcde0b3104127cd01ec60 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart @@ -32,6 +32,25 @@ Future main() async { request.response.writeln('${request.headers}'); } else if (request.uri.path == '/favicon.ico') { request.response.statusCode = HttpStatus.notFound; + } else if (request.uri.path == '/http-basic-authentication') { + final List? authHeader = + request.headers[HttpHeaders.authorizationHeader]; + if (authHeader != null) { + final String encodedCredential = authHeader.first.split(' ')[1]; + final String credential = + String.fromCharCodes(base64Decode(encodedCredential)); + if (credential == 'user:password') { + request.response.writeln('Authorized'); + } else { + request.response.headers.add( + HttpHeaders.wwwAuthenticateHeader, 'Basic realm="Test realm"'); + request.response.statusCode = HttpStatus.unauthorized; + } + } else { + request.response.headers + .add(HttpHeaders.wwwAuthenticateHeader, 'Basic realm="Test realm"'); + request.response.statusCode = HttpStatus.unauthorized; + } } else { fail('unexpected request: ${request.method} ${request.uri}'); } @@ -41,6 +60,7 @@ Future main() async { final String primaryUrl = '$prefixUrl/hello.txt'; final String secondaryUrl = '$prefixUrl/secondary.txt'; final String headersUrl = '$prefixUrl/headers'; + final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets('loadRequest', (WidgetTester tester) async { final Completer pageFinished = Completer(); @@ -52,7 +72,6 @@ Future main() async { unawaited(controller.loadRequest(Uri.parse(primaryUrl))); await tester.pumpWidget(WebViewWidget(controller: controller)); - await pageFinished.future; final String? currentUrl = await controller.currentUrl(); @@ -179,7 +198,7 @@ Future main() async { await pageFinished.future; - final String customUserAgent = await _getUserAgent(controller); + final String? customUserAgent = await controller.getUserAgent(); expect(customUserAgent, 'Custom_User_Agent1'); }); @@ -761,6 +780,54 @@ Future main() async { await expectLater(urlChangeCompleter.future, completion(secondaryUrl)); }); + + testWidgets('can receive HTTP basic auth requests', + (WidgetTester tester) async { + final Completer authRequested = Completer(); + final WebViewController controller = WebViewController(); + + unawaited( + controller.setNavigationDelegate( + NavigationDelegate( + onHttpAuthRequest: (HttpAuthRequest request) => + authRequested.complete(), + ), + ), + ); + + await tester.pumpWidget(WebViewWidget(controller: controller)); + + unawaited(controller.loadRequest(Uri.parse(basicAuthUrl))); + + await expectLater(authRequested.future, completes); + }); + + testWidgets('can authenticate to HTTP basic auth requests', + (WidgetTester tester) async { + final WebViewController controller = WebViewController(); + final Completer pageFinished = Completer(); + + unawaited( + controller.setNavigationDelegate( + NavigationDelegate( + onHttpAuthRequest: (HttpAuthRequest request) => request.onProceed( + const WebViewCredential( + user: 'user', + password: 'password', + ), + ), + onPageFinished: (_) => pageFinished.complete(), + onWebResourceError: (_) => fail('Authentication failed'), + ), + ), + ); + + await tester.pumpWidget(WebViewWidget(controller: controller)); + + unawaited(controller.loadRequest(Uri.parse(basicAuthUrl))); + + await expectLater(pageFinished.future, completes); + }); }); testWidgets('target _blank opens in same window', @@ -876,22 +943,6 @@ String _webViewString(String value) { return '"$value"'; } -/// Returns the value used for the HTTP User-Agent: request header in subsequent HTTP requests. -Future _getUserAgent(WebViewController controller) async { - return _runJavascriptReturningResult(controller, 'navigator.userAgent;'); -} - -Future _runJavascriptReturningResult( - WebViewController controller, - String js, -) async { - if (defaultTargetPlatform == TargetPlatform.iOS) { - return await controller.runJavaScriptReturningResult(js) as String; - } - return jsonDecode(await controller.runJavaScriptReturningResult(js) as String) - as String; -} - class ResizableWebView extends StatefulWidget { const ResizableWebView({ super.key, diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart index c7fbd63958fd5ec3c42f205f017d1b7a159c185f..8e1982964d1b8c1ec087ea761b01544a11ed3ee5 100644 --- a/packages/webview_flutter/webview_flutter/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart @@ -76,6 +76,40 @@ const String kTransparentBackgroundPage = ''' '''; +const String kLogExamplePage = ''' + + + +Load file or HTML string example + + + +

Local demo page

+

+ This page is used to test the forwarding of console logs to Dart. +

+ + + +
+ + + + + +
+ + + +'''; + class WebViewExample extends StatefulWidget { const WebViewExample({super.key}); @@ -139,6 +173,9 @@ Page resource error: onUrlChange: (UrlChange change) { debugPrint('url change to ${change.url}'); }, + onHttpAuthRequest: (HttpAuthRequest request) { + openDialog(request); + }, ), ) ..addJavaScriptChannel( @@ -183,7 +220,7 @@ Page resource error: return FloatingActionButton( onPressed: () async { final String? url = await _controller.currentUrl(); - if (context.mounted) { + if (mounted) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Favorited $url')), ); @@ -192,6 +229,62 @@ Page resource error: child: const Icon(Icons.favorite), ); } + + Future openDialog(HttpAuthRequest httpRequest) async { + final TextEditingController usernameTextController = + TextEditingController(); + final TextEditingController passwordTextController = + TextEditingController(); + + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: Text('${httpRequest.host}: ${httpRequest.realm ?? '-'}'), + content: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + decoration: const InputDecoration(labelText: 'Username'), + autofocus: true, + controller: usernameTextController, + ), + TextField( + decoration: const InputDecoration(labelText: 'Password'), + controller: passwordTextController, + ), + ], + ), + ), + actions: [ + // Explicitly cancel the request on iOS as the OS does not emit new + // requests when a previous request is pending. + TextButton( + onPressed: () { + httpRequest.onCancel(); + Navigator.of(context).pop(); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + httpRequest.onProceed( + WebViewCredential( + user: usernameTextController.text, + password: passwordTextController.text, + ), + ); + Navigator.of(context).pop(); + }, + child: const Text('Authenticate'), + ), + ], + ); + }, + ); + } } enum MenuOptions { @@ -208,6 +301,8 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + logExample, + basicAuthentication, } class SampleMenu extends StatelessWidget { @@ -264,6 +359,12 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.logExample: + _onLogExample(); + break; + case MenuOptions.basicAuthentication: + _promptForUrl(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -320,6 +421,14 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.setCookie, child: Text('Set cookie'), ), + const PopupMenuItem( + value: MenuOptions.logExample, + child: Text('Log example'), + ), + const PopupMenuItem( + value: MenuOptions.basicAuthentication, + child: Text('Basic Authentication Example'), + ), ], ); } @@ -463,6 +572,48 @@ class SampleMenu extends StatelessWidget { return indexFile.path; } + + Future _onLogExample() { + webViewController + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + debugPrint( + '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); + }); + + return webViewController.loadHtmlString(kLogExamplePage); + } + + Future _promptForUrl(BuildContext context) { + final TextEditingController urlTextController = TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Input URL to visit'), + content: TextField( + decoration: const InputDecoration(labelText: 'URL'), + autofocus: true, + controller: urlTextController, + ), + actions: [ + TextButton( + onPressed: () { + if (urlTextController.text.isNotEmpty) { + final Uri? uri = Uri.tryParse(urlTextController.text); + if (uri != null && uri.scheme.isNotEmpty) { + webViewController.loadRequest(uri); + Navigator.pop(context); + } + } + }, + child: const Text('Visit'), + ), + ], + ); + }, + ); + } } class NavigationControls extends StatelessWidget { diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index 1cecea648380aa24b6460439ede45c2500a2b4c5..b5a664539a7c6b832a5d49dda1e53ed48b214e55 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -17,8 +17,8 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_android: ^3.6.0 - webview_flutter_wkwebview: ^3.4.0 + webview_flutter_android: ^3.14.0 + webview_flutter_wkwebview: ^3.11.0 dev_dependencies: build_runner: ^2.1.5 @@ -27,7 +27,7 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - webview_flutter_platform_interface: ^2.3.0 + webview_flutter_platform_interface: ^2.10.0 flutter: uses-material-design: true diff --git a/packages/webview_flutter/webview_flutter/example/test/main_test.dart b/packages/webview_flutter/webview_flutter/example/test/main_test.dart index b1f36d364abd0abfa663da1106c34610593ebe44..c4b43428ec9edd84c4f5b29b39f0a4768c45da66 100644 --- a/packages/webview_flutter/webview_flutter/example/test/main_test.dart +++ b/packages/webview_flutter/webview_flutter/example/test/main_test.dart @@ -116,4 +116,9 @@ class FakeNavigationDelegate extends PlatformNavigationDelegate { @override Future setOnUrlChange(UrlChangeCallback onUrlChange) async {} + + @override + Future setOnHttpAuthRequest( + HttpAuthRequestCallback handler, + ) async {} } diff --git a/packages/webview_flutter/webview_flutter/lib/src/legacy/platform_interface.dart b/packages/webview_flutter/webview_flutter/lib/src/legacy/platform_interface.dart index e036d2ef88a52861ce377fc05fee3098016514c3..f346d356ea7d381fbeb9fbcaf3d7986ea69ea8df 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/legacy/platform_interface.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/legacy/platform_interface.dart @@ -5,6 +5,8 @@ /// Re-export the classes from the webview_flutter_platform_interface through /// the `platform_interface.dart` file so we don't accidentally break any /// non-endorsed existing implementations of the interface. +library; + export 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart' show AutoMediaPlaybackPolicy, @@ -12,16 +14,16 @@ export 'package:webview_flutter_platform_interface/src/webview_flutter_platform_ JavascriptChannel, JavascriptChannelRegistry, JavascriptMessage, - JavascriptMode, JavascriptMessageHandler, + JavascriptMode, + WebResourceError, + WebResourceErrorType, + WebSetting, + WebSettings, + WebViewCookie, WebViewPlatform, WebViewPlatformCallbacksHandler, WebViewPlatformController, WebViewPlatformCreatedCallback, - WebSetting, - WebSettings, - WebResourceError, - WebResourceErrorType, - WebViewCookie, WebViewRequest, WebViewRequestMethod; diff --git a/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart b/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart index 55826a533b1738fe36c5d72704ec1b02060b12cd..ce9668712eaa78a5705b75c9f234d6ea7fc5181b 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart @@ -14,6 +14,7 @@ import 'package:webview_flutter_android/src/webview_flutter_android_legacy.dart' import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; // ignore: implementation_imports import 'package:webview_flutter_wkwebview/src/webview_flutter_wkwebview_legacy.dart'; +import 'package:webview_flutter_ohos/src/webview_flutter_ohos_legacy.dart'; /// Optional callback invoked when a web view is first created. [controller] is /// the [WebViewController] for the created web view. @@ -126,6 +127,9 @@ class WebView extends StatefulWidget { _platform = CupertinoWebView(); break; // ignore: no_default_cases + case TargetPlatform.ohos: + _platform = SurfaceOhosWebView(); + break; default: throw UnsupportedError( "Trying to use the default webview implementation for $defaultTargetPlatform but there isn't a default one"); diff --git a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart index 9ca6981339d18a7fd1eaf314cfce9faf167fd3f7..a490fb1ca8b1445e048fcede9e432fb4f1c5dcda 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -39,6 +39,7 @@ class NavigationDelegate { /// /// {@template webview_fluttter.NavigationDelegate.constructor} /// `onUrlChange`: invoked when the underlying web view changes to a new url. + /// `onHttpAuthRequest`: invoked when the web view is requesting authentication. /// {@endtemplate} NavigationDelegate({ FutureOr Function(NavigationRequest request)? @@ -48,6 +49,7 @@ class NavigationDelegate { void Function(int progress)? onProgress, void Function(WebResourceError error)? onWebResourceError, void Function(UrlChange change)? onUrlChange, + void Function(HttpAuthRequest request)? onHttpAuthRequest, }) : this.fromPlatformCreationParams( const PlatformNavigationDelegateCreationParams(), onNavigationRequest: onNavigationRequest, @@ -56,6 +58,7 @@ class NavigationDelegate { onProgress: onProgress, onWebResourceError: onWebResourceError, onUrlChange: onUrlChange, + onHttpAuthRequest: onHttpAuthRequest, ); /// Constructs a [NavigationDelegate] from creation params for a specific @@ -98,6 +101,7 @@ class NavigationDelegate { void Function(int progress)? onProgress, void Function(WebResourceError error)? onWebResourceError, void Function(UrlChange change)? onUrlChange, + void Function(HttpAuthRequest request)? onHttpAuthRequest, }) : this.fromPlatform( PlatformNavigationDelegate(params), onNavigationRequest: onNavigationRequest, @@ -106,6 +110,7 @@ class NavigationDelegate { onProgress: onProgress, onWebResourceError: onWebResourceError, onUrlChange: onUrlChange, + onHttpAuthRequest: onHttpAuthRequest, ); /// Constructs a [NavigationDelegate] from a specific platform implementation. @@ -119,6 +124,7 @@ class NavigationDelegate { this.onProgress, this.onWebResourceError, void Function(UrlChange change)? onUrlChange, + HttpAuthRequestCallback? onHttpAuthRequest, }) { if (onNavigationRequest != null) { platform.setOnNavigationRequest(onNavigationRequest!); @@ -138,6 +144,9 @@ class NavigationDelegate { if (onUrlChange != null) { platform.setOnUrlChange(onUrlChange); } + if (onHttpAuthRequest != null) { + platform.setOnHttpAuthRequest(onHttpAuthRequest); + } } /// Implementation of [PlatformNavigationDelegate] for the current platform. diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart index 13435edd6fe275bd540ef792a6e6cde52bdd904c..d917d7637c2e5726739a28305724125096cdcfcc 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart @@ -353,6 +353,51 @@ class WebViewController { Future setUserAgent(String? userAgent) { return platform.setUserAgent(userAgent); } + + /// Sets a callback that notifies the host application on any log messages + /// written to the JavaScript console. + /// + /// Platforms may not preserve all the log level information so clients should + /// not rely on a 1:1 mapping between the JavaScript calls. + /// + /// On iOS setting this callback will inject a custom [WKUserScript] which + /// overrides the default implementation of `console.debug`, `console.error`, + /// `console.info`, `console.log` and `console.warning` methods. The iOS + /// WebKit framework unfortunately doesn't provide a built-in method to + /// forward console messages. + Future setOnConsoleMessage( + void Function(JavaScriptConsoleMessage message) onConsoleMessage) { + return platform.setOnConsoleMessage(onConsoleMessage); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript alert() dialog. + Future setOnJavaScriptAlertDialog( + Future Function(JavaScriptAlertDialogRequest request) + onJavaScriptAlertDialog) async { + return platform.setOnJavaScriptAlertDialog(onJavaScriptAlertDialog); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript confirm() dialog. + Future setOnJavaScriptConfirmDialog( + Future Function(JavaScriptConfirmDialogRequest request) + onJavaScriptConfirmDialog) async { + return platform.setOnJavaScriptConfirmDialog(onJavaScriptConfirmDialog); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript prompt() dialog. + Future setOnJavaScriptTextInputDialog( + Future Function(JavaScriptTextInputDialogRequest request) + onJavaScriptTextInputDialog) async { + return platform.setOnJavaScriptTextInputDialog(onJavaScriptTextInputDialog); + } + + /// Gets the value used for the HTTP `User-Agent:` request header. + Future getUserAgent() { + return platform.getUserAgent(); + } } /// Permissions request when web content requests access to protected resources. diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview_flutter_legacy.dart b/packages/webview_flutter/webview_flutter/lib/src/webview_flutter_legacy.dart index d040fc2e71d8066b2b85682f93a7cbf8ad71d0b7..9304ba28c27c87ddbc4c0cee0b8bb631c0732e9f 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/webview_flutter_legacy.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/webview_flutter_legacy.dart @@ -4,6 +4,7 @@ export 'package:webview_flutter_android/src/webview_flutter_android_legacy.dart'; export 'package:webview_flutter_wkwebview/src/webview_flutter_wkwebview_legacy.dart'; +export 'package:webview_flutter_ohos/src/webview_flutter_ohos_legacy.dart'; export 'legacy/platform_interface.dart'; export 'legacy/webview.dart'; diff --git a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart index 3e85cc389ac01566cff0ebeae0cb9f6cfedb9be7..29a7d48cd5707c2312f84e7ed4b58e5f5e123218 100644 --- a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart +++ b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart @@ -2,12 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -library webview_flutter; - export 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' show + HttpAuthRequest, + JavaScriptAlertDialogRequest, + JavaScriptConfirmDialogRequest, + JavaScriptConsoleMessage, + JavaScriptLogLevel, JavaScriptMessage, JavaScriptMode, + JavaScriptTextInputDialogRequest, LoadRequestMethod, NavigationDecision, NavigationRequest, @@ -24,6 +28,7 @@ export 'package:webview_flutter_platform_interface/webview_flutter_platform_inte WebResourceErrorCallback, WebResourceErrorType, WebViewCookie, + WebViewCredential, WebViewPermissionResourceType, WebViewPlatform; diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index 1d5cbc77d1e05cdc93b0e6a419a7caa0c178d32e..02d7d6940b5a0419a812c923c61142e45770d1b0 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.2.4 +version: 4.6.0 environment: sdk: ">=2.19.0 <4.0.0" @@ -21,9 +21,18 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_android: ^3.0.0 - webview_flutter_platform_interface: ^2.3.0 - webview_flutter_wkwebview: ^3.0.0 + webview_flutter_android: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_android + webview_flutter_platform_interface: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_platform_interface + webview_flutter_wkwebview: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_wkwebview webview_flutter_ohos: git: url: "https://gitee.com/openharmony-sig/flutter_packages.git" @@ -33,7 +42,7 @@ dev_dependencies: build_runner: ^2.1.5 flutter_test: sdk: flutter - mockito: 5.4.1 + mockito: 5.4.4 plugin_platform_interface: ^2.1.3 topics: diff --git a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart index 4db70113dfb2c1ee2fe134370d4bef1d67523e54..6abd2648377a0774f043581d465c2ec0ac648767 100644 --- a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart @@ -1277,7 +1277,7 @@ class MyWebViewPlatform implements WebViewPlatform { }) { assert(onWebViewPlatformCreated != null); lastPlatformBuilt = MyWebViewPlatformController( - creationParams, gestureRecognizers, webViewPlatformCallbacksHandler); + creationParams, webViewPlatformCallbacksHandler); onWebViewPlatformCreated!(lastPlatformBuilt); return Container(); } @@ -1289,12 +1289,11 @@ class MyWebViewPlatform implements WebViewPlatform { } class MyWebViewPlatformController extends WebViewPlatformController { - MyWebViewPlatformController(this.creationParams, this.gestureRecognizers, - WebViewPlatformCallbacksHandler platformHandler) + MyWebViewPlatformController( + this.creationParams, WebViewPlatformCallbacksHandler platformHandler) : super(platformHandler); CreationParams? creationParams; - Set>? gestureRecognizers; String? lastUrlLoaded; Map? lastRequestHeaders; @@ -1320,13 +1319,13 @@ class MatchesWebSettings extends Matcher { bool matches( covariant WebSettings webSettings, Map matchState) { return _webSettings!.javascriptMode == webSettings.javascriptMode && - _webSettings!.hasNavigationDelegate == + _webSettings.hasNavigationDelegate == webSettings.hasNavigationDelegate && - _webSettings!.debuggingEnabled == webSettings.debuggingEnabled && - _webSettings!.gestureNavigationEnabled == + _webSettings.debuggingEnabled == webSettings.debuggingEnabled && + _webSettings.gestureNavigationEnabled == webSettings.gestureNavigationEnabled && - _webSettings!.userAgent == webSettings.userAgent && - _webSettings!.zoomEnabled == webSettings.zoomEnabled; + _webSettings.userAgent == webSettings.userAgent && + _webSettings.zoomEnabled == webSettings.zoomEnabled; } } diff --git a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart index ae59ec3b5a730a618a0e51754bc1300d41774a42..ff3f06b0e65e8ebd90a89edc244c6cfc20791101 100644 --- a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter/test/legacy/webview_flutter_test.dart. // Do not manually edit this file. @@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart' as _i3; import 'package:flutter/gestures.dart' as _i8; import 'package:flutter/widgets.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i11; import 'package:webview_flutter_platform_interface/src/legacy/platform_interface/javascript_channel_registry.dart' as _i7; import 'package:webview_flutter_platform_interface/src/legacy/platform_interface/webview_platform.dart' @@ -24,6 +25,8 @@ import 'package:webview_flutter_platform_interface/src/legacy/types/types.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -92,6 +95,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i4.WebViewPlatform { ), ), ) as _i2.Widget); + @override _i9.Future clearCookies() => (super.noSuchMethod( Invocation.method( @@ -120,6 +124,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -129,6 +134,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadHtmlString( String? html, { @@ -143,6 +149,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadUrl( String? url, @@ -159,6 +166,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadRequest(_i5.WebViewRequest? request) => (super.noSuchMethod( @@ -169,6 +177,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future updateSettings(_i5.WebSettings? setting) => (super.noSuchMethod( @@ -179,6 +188,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -187,6 +197,7 @@ class MockWebViewPlatformController extends _i1.Mock ), returnValue: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -195,6 +206,7 @@ class MockWebViewPlatformController extends _i1.Mock ), returnValue: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -203,6 +215,7 @@ class MockWebViewPlatformController extends _i1.Mock ), returnValue: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -212,6 +225,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -221,6 +235,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future reload() => (super.noSuchMethod( Invocation.method( @@ -230,6 +245,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -239,6 +255,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future evaluateJavascript(String? javascript) => (super.noSuchMethod( @@ -246,8 +263,15 @@ class MockWebViewPlatformController extends _i1.Mock #evaluateJavascript, [javascript], ), - returnValue: _i9.Future.value(''), + returnValue: _i9.Future.value(_i11.dummyValue( + this, + Invocation.method( + #evaluateJavascript, + [javascript], + ), + )), ) as _i9.Future); + @override _i9.Future runJavascript(String? javascript) => (super.noSuchMethod( Invocation.method( @@ -257,6 +281,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future runJavascriptReturningResult(String? javascript) => (super.noSuchMethod( @@ -264,8 +289,15 @@ class MockWebViewPlatformController extends _i1.Mock #runJavascriptReturningResult, [javascript], ), - returnValue: _i9.Future.value(''), + returnValue: _i9.Future.value(_i11.dummyValue( + this, + Invocation.method( + #runJavascriptReturningResult, + [javascript], + ), + )), ) as _i9.Future); + @override _i9.Future addJavascriptChannels(Set? javascriptChannelNames) => (super.noSuchMethod( @@ -276,6 +308,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future removeJavascriptChannels( Set? javascriptChannelNames) => @@ -287,6 +320,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -295,6 +329,7 @@ class MockWebViewPlatformController extends _i1.Mock ), returnValue: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollTo( int? x, @@ -311,6 +346,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollBy( int? x, @@ -327,6 +363,7 @@ class MockWebViewPlatformController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -335,6 +372,7 @@ class MockWebViewPlatformController extends _i1.Mock ), returnValue: _i9.Future.value(0), ) as _i9.Future); + @override _i9.Future getScrollY() => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart index ffd97718bd4037124c5870ddae2260ecc6ff45e2..c2bc6f230fa5ae1857490163ecc69b8d40e107f6 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart @@ -87,6 +87,18 @@ void main() { verify(delegate.platform.setOnUrlChange(onUrlChange)); }); + + test('onHttpAuthRequest', () { + WebViewPlatform.instance = TestWebViewPlatform(); + + void onHttpAuthRequest(HttpAuthRequest request) {} + + final NavigationDelegate delegate = NavigationDelegate( + onHttpAuthRequest: onHttpAuthRequest, + ); + + verify(delegate.platform.setOnHttpAuthRequest(onHttpAuthRequest)); + }); }); } diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart index f290d4036c278b2352bec7236d2040fe87fc040f..883191779cc7c78e9c98cea81c05ee1c398e21c4 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter/test/navigation_delegate_test.dart. // Do not manually edit this file. @@ -22,6 +22,8 @@ import 'package:webview_flutter_platform_interface/src/webview_platform.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -108,6 +110,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i7.WebViewPlatform { ), ), ) as _i2.PlatformWebViewCookieManager); + @override _i3.PlatformNavigationDelegate createPlatformNavigationDelegate( _i6.PlatformNavigationDelegateCreationParams? params) => @@ -124,6 +127,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i7.WebViewPlatform { ), ), ) as _i3.PlatformNavigationDelegate); + @override _i4.PlatformWebViewController createPlatformWebViewController( _i6.PlatformWebViewControllerCreationParams? params) => @@ -140,6 +144,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i7.WebViewPlatform { ), ), ) as _i4.PlatformWebViewController); + @override _i5.PlatformWebViewWidget createPlatformWebViewWidget( _i6.PlatformWebViewWidgetCreationParams? params) => @@ -176,6 +181,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock Invocation.getter(#params), ), ) as _i6.PlatformNavigationDelegateCreationParams); + @override _i8.Future setOnNavigationRequest( _i3.NavigationRequestCallback? onNavigationRequest) => @@ -187,6 +193,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( @@ -197,6 +204,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( @@ -207,6 +215,18 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpError, + [onHttpError], + ), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); + @override _i8.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( @@ -217,6 +237,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future setOnWebResourceError( _i3.WebResourceErrorCallback? onWebResourceError) => @@ -228,6 +249,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( @@ -238,4 +260,16 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setOnHttpAuthRequest( + _i3.HttpAuthRequestCallback? onHttpAuthRequest) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); } diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart index 79d01ba044516e57ea5b9637048f8b31ee9e9f79..9eb5343f84df9d3de9aadb097073133bb5c029c6 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart @@ -387,6 +387,93 @@ void main() { requestCallback(const TestPlatformWebViewPermissionRequest()); expect(permissionRequestCallbackCalled, isTrue); }); + + test('setConsoleLogCallback', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + + void onConsoleMessage(JavaScriptConsoleMessage message) {} + + await webViewController.setOnConsoleMessage(onConsoleMessage); + + verify(mockPlatformWebViewController.setOnConsoleMessage(onConsoleMessage)); + }); + + test('setOnJavaScriptAlertDialog', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + + Future onJavaScriptAlertDialog( + JavaScriptAlertDialogRequest request) async { + return; + } + + await webViewController.setOnJavaScriptAlertDialog(onJavaScriptAlertDialog); + verify(mockPlatformWebViewController + .setOnJavaScriptAlertDialog(onJavaScriptAlertDialog)); + }); + + test('setOnJavaScriptConfirmDialog', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + + Future onJavaScriptConfirmDialog( + JavaScriptConfirmDialogRequest request) async { + return true; + } + + await webViewController + .setOnJavaScriptConfirmDialog(onJavaScriptConfirmDialog); + verify(mockPlatformWebViewController + .setOnJavaScriptConfirmDialog(onJavaScriptConfirmDialog)); + }); + + test('setOnJavaScriptTextInputDialog', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + + Future onJavaScriptTextInputDialog( + JavaScriptTextInputDialogRequest request) async { + return 'text'; + } + + await webViewController + .setOnJavaScriptTextInputDialog(onJavaScriptTextInputDialog); + verify(mockPlatformWebViewController + .setOnJavaScriptTextInputDialog(onJavaScriptTextInputDialog)); + }); + + test('getUserAgent', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + const String userAgent = 'str'; + + when(mockPlatformWebViewController.getUserAgent()).thenAnswer( + (_) => Future.value(userAgent), + ); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + await expectLater(webViewController.getUserAgent(), completion(userAgent)); + }); } class TestPlatformWebViewPermissionRequest diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart index fc242755fd1af8c161e6bdc71df43fa99c3a2129..981e7386ac0fba5d356f8a132a60663e00f1bab6 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter/test/webview_controller_test.dart. // Do not manually edit this file. @@ -17,6 +17,8 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -83,6 +85,7 @@ class MockPlatformWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformWebViewControllerCreationParams); + @override _i5.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -92,6 +95,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -101,6 +105,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadHtmlString( String? html, { @@ -115,6 +120,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadRequest(_i2.LoadRequestParams? params) => (super.noSuchMethod( @@ -125,6 +131,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -133,6 +140,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -141,6 +149,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -149,6 +158,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -158,6 +168,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -167,6 +178,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -176,6 +188,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -185,6 +198,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -194,6 +208,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setPlatformNavigationDelegate( _i6.PlatformNavigationDelegate? handler) => @@ -205,6 +220,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -214,6 +230,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -229,6 +246,7 @@ class MockPlatformWebViewController extends _i1.Mock ), )), ) as _i5.Future); + @override _i5.Future addJavaScriptChannel( _i4.JavaScriptChannelParams? javaScriptChannelParams) => @@ -240,6 +258,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -250,6 +269,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -258,6 +278,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollTo( int? x, @@ -274,6 +295,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollBy( int? x, @@ -290,6 +312,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -304,6 +327,7 @@ class MockPlatformWebViewController extends _i1.Mock ), )), ) as _i5.Future<_i3.Offset>); + @override _i5.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -313,6 +337,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( Invocation.method( @@ -322,6 +347,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -332,6 +358,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -341,6 +368,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnPlatformPermissionRequest( void Function(_i2.PlatformWebViewPermissionRequest)? @@ -353,6 +381,78 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future getUserAgent() => (super.noSuchMethod( + Invocation.method( + #getUserAgent, + [], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnConsoleMessage( + void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage) => + (super.noSuchMethod( + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnScrollPositionChange( + void Function(_i2.ScrollPositionChange)? onScrollPositionChange) => + (super.noSuchMethod( + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptAlertDialog( + _i5.Future Function(_i2.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptConfirmDialog( + _i5.Future Function(_i2.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptTextInputDialog( + _i5.Future Function(_i2.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [PlatformNavigationDelegate]. @@ -373,6 +473,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformNavigationDelegateCreationParams); + @override _i5.Future setOnNavigationRequest( _i6.NavigationRequestCallback? onNavigationRequest) => @@ -384,6 +485,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnPageStarted(_i6.PageEventCallback? onPageStarted) => (super.noSuchMethod( @@ -394,6 +496,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnPageFinished(_i6.PageEventCallback? onPageFinished) => (super.noSuchMethod( @@ -404,6 +507,18 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setOnHttpError(_i6.HttpResponseErrorCallback? onHttpError) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpError, + [onHttpError], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future setOnProgress(_i6.ProgressCallback? onProgress) => (super.noSuchMethod( @@ -414,6 +529,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnWebResourceError( _i6.WebResourceErrorCallback? onWebResourceError) => @@ -425,6 +541,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnUrlChange(_i6.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( @@ -435,4 +552,16 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setOnHttpAuthRequest( + _i6.HttpAuthRequestCallback? onHttpAuthRequest) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } diff --git a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart index 1d7de302fe626a8c1365ff52d1cad84594f54092..20bf87f4dca1594f0bbcfd2a3b3ff19299c7e31f 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter/test/webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -50,6 +52,7 @@ class MockPlatformWebViewCookieManager extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformWebViewCookieManagerCreationParams); + @override _i4.Future clearCookies() => (super.noSuchMethod( Invocation.method( @@ -58,6 +61,7 @@ class MockPlatformWebViewCookieManager extends _i1.Mock ), returnValue: _i4.Future.value(false), ) as _i4.Future); + @override _i4.Future setCookie(_i2.WebViewCookie? cookie) => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart b/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..cf3dd5c89d3a031c1e7bcd5e28118eb113bd3987 --- /dev/null +++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart @@ -0,0 +1,41 @@ +// Copyright 2013 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. + +// ignore_for_file: unnecessary_statements + +import 'package:flutter_test/flutter_test.dart'; +import 'package:webview_flutter/webview_flutter.dart' as main_file; + +void main() { + group('webview_flutter', () { + test( + 'ensure webview_flutter.dart exports classes from platform interface', + () { + main_file.HttpAuthRequest; + main_file.JavaScriptConsoleMessage; + main_file.JavaScriptLogLevel; + main_file.JavaScriptMessage; + main_file.JavaScriptMode; + main_file.LoadRequestMethod; + main_file.NavigationDecision; + main_file.NavigationRequest; + main_file.NavigationRequestCallback; + main_file.PageEventCallback; + main_file.PlatformNavigationDelegateCreationParams; + main_file.PlatformWebViewControllerCreationParams; + main_file.PlatformWebViewCookieManagerCreationParams; + main_file.PlatformWebViewPermissionRequest; + main_file.PlatformWebViewWidgetCreationParams; + main_file.ProgressCallback; + main_file.WebViewPermissionResourceType; + main_file.WebResourceError; + main_file.WebResourceErrorCallback; + main_file.WebViewCookie; + main_file.WebViewCredential; + main_file.WebResourceErrorType; + main_file.UrlChange; + }, + ); + }); +} diff --git a/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart index 9d3a790668652df6aad0f2e0cf1f73cde09196b3..ec6bd85e0951b639d490bff929a2a0e92ff88a88 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter/test/webview_widget_test.dart. // Do not manually edit this file. @@ -21,6 +21,8 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -101,6 +103,7 @@ class MockPlatformWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformWebViewControllerCreationParams); + @override _i7.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -110,6 +113,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -119,6 +123,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future loadHtmlString( String? html, { @@ -133,6 +138,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future loadRequest(_i2.LoadRequestParams? params) => (super.noSuchMethod( @@ -143,6 +149,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -151,6 +158,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -159,6 +167,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i7.Future.value(false), ) as _i7.Future); + @override _i7.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -167,6 +176,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i7.Future.value(false), ) as _i7.Future); + @override _i7.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -176,6 +186,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -185,6 +196,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future reload() => (super.noSuchMethod( Invocation.method( @@ -194,6 +206,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -203,6 +216,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -212,6 +226,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future setPlatformNavigationDelegate( _i8.PlatformNavigationDelegate? handler) => @@ -223,6 +238,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -232,6 +248,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -247,6 +264,7 @@ class MockPlatformWebViewController extends _i1.Mock ), )), ) as _i7.Future); + @override _i7.Future addJavaScriptChannel( _i6.JavaScriptChannelParams? javaScriptChannelParams) => @@ -258,6 +276,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -268,6 +287,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -276,6 +296,7 @@ class MockPlatformWebViewController extends _i1.Mock ), returnValue: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future scrollTo( int? x, @@ -292,6 +313,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future scrollBy( int? x, @@ -308,6 +330,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -322,6 +345,7 @@ class MockPlatformWebViewController extends _i1.Mock ), )), ) as _i7.Future<_i3.Offset>); + @override _i7.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -331,6 +355,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( Invocation.method( @@ -340,6 +365,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -350,6 +376,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -359,6 +386,7 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + @override _i7.Future setOnPlatformPermissionRequest( void Function(_i2.PlatformWebViewPermissionRequest)? @@ -371,6 +399,78 @@ class MockPlatformWebViewController extends _i1.Mock returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); + + @override + _i7.Future getUserAgent() => (super.noSuchMethod( + Invocation.method( + #getUserAgent, + [], + ), + returnValue: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOnConsoleMessage( + void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage) => + (super.noSuchMethod( + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOnScrollPositionChange( + void Function(_i2.ScrollPositionChange)? onScrollPositionChange) => + (super.noSuchMethod( + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOnJavaScriptAlertDialog( + _i7.Future Function(_i2.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOnJavaScriptConfirmDialog( + _i7.Future Function(_i2.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOnJavaScriptTextInputDialog( + _i7.Future Function(_i2.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); } /// A class which mocks [PlatformWebViewWidget]. @@ -390,6 +490,7 @@ class MockPlatformWebViewWidget extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformWebViewWidgetCreationParams); + @override _i4.Widget build(_i4.BuildContext? context) => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 86685a2666bcd40a37062cfded2c7b2affc14ad1..62fa134613e1675976541d812d3d37e4183710ea 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,44 @@ +## 3.15.0 + +* Adds support for `setOnScrollPositionChange` method to the `AndroidWebViewController`. + +## 3.14.0 + +* Adds support to show JavaScript dialog. See `AndroidWebViewController.setOnJavaScriptAlertDialog`, `AndroidWebViewController.setOnJavaScriptConfirmDialog` and `AndroidWebViewController.setOnJavaScriptTextInputDialog`. + +## 3.13.2 + +* Fixes new lint warnings. + +## 3.13.1 + +* Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1. + +## 3.13.0 + +* Adds support for `PlatformNavigationDelegate.setOnHttpAuthRequest`. + +## 3.12.1 + +* Fixes `use_build_context_synchronously` lint violations in the example app. + +## 3.12.0 + +* Adds support for `PlatformWebViewController.getUserAgent`. + +## 3.11.0 + +* Adds support to register a callback to receive JavaScript console messages. See `AndroidWebViewController.onConsoleMessage`. + +## 3.10.1 + +* Bumps androidx.annotation:annotation from 1.5.0 to 1.7.0. + +## 3.10.0 + +* Adds support for playing video in fullscreen. See + `AndroidWebViewController.setCustomWidgetCallbacks`. + ## 3.9.5 * Updates pigeon to 11 and removes unneeded enum wrappers. @@ -14,7 +55,7 @@ ## 3.9.2 * Fixes bug where `PlatformWebViewWidget` doesn't rebuild when the controller or PlatformView - implementation flag changes. + implementation flag changes. ## 3.9.1 diff --git a/packages/webview_flutter/webview_flutter_android/README.md b/packages/webview_flutter/webview_flutter_android/README.md index 06ec1a7bad490d3417fd23e2b8ec4de07326cba2..1db03b3afddaa30eb88b3ff1cd11b1653cffa3a0 100644 --- a/packages/webview_flutter/webview_flutter_android/README.md +++ b/packages/webview_flutter/webview_flutter_android/README.md @@ -36,7 +36,7 @@ This can be configured for versions >=23 with `AndroidWebViewWidgetCreationParams.displayWithHybridComposition`. See https://pub.dev/packages/webview_flutter#platform-specific-features for more details on setting platform-specific features in the main plugin. -### External Native API +## External Native API The plugin also provides a native API accessible by the native code of Android applications or packages. This API follows the convention of breaking changes of the Dart API, which means that any @@ -52,6 +52,27 @@ Java: import io.flutter.plugins.webviewflutter.WebViewFlutterAndroidExternalApi; ``` +## Fullscreen Video + +To display a video as fullscreen, an app must manually handle the notification that the current page +has entered fullscreen mode. This can be done by calling +`AndroidWebViewController.setCustomWidgetCallbacks`. Below is an example implementation. + + +```dart +androidController.setCustomWidgetCallbacks( + onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, +); +``` + ## Contributing This package uses [pigeon][3] to generate the communication layer between Flutter and the host diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ffe70f694164dcebf502fe308cc1b57aa86a3c55 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java @@ -0,0 +1,62 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.CustomViewCallback; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; + +/** + * Flutter API implementation for `CustomViewCallback`. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +public class CustomViewCallbackFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private CustomViewCallbackFlutterApi api; + + /** + * Constructs a {@link CustomViewCallbackFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public CustomViewCallbackFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new CustomViewCallbackFlutterApi(binaryMessenger); + } + + /** + * Stores the `CustomViewCallback` instance and notifies Dart to create and store a new + * `CustomViewCallback` instance that is attached to this one. If `instance` has already been + * added, this method does nothing. + */ + public void create( + @NonNull CustomViewCallback instance, + @NonNull CustomViewCallbackFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create(instanceManager.addHostCreatedInstance(instance), callback); + } + } + + /** + * Sets the Flutter API used to send messages to Dart. + * + *

This is only visible for testing. + */ + @VisibleForTesting + void setApi(@NonNull CustomViewCallbackFlutterApi api) { + this.api = api; + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..44b8c454cc652dfb7e15c35b789b13a8b1fa8080 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java @@ -0,0 +1,46 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.CustomViewCallback; +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; +import java.util.Objects; + +/** + * Host API implementation for `CustomViewCallback`. + * + *

This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or handle method calls on the associated native class or an instance of the class. + */ +public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + /** + * Constructs a {@link CustomViewCallbackHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public CustomViewCallbackHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + } + + @Override + public void onCustomViewHidden(@NonNull Long identifier) { + getCustomViewCallbackInstance(identifier).onCustomViewHidden(); + } + + private CustomViewCallback getCustomViewCallbackInstance(@NonNull Long identifier) { + return Objects.requireNonNull(instanceManager.getInstance(identifier)); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 71c01f17172590367063c2c48faf7896cbc9268f..0d0d37e5d3da291e8314b7510201b5d4f6bd2b31 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -94,6 +94,62 @@ public class GeneratedAndroidWebView { } } + /** + * Indicates the type of message logged to the console. + * + *

See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel. + */ + public enum ConsoleMessageLevel { + /** + * Indicates a message is logged for debugging. + * + *

See + * https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. + */ + DEBUG(0), + /** + * Indicates a message is provided as an error. + * + *

See + * https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. + */ + ERROR(1), + /** + * Indicates a message is provided as a basic log message. + * + *

See + * https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. + */ + LOG(2), + /** + * Indicates a message is provided as a tip. + * + *

See + * https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. + */ + TIP(3), + /** + * Indicates a message is provided as a warning. + * + *

See + * https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. + */ + WARNING(4), + /** + * Indicates a message with an unknown level. + * + *

This does not represent an actual value provided by the platform and only indicates a + * value was provided that isn't currently supported. + */ + UNKNOWN(5); + + final int index; + + private ConsoleMessageLevel(final int index) { + this.index = index; + } + } + /** Generated class from Pigeon that represents data sent in messages. */ public static final class WebResourceRequestData { private @NonNull String url; @@ -409,6 +465,136 @@ public class GeneratedAndroidWebView { } } + /** + * Represents a JavaScript console message from WebCore. + * + *

See https://developer.android.com/reference/android/webkit/ConsoleMessage + * + *

Generated class from Pigeon that represents data sent in messages. + */ + public static final class ConsoleMessage { + private @NonNull Long lineNumber; + + public @NonNull Long getLineNumber() { + return lineNumber; + } + + public void setLineNumber(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"lineNumber\" is null."); + } + this.lineNumber = setterArg; + } + + private @NonNull String message; + + public @NonNull String getMessage() { + return message; + } + + public void setMessage(@NonNull String setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"message\" is null."); + } + this.message = setterArg; + } + + private @NonNull ConsoleMessageLevel level; + + public @NonNull ConsoleMessageLevel getLevel() { + return level; + } + + public void setLevel(@NonNull ConsoleMessageLevel setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"level\" is null."); + } + this.level = setterArg; + } + + private @NonNull String sourceId; + + public @NonNull String getSourceId() { + return sourceId; + } + + public void setSourceId(@NonNull String setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"sourceId\" is null."); + } + this.sourceId = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + ConsoleMessage() {} + + public static final class Builder { + + private @Nullable Long lineNumber; + + public @NonNull Builder setLineNumber(@NonNull Long setterArg) { + this.lineNumber = setterArg; + return this; + } + + private @Nullable String message; + + public @NonNull Builder setMessage(@NonNull String setterArg) { + this.message = setterArg; + return this; + } + + private @Nullable ConsoleMessageLevel level; + + public @NonNull Builder setLevel(@NonNull ConsoleMessageLevel setterArg) { + this.level = setterArg; + return this; + } + + private @Nullable String sourceId; + + public @NonNull Builder setSourceId(@NonNull String setterArg) { + this.sourceId = setterArg; + return this; + } + + public @NonNull ConsoleMessage build() { + ConsoleMessage pigeonReturn = new ConsoleMessage(); + pigeonReturn.setLineNumber(lineNumber); + pigeonReturn.setMessage(message); + pigeonReturn.setLevel(level); + pigeonReturn.setSourceId(sourceId); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(4); + toListResult.add(lineNumber); + toListResult.add(message); + toListResult.add(level == null ? null : level.index); + toListResult.add(sourceId); + return toListResult; + } + + static @NonNull ConsoleMessage fromList(@NonNull ArrayList list) { + ConsoleMessage pigeonResult = new ConsoleMessage(); + Object lineNumber = list.get(0); + pigeonResult.setLineNumber( + (lineNumber == null) + ? null + : ((lineNumber instanceof Integer) ? (Integer) lineNumber : (Long) lineNumber)); + Object message = list.get(1); + pigeonResult.setMessage((String) message); + Object level = list.get(2); + pigeonResult.setLevel(ConsoleMessageLevel.values()[(int) level]); + Object sourceId = list.get(3); + pigeonResult.setSourceId((String) sourceId); + return pigeonResult; + } + } + public interface Result { @SuppressWarnings("UnknownNullness") void success(T result); @@ -1572,6 +1758,24 @@ public class GeneratedAndroidWebView { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } + + public void onScrollChanged( + @NonNull Long webViewInstanceIdArg, + @NonNull Long leftArg, + @NonNull Long topArg, + @NonNull Long oldLeftArg, + @NonNull Long oldTopArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(webViewInstanceIdArg, leftArg, topArg, oldLeftArg, oldTopArg)), + channelReply -> callback.reply(null)); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebSettingsHostApi { @@ -1604,6 +1808,9 @@ public class GeneratedAndroidWebView { void setTextZoom(@NonNull Long instanceId, @NonNull Long textZoom); + @NonNull + String getUserAgentString(@NonNull Long instanceId); + /** The codec used by WebSettingsHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1993,6 +2200,33 @@ public class GeneratedAndroidWebView { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + try { + String output = + api.getUserAgentString( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ @@ -2307,6 +2541,29 @@ public class GeneratedAndroidWebView { Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } + + public void onReceivedHttpAuthRequest( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long httpAuthHandlerInstanceIdArg, + @NonNull String hostArg, + @NonNull String realmArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + httpAuthHandlerInstanceIdArg, + hostArg, + realmArg)), + channelReply -> callback.reply(null)); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface DownloadListenerHostApi { @@ -2401,6 +2658,15 @@ public class GeneratedAndroidWebView { void setSynchronousReturnValueForOnShowFileChooser( @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnConsoleMessage( + @NonNull Long instanceId, @NonNull Boolean value); + + void setSynchronousReturnValueForOnJsAlert(@NonNull Long instanceId, @NonNull Boolean value); + + void setSynchronousReturnValueForOnJsConfirm(@NonNull Long instanceId, @NonNull Boolean value); + + void setSynchronousReturnValueForOnJsPrompt(@NonNull Long instanceId, @NonNull Boolean value); + /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2463,42 +2729,23 @@ public class GeneratedAndroidWebView { channel.setMessageHandler(null); } } - } - } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface FlutterAssetManagerHostApi { - - @NonNull - List list(@NonNull String path); - - @NonNull - String getAssetFilePathByName(@NonNull String name); - - /** The codec used by FlutterAssetManagerHostApi. */ - static @NonNull MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManagerHostApi.list", + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; - String pathArg = (String) args.get(0); + Number instanceIdArg = (Number) args.get(0); + Boolean valueArg = (Boolean) args.get(1); try { - List output = api.list(pathArg); - wrapped.add(0, output); + api.setSynchronousReturnValueForOnConsoleMessage( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; @@ -2513,17 +2760,73 @@ public class GeneratedAndroidWebView { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManagerHostApi.getAssetFilePathByName", + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; - String nameArg = (String) args.get(0); + Number instanceIdArg = (Number) args.get(0); + Boolean valueArg = (Boolean) args.get(1); try { - String output = api.getAssetFilePathByName(nameArg); - wrapped.add(0, output); + api.setSynchronousReturnValueForOnJsAlert( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + Boolean valueArg = (Boolean) args.get(1); + try { + api.setSynchronousReturnValueForOnJsConfirm( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + Boolean valueArg = (Boolean) args.get(1); + try { + api.setSynchronousReturnValueForOnJsPrompt( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; @@ -2536,22 +2839,121 @@ public class GeneratedAndroidWebView { } } } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class WebChromeClientFlutterApi { - private final @NonNull BinaryMessenger binaryMessenger; + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + public interface FlutterAssetManagerHostApi { - public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { - this.binaryMessenger = argBinaryMessenger; - } + @NonNull + List list(@NonNull String path); - /** Public interface for sending reply. */ - @SuppressWarnings("UnknownNullness") + @NonNull + String getAssetFilePathByName(@NonNull String name); + + /** The codec used by FlutterAssetManagerHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManagerHostApi.list", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + String pathArg = (String) args.get(0); + try { + List output = api.list(pathArg); + wrapped.add(0, output); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManagerHostApi.getAssetFilePathByName", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + String nameArg = (String) args.get(0); + try { + String output = api.getAssetFilePathByName(nameArg); + wrapped.add(0, output); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + + private static class WebChromeClientFlutterApiCodec extends StandardMessageCodec { + public static final WebChromeClientFlutterApiCodec INSTANCE = + new WebChromeClientFlutterApiCodec(); + + private WebChromeClientFlutterApiCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + case (byte) 128: + return ConsoleMessage.fromList((ArrayList) readValue(buffer)); + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + if (value instanceof ConsoleMessage) { + stream.write(128); + writeValue(stream, ((ConsoleMessage) value).toList()); + } else { + super.writeValue(stream, value); + } + } + } + + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static class WebChromeClientFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by WebChromeClientFlutterApi. */ static @NonNull MessageCodec getCodec() { - return new StandardMessageCodec(); + return WebChromeClientFlutterApiCodec.INSTANCE; } public void onProgressChanged( @@ -2602,6 +3004,33 @@ public class GeneratedAndroidWebView { new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); } + /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ + public void onShowCustomView( + @NonNull Long instanceIdArg, + @NonNull Long viewIdentifierArg, + @NonNull Long callbackIdentifierArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), + channelReply -> callback.reply(null)); + } + /** Callback to Dart function `WebChromeClient.onHideCustomView`. */ + public void onHideCustomView(@NonNull Long instanceIdArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onHideCustomView", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(instanceIdArg)), + channelReply -> callback.reply(null)); + } /** Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. */ public void onGeolocationPermissionsShowPrompt( @NonNull Long instanceIdArg, @@ -2629,6 +3058,74 @@ public class GeneratedAndroidWebView { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } + /** Callback to Dart function `WebChromeClient.onConsoleMessage`. */ + public void onConsoleMessage( + @NonNull Long instanceIdArg, + @NonNull ConsoleMessage messageArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, messageArg)), + channelReply -> callback.reply(null)); + } + + public void onJsAlert( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String messageArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, urlArg, messageArg)), + channelReply -> callback.reply(null)); + } + + public void onJsConfirm( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String messageArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, urlArg, messageArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Boolean output = (Boolean) channelReply; + callback.reply(output); + }); + } + + public void onJsPrompt( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String messageArg, + @NonNull String defaultValueArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, urlArg, messageArg, defaultValueArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + String output = (String) channelReply; + callback.reply(output); + }); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebStorageHostApi { @@ -2867,6 +3364,137 @@ public class GeneratedAndroidWebView { channelReply -> callback.reply(null)); } } + /** + * Host API for `CustomViewCallback`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface CustomViewCallbackHostApi { + /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ + void onCustomViewHidden(@NonNull Long identifier); + + /** The codec used by CustomViewCallbackHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackHostApi.onCustomViewHidden", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + try { + api.onCustomViewHidden( + (identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Flutter API for `CustomViewCallback`. + * + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. + * + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class CustomViewCallbackFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by CustomViewCallbackFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackFlutterApi.create", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } + /** + * Flutter API for `View`. + * + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. + * + *

See https://developer.android.com/reference/android/view/View. + * + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class ViewFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by ViewFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.ViewFlutterApi.create", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } /** * Host API for `GeolocationPermissionsCallback`. * @@ -2969,4 +3597,156 @@ public class GeneratedAndroidWebView { channelReply -> callback.reply(null)); } } + /** + * Host API for `HttpAuthHandler`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

See https://developer.android.com/reference/android/webkit/HttpAuthHandler. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface HttpAuthHandlerHostApi { + /** Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. */ + @NonNull + Boolean useHttpAuthUsernamePassword(@NonNull Long instanceId); + /** Handles Dart method `HttpAuthHandler.cancel`. */ + void cancel(@NonNull Long instanceId); + /** Handles Dart method `HttpAuthHandler.proceed`. */ + void proceed(@NonNull Long instanceId, @NonNull String username, @NonNull String password); + + /** The codec used by HttpAuthHandlerHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `HttpAuthHandlerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable HttpAuthHandlerHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + try { + Boolean output = + api.useHttpAuthUsernamePassword( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + try { + api.cancel((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + String usernameArg = (String) args.get(1); + String passwordArg = (String) args.get(2); + try { + api.proceed( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + usernameArg, + passwordArg); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Flutter API for `HttpAuthHandler`. + * + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. + * + *

See https://developer.android.com/reference/android/webkit/HttpAuthHandler. + * + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class HttpAuthHandlerFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public HttpAuthHandlerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by HttpAuthHandlerFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long instanceIdArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(instanceIdArg)), + channelReply -> callback.reply(null)); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1d5a170ff3b2583e2b8d8e40ed9b0bf17841628d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java @@ -0,0 +1,51 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerFlutterApi; + +/** + * Flutter API implementation for {@link HttpAuthHandler}. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +public class HttpAuthHandlerFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + private final HttpAuthHandlerFlutterApi api; + + /** + * Constructs a {@link HttpAuthHandlerFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public HttpAuthHandlerFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new HttpAuthHandlerFlutterApi(binaryMessenger); + } + + /** + * Stores the `HttpAuthHandler` instance and notifies Dart to create and store a new + * `HttpAuthHandler` instance that is attached to this one. If `instance` has already been added, + * this method does nothing. + */ + public void create( + @NonNull HttpAuthHandler instance, @NonNull HttpAuthHandlerFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create(instanceManager.addHostCreatedInstance(instance), callback); + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..591571d2a6cc286bce1922b3dc136f9ab5df07dd --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java @@ -0,0 +1,57 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerHostApi; +import java.util.Objects; + +/** + * Host api implementation for {@link HttpAuthHandler}. + * + *

Handles creating {@link HttpAuthHandler}s that intercommunicate with a paired Dart object. + */ +public class HttpAuthHandlerHostApiImpl implements HttpAuthHandlerHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + /** + * Constructs a {@link HttpAuthHandlerHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public HttpAuthHandlerHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + } + + @NonNull + @Override + public Boolean useHttpAuthUsernamePassword(@NonNull Long instanceId) { + return getHttpAuthHandlerInstance(instanceId).useHttpAuthUsernamePassword(); + } + + @Override + public void cancel(@NonNull Long instanceId) { + getHttpAuthHandlerInstance(instanceId).cancel(); + } + + @Override + public void proceed( + @NonNull Long instanceId, @NonNull String username, @NonNull String password) { + getHttpAuthHandlerInstance(instanceId).proceed(username, password); + } + + private HttpAuthHandler getHttpAuthHandlerInstance(@NonNull Long instanceId) { + return Objects.requireNonNull(instanceManager.getInstance(instanceId)); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..653bfa9faf3d6c10ff34493a4e8061f7eb226685 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java @@ -0,0 +1,59 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import android.view.View; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; + +/** + * Flutter API implementation for `View`. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +public class ViewFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private ViewFlutterApi api; + + /** + * Constructs a {@link ViewFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public ViewFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new ViewFlutterApi(binaryMessenger); + } + + /** + * Stores the `View` instance and notifies Dart to create and store a new `View` instance that is + * attached to this one. If `instance` has already been added, this method does nothing. + */ + public void create(@NonNull View instance, @NonNull ViewFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create(instanceManager.addHostCreatedInstance(instance), callback); + } + } + + /** + * Sets the Flutter API used to send messages to Dart. + * + *

This is only visible for testing. + */ + @VisibleForTesting + void setApi(@NonNull ViewFlutterApi api) { + this.api = api; + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java index ad5168fa110ae77f75077f99f440efd4e67cd439..d5601670630c048053695d52fb00b5598c73e2e0 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java @@ -5,6 +5,8 @@ package io.flutter.plugins.webviewflutter; import android.os.Build; +import android.view.View; +import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.PermissionRequest; import android.webkit.WebChromeClient; @@ -26,6 +28,24 @@ public class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { private final InstanceManager instanceManager; private final WebViewFlutterApiImpl webViewFlutterApi; + private static GeneratedAndroidWebView.ConsoleMessageLevel toConsoleMessageLevel( + ConsoleMessage.MessageLevel level) { + switch (level) { + case TIP: + return GeneratedAndroidWebView.ConsoleMessageLevel.TIP; + case LOG: + return GeneratedAndroidWebView.ConsoleMessageLevel.LOG; + case WARNING: + return GeneratedAndroidWebView.ConsoleMessageLevel.WARNING; + case ERROR: + return GeneratedAndroidWebView.ConsoleMessageLevel.ERROR; + case DEBUG: + return GeneratedAndroidWebView.ConsoleMessageLevel.DEBUG; + } + + return GeneratedAndroidWebView.ConsoleMessageLevel.UNKNOWN; + } + /** * Creates a Flutter api that sends messages to Dart. * @@ -117,6 +137,106 @@ public class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { callback); } + /** + * Sends a message to Dart to call `WebChromeClient.onShowCustomView` on the Dart object + * representing `instance`. + */ + public void onShowCustomView( + @NonNull WebChromeClient instance, + @NonNull View view, + @NonNull WebChromeClient.CustomViewCallback customViewCallback, + @NonNull WebChromeClientFlutterApi.Reply callback) { + new ViewFlutterApiImpl(binaryMessenger, instanceManager).create(view, reply -> {}); + new CustomViewCallbackFlutterApiImpl(binaryMessenger, instanceManager) + .create(customViewCallback, reply -> {}); + + onShowCustomView( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(view)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(customViewCallback)), + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onHideCustomView` on the Dart object + * representing `instance`. + */ + public void onHideCustomView( + @NonNull WebChromeClient instance, @NonNull WebChromeClientFlutterApi.Reply callback) { + super.onHideCustomView( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onConsoleMessage` on the Dart object + * representing `instance`. + */ + public void onConsoleMessage( + @NonNull WebChromeClient instance, + @NonNull ConsoleMessage message, + @NonNull Reply callback) { + super.onConsoleMessage( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + new GeneratedAndroidWebView.ConsoleMessage.Builder() + .setLineNumber((long) message.lineNumber()) + .setMessage(message.message()) + .setLevel(toConsoleMessageLevel(message.messageLevel())) + .setSourceId(message.sourceId()) + .build(), + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onJsAlert` on the Dart object representing + * `instance`. + */ + public void onJsAlert( + @NonNull WebChromeClient instance, + @NonNull String url, + @NonNull String message, + @NonNull WebChromeClientFlutterApi.Reply callback) { + super.onJsAlert( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + url, + message, + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onJsConfirm` on the Dart object representing + * `instance`. + */ + public void onJsConfirm( + @NonNull WebChromeClient instance, + @NonNull String url, + @NonNull String message, + @NonNull WebChromeClientFlutterApi.Reply callback) { + super.onJsConfirm( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + url, + message, + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onJsPrompt` on the Dart object representing + * `instance`. + */ + public void onJsPrompt( + @NonNull WebChromeClient instance, + @NonNull String url, + @NonNull String message, + @NonNull String defaultValue, + @NonNull WebChromeClientFlutterApi.Reply callback) { + super.onJsPrompt( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + url, + message, + defaultValue, + callback); + } + private long getIdentifierForClient(WebChromeClient webChromeClient) { final Long identifier = instanceManager.getIdentifierForStrongReference(webChromeClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 74ea45e5359ab8c87e9dbc1ac0b04e2a11ac3884..3f230b7b794f606ad07d5414210d99a137044bee 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -4,10 +4,15 @@ package io.flutter.plugins.webviewflutter; +import android.content.Context; import android.net.Uri; import android.os.Build; import android.os.Message; +import android.view.View; +import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; +import android.webkit.JsPromptResult; +import android.webkit.JsResult; import android.webkit.PermissionRequest; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; @@ -30,6 +35,7 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { private final InstanceManager instanceManager; private final WebChromeClientCreator webChromeClientCreator; private final WebChromeClientFlutterApiImpl flutterApi; + private Context context; /** * Implementation of {@link WebChromeClient} that passes arguments of callback methods to Dart. @@ -37,6 +43,11 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { public static class WebChromeClientImpl extends SecureWebChromeClient { private final WebChromeClientFlutterApiImpl flutterApi; private boolean returnValueForOnShowFileChooser = false; + private boolean returnValueForOnConsoleMessage = false; + + private boolean returnValueForOnJsAlert = false; + private boolean returnValueForOnJsConfirm = false; + private boolean returnValueForOnJsPrompt = false; /** * Creates a {@link WebChromeClient} that passes arguments of callbacks methods to Dart. @@ -53,6 +64,15 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { } @Override + public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { + flutterApi.onShowCustomView(this, view, callback, reply -> {}); + } + + @Override + public void onHideCustomView() { + flutterApi.onHideCustomView(this, reply -> {}); + } + public void onGeolocationPermissionsShowPrompt( @NonNull String origin, @NonNull GeolocationPermissions.Callback callback) { flutterApi.onGeolocationPermissionsShowPrompt(this, origin, callback, reply -> {}); @@ -95,10 +115,92 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { flutterApi.onPermissionRequest(this, request, reply -> {}); } + @Override + public boolean onConsoleMessage(ConsoleMessage consoleMessage) { + flutterApi.onConsoleMessage(this, consoleMessage, reply -> {}); + return returnValueForOnConsoleMessage; + } + /** Sets return value for {@link #onShowFileChooser}. */ public void setReturnValueForOnShowFileChooser(boolean value) { returnValueForOnShowFileChooser = value; } + + /** Sets return value for {@link #onConsoleMessage}. */ + public void setReturnValueForOnConsoleMessage(boolean value) { + returnValueForOnConsoleMessage = value; + } + + public void setReturnValueForOnJsAlert(boolean value) { + returnValueForOnJsAlert = value; + } + + public void setReturnValueForOnJsConfirm(boolean value) { + returnValueForOnJsConfirm = value; + } + + public void setReturnValueForOnJsPrompt(boolean value) { + returnValueForOnJsPrompt = value; + } + + @Override + public boolean onJsAlert(WebView view, String url, String message, JsResult result) { + if (returnValueForOnJsAlert) { + flutterApi.onJsAlert( + this, + url, + message, + reply -> { + result.confirm(); + }); + return true; + } else { + return false; + } + } + + @Override + public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { + if (returnValueForOnJsConfirm) { + flutterApi.onJsConfirm( + this, + url, + message, + reply -> { + if (reply) { + result.confirm(); + } else { + result.cancel(); + } + }); + return true; + } else { + return false; + } + } + + @Override + public boolean onJsPrompt( + WebView view, String url, String message, String defaultValue, JsPromptResult result) { + if (returnValueForOnJsPrompt) { + flutterApi.onJsPrompt( + this, + url, + message, + defaultValue, + reply -> { + @Nullable String inputMessage = reply; + if (inputMessage != null) { + result.confirm(inputMessage); + } else { + result.cancel(); + } + }); + return true; + } else { + return false; + } + } } /** @@ -234,4 +336,36 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { Objects.requireNonNull(instanceManager.getInstance(instanceId)); webChromeClient.setReturnValueForOnShowFileChooser(value); } + + @Override + public void setSynchronousReturnValueForOnConsoleMessage( + @NonNull Long instanceId, @NonNull Boolean value) { + final WebChromeClientImpl webChromeClient = + Objects.requireNonNull(instanceManager.getInstance(instanceId)); + webChromeClient.setReturnValueForOnConsoleMessage(value); + } + + @Override + public void setSynchronousReturnValueForOnJsAlert( + @NonNull Long instanceId, @NonNull Boolean value) { + final WebChromeClientImpl webChromeClient = + Objects.requireNonNull(instanceManager.getInstance(instanceId)); + webChromeClient.setReturnValueForOnJsAlert(value); + } + + @Override + public void setSynchronousReturnValueForOnJsConfirm( + @NonNull Long instanceId, @NonNull Boolean value) { + final WebChromeClientImpl webChromeClient = + Objects.requireNonNull(instanceManager.getInstance(instanceId)); + webChromeClient.setReturnValueForOnJsConfirm(value); + } + + @Override + public void setSynchronousReturnValueForOnJsPrompt( + @NonNull Long instanceId, @NonNull Boolean value) { + final WebChromeClientImpl webChromeClient = + Objects.requireNonNull(instanceManager.getInstance(instanceId)); + webChromeClient.setReturnValueForOnJsPrompt(value); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebSettingsHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebSettingsHostApiImpl.java index 3a6b151fa7119ba0d2ae1e5014b5c41013847a88..8eac2ed6a0c52ad866a3aeaaa6f57a97900e5303 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebSettingsHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebSettingsHostApiImpl.java @@ -132,4 +132,11 @@ public class WebSettingsHostApiImpl implements WebSettingsHostApi { final WebSettings webSettings = Objects.requireNonNull(instanceManager.getInstance(instanceId)); webSettings.setTextZoom(textZoom.intValue()); } + + @NonNull + @Override + public String getUserAgentString(@NonNull Long instanceId) { + final WebSettings webSettings = Objects.requireNonNull(instanceManager.getInstance(instanceId)); + return webSettings.getUserAgentString(); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java index 4dee9c0ad3fe29f5f711eb042c8d09479afee5e2..7a5a057cf115b9f1748ed21ea13ea7377f99a225 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java @@ -6,6 +6,7 @@ package io.flutter.plugins.webviewflutter; import android.annotation.SuppressLint; import android.os.Build; +import android.webkit.HttpAuthHandler; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -230,6 +231,26 @@ public class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { getIdentifierForClient(webViewClient), webViewIdentifier, url, isReload, callback); } + /** Passes arguments from {@link WebViewClient#onReceivedHttpAuthRequest} to Dart. */ + public void onReceivedHttpAuthRequest( + @NonNull WebViewClient webViewClient, + @NonNull WebView webview, + @NonNull HttpAuthHandler httpAuthHandler, + @NonNull String host, + @NonNull String realm, + @NonNull Reply callback) { + new HttpAuthHandlerFlutterApiImpl(binaryMessenger, instanceManager) + .create(httpAuthHandler, reply -> {}); + + onReceivedHttpAuthRequest( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webViewClient)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webview)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(httpAuthHandler)), + host, + realm, + callback); + } + private long getIdentifierForClient(WebViewClient webViewClient) { final Long identifier = instanceManager.getIdentifierForStrongReference(webViewClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java index 35ae02a7625f21835f6babb92cf4d9b89363e2c9..1ace7bfe0729dc32e76140337f002d3258894967 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java @@ -9,6 +9,7 @@ import android.annotation.TargetApi; import android.graphics.Bitmap; import android.os.Build; import android.view.KeyEvent; +import android.webkit.HttpAuthHandler; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -38,7 +39,7 @@ public class WebViewClientHostApiImpl implements GeneratedAndroidWebView.WebView /** * Creates a {@link WebViewClient} that passes arguments of callbacks methods to Dart. * - * @param flutterApi handles sending messages to Dart + * @param flutterApi handles sending messages to Dart. */ public WebViewClientImpl(@NonNull WebViewClientFlutterApiImpl flutterApi) { this.flutterApi = flutterApi; @@ -95,6 +96,15 @@ public class WebViewClientHostApiImpl implements GeneratedAndroidWebView.WebView flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); } + @Override + public void onReceivedHttpAuthRequest( + @NonNull WebView view, + @NonNull HttpAuthHandler handler, + @NonNull String host, + @NonNull String realm) { + flutterApi.onReceivedHttpAuthRequest(this, view, handler, host, realm, reply -> {}); + } + @Override public void onUnhandledKeyEvent(@NonNull WebView view, @NonNull KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be @@ -176,6 +186,16 @@ public class WebViewClientHostApiImpl implements GeneratedAndroidWebView.WebView flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); } + // Handles an HTTP authentication request. + // + // This callback is invoked when the WebView encounters a website requiring HTTP authentication. + // [host] and [realm] are provided for matching against stored credentials, if any. + @Override + public void onReceivedHttpAuthRequest( + @NonNull WebView view, HttpAuthHandler handler, String host, String realm) { + flutterApi.onReceivedHttpAuthRequest(this, view, handler, host, realm, reply -> {}); + } + @Override public void onUnhandledKeyEvent(@NonNull WebView view, @NonNull KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java index d468cf8f189d8568b1e391c1e92591515e91ee0d..c368cfbe50470991f4e7d3ad94c3ca5fe62e407d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.WebViewFlutterApi; +import java.util.Objects; /** * Flutter API implementation for `WebView`. @@ -56,4 +57,20 @@ public class WebViewFlutterApiImpl { void setApi(@NonNull WebViewFlutterApi api) { this.api = api; } + + public void onScrollChanged( + @NonNull WebView instance, + @NonNull Long left, + @NonNull Long top, + @NonNull Long oldLeft, + @NonNull Long oldTop, + @NonNull WebViewFlutterApi.Reply callback) { + api.onScrollChanged( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + left, + top, + oldLeft, + oldTop, + callback); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 305821943e3c91c9f2e311b64af5de54743a63d8..d8f319870c2be22682c147f8765983f3ef29f69d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -15,9 +15,11 @@ import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.platform.PlatformViewRegistry; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CookieManagerHostApi; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.FlutterAssetManagerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.GeolocationPermissionsCallbackHostApi; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.InstanceManagerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.JavaObjectHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.JavaScriptChannelHostApi; @@ -141,6 +143,10 @@ public class WebViewFlutterPlugin implements FlutterPlugin, ActivityAware { GeolocationPermissionsCallbackHostApi.setup( binaryMessenger, new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, instanceManager)); + CustomViewCallbackHostApi.setup( + binaryMessenger, new CustomViewCallbackHostApiImpl(binaryMessenger, instanceManager)); + HttpAuthHandlerHostApi.setup( + binaryMessenger, new HttpAuthHandlerHostApiImpl(binaryMessenger, instanceManager)); } @Override diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java index a0aa51d28caf550dfc9b8b826ad7e3d83ad6b9bc..3e22234ff716f9b0e35b0c40dbca8773e7302a19 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java @@ -180,6 +180,13 @@ public class WebViewHostApiImpl implements WebViewHostApi { return currentWebChromeClient; } + @Override + protected void onScrollChanged(int left, int top, int oldLeft, int oldTop) { + super.onScrollChanged(left, top, oldLeft, oldTop); + api.onScrollChanged( + this, (long) left, (long) top, (long) oldLeft, (long) oldTop, reply -> {}); + } + /** * Flutter API used to send messages back to Dart. * diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3a633999532dd4032225c7be49cad3d8f6368584 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java @@ -0,0 +1,71 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; + +import android.webkit.WebChromeClient.CustomViewCallback; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; +import java.util.Objects; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class CustomViewCallbackTest { + + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Mock public CustomViewCallback mockCustomViewCallback; + + @Mock public BinaryMessenger mockBinaryMessenger; + + @Mock public CustomViewCallbackFlutterApi mockFlutterApi; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void onCustomViewHidden() { + final long instanceIdentifier = 0; + instanceManager.addDartCreatedInstance(mockCustomViewCallback, instanceIdentifier); + + final CustomViewCallbackHostApiImpl hostApi = + new CustomViewCallbackHostApiImpl(mockBinaryMessenger, instanceManager); + + hostApi.onCustomViewHidden(instanceIdentifier); + + verify(mockCustomViewCallback).onCustomViewHidden(); + } + + @Test + public void flutterApiCreate() { + final CustomViewCallbackFlutterApiImpl flutterApi = + new CustomViewCallbackFlutterApiImpl(mockBinaryMessenger, instanceManager); + flutterApi.setApi(mockFlutterApi); + + flutterApi.create(mockCustomViewCallback, reply -> {}); + + final long instanceIdentifier = + Objects.requireNonNull( + instanceManager.getIdentifierForStrongReference(mockCustomViewCallback)); + verify(mockFlutterApi).create(eq(instanceIdentifier), any()); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a66f41bd292a4240c44481e5de42606ee05701a9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java @@ -0,0 +1,76 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; + +import android.webkit.HttpAuthHandler; +import io.flutter.plugin.common.BinaryMessenger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class HttpAuthHandlerTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Mock HttpAuthHandler mockAuthHandler; + + @Mock BinaryMessenger mockBinaryMessenger; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void proceed() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + final String username = "username"; + final String password = "password"; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.proceed(instanceIdentifier, username, password); + + verify(mockAuthHandler).proceed(eq(username), eq(password)); + } + + @Test + public void cancel() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.cancel(instanceIdentifier); + + verify(mockAuthHandler).cancel(); + } + + @Test + public void useHttpAuthUsernamePassword() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.useHttpAuthUsernamePassword(instanceIdentifier); + + verify(mockAuthHandler).useHttpAuthUsernamePassword(); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3019900d66183e851ed916e89871df609096890e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -0,0 +1,57 @@ +// Copyright 2013 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. + +package io.flutter.plugins.webviewflutter; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; + +import android.view.View; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; +import java.util.Objects; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class ViewTest { + + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Mock public View mockView; + + @Mock public BinaryMessenger mockBinaryMessenger; + + @Mock public ViewFlutterApi mockFlutterApi; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void flutterApiCreate() { + final ViewFlutterApiImpl flutterApi = + new ViewFlutterApiImpl(mockBinaryMessenger, instanceManager); + flutterApi.setApi(mockFlutterApi); + + flutterApi.create(mockView, reply -> {}); + + final long instanceIdentifier = + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockView)); + verify(mockFlutterApi).create(eq(instanceIdentifier), any()); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index e2d5a444b7161b99ddd1861807cc08062b136f60..ef49dded9b56b68510bbb2513f5e1733ba87342d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -15,8 +15,11 @@ import static org.mockito.Mockito.when; import android.net.Uri; import android.os.Message; +import android.view.View; +import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.PermissionRequest; +import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebView.WebViewTransport; @@ -126,6 +129,25 @@ public class WebChromeClientTest { } @Test + public void onShowCustomView() { + final View mockView = mock(View.class); + instanceManager.addDartCreatedInstance(mockView, 10); + + final WebChromeClient.CustomViewCallback mockCustomViewCallback = + mock(WebChromeClient.CustomViewCallback.class); + instanceManager.addDartCreatedInstance(mockView, 12); + + webChromeClient.onShowCustomView(mockView, mockCustomViewCallback); + verify(mockFlutterApi) + .onShowCustomView(eq(webChromeClient), eq(mockView), eq(mockCustomViewCallback), any()); + } + + @Test + public void onHideCustomView() { + webChromeClient.onHideCustomView(); + verify(mockFlutterApi).onHideCustomView(eq(webChromeClient), any()); + } + public void onGeolocationPermissionsShowPrompt() { final GeolocationPermissions.Callback mockCallback = mock(GeolocationPermissions.Callback.class); @@ -141,4 +163,17 @@ public class WebChromeClientTest { webChromeClient.onGeolocationPermissionsHidePrompt(); verify(mockFlutterApi).onGeolocationPermissionsHidePrompt(eq(webChromeClient), any()); } + + @Test + public void onConsoleMessage() { + webChromeClient.onConsoleMessage( + new ConsoleMessage("message", "sourceId", 23, ConsoleMessage.MessageLevel.ERROR)); + verify(mockFlutterApi).onConsoleMessage(eq(webChromeClient), any(), any()); + } + + @Test + public void setReturnValueForOnConsoleMessage() { + webChromeClient.setReturnValueForOnConsoleMessage(true); + assertTrue(webChromeClient.onConsoleMessage(null)); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebSettingsTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebSettingsTest.java index 4a2997669885b15f70ac6c41aa5f66dac8d83d85..47d98ecce4f0680318a1a29d408f0c9dbcc6a823 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebSettingsTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebSettingsTest.java @@ -4,6 +4,7 @@ package io.flutter.plugins.webviewflutter; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -117,4 +118,11 @@ public class WebSettingsTest { testHostApiImpl.setTextZoom(0L, 100L); verify(mockWebSettings).setTextZoom(100); } + + @Test + public void getUserAgentString() { + final String userAgent = "str"; + when(mockWebSettings.getUserAgentString()).thenReturn(userAgent); + assertEquals(testHostApiImpl.getUserAgentString(0L), userAgent); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java index 02b6d1fd7b79740255490b0aa7fb5a4a2327c80a..126485be01f41d1fa6d26fe1ea0048194b852981 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java @@ -358,4 +358,25 @@ public class WebViewTest { verify(mockFlutterView).setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); } + + @Test + public void onScrollChanged() { + final InstanceManager instanceManager = InstanceManager.create(identifier -> {}); + + final WebViewFlutterApiImpl flutterApiImpl = + new WebViewFlutterApiImpl(mockBinaryMessenger, instanceManager); + + final WebViewFlutterApi mockFlutterApi = mock(WebViewFlutterApi.class); + flutterApiImpl.setApi(mockFlutterApi); + flutterApiImpl.create(mockWebView, reply -> {}); + + flutterApiImpl.onScrollChanged(mockWebView, 0L, 1L, 2L, 3L, reply -> {}); + + final long instanceIdentifier = + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockWebView)); + verify(mockFlutterApi) + .onScrollChanged(eq(instanceIdentifier), eq(0L), eq(1L), eq(2L), eq(3L), any()); + + instanceManager.stopFinalizationListener(); + } } diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/legacy/webview_flutter_test.dart index b4b2817decf8f658686e462323e471394b11690e..2e7f3d0b8dd7c80867d14e5d13384494323052f0 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/legacy/webview_flutter_test.dart @@ -248,11 +248,9 @@ Future main() async { 'test_header': 'flutter_test_header' }; await controller.loadUrl(headersUrl, headers: headers); - final String? currentUrl = await controller.currentUrl(); - expect(currentUrl, headersUrl); - await pageStarts.stream.firstWhere((String url) => url == currentUrl); - await pageLoads.stream.firstWhere((String url) => url == currentUrl); + await pageStarts.stream.firstWhere((String url) => url == headersUrl); + await pageLoads.stream.firstWhere((String url) => url == headersUrl); final String content = await controller .runJavascriptReturningResult('document.documentElement.innerText'); diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 53b8a0078fd07e3725a2ebc771d66bf029024308..f599f07cc3a754b57b07d377fc22220dc23ae6f9 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -35,6 +35,15 @@ Future main() async { request.response.writeln('${request.headers}'); } else if (request.uri.path == '/favicon.ico') { request.response.statusCode = HttpStatus.notFound; + } else if (request.uri.path == '/http-basic-authentication') { + final bool isAuthenticating = request.headers['Authorization'] != null; + if (isAuthenticating) { + request.response.writeln('Authorized'); + } else { + request.response.headers + .add('WWW-Authenticate', 'Basic realm="Test realm"'); + request.response.statusCode = HttpStatus.unauthorized; + } } else { fail('unexpected request: ${request.method} ${request.uri}'); } @@ -44,6 +53,7 @@ Future main() async { final String primaryUrl = '$prefixUrl/hello.txt'; final String secondaryUrl = '$prefixUrl/secondary.txt'; final String headersUrl = '$prefixUrl/headers'; + final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets('loadRequest', (WidgetTester tester) async { final Completer pageFinished = Completer(); @@ -342,7 +352,7 @@ Future main() async { await pageFinished.future; - final String customUserAgent = await _getUserAgent(controller); + final String? customUserAgent = await controller.getUserAgent(); expect(customUserAgent, 'Custom_User_Agent1'); }); @@ -356,6 +366,19 @@ Future main() async { final String videoTest = ''' Video auto play + - +

+
+ +
'''; @@ -509,6 +544,65 @@ Future main() async { .runJavaScriptReturningResult('isFullScreen();') as bool; expect(fullScreen, false); }); + + testWidgets('Video plays fullscreen', (WidgetTester tester) async { + final Completer fullscreenEntered = Completer(); + final Completer fullscreenExited = Completer(); + final Completer pageLoaded = Completer(); + + final AndroidWebViewController controller = AndroidWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setMediaPlaybackRequiresUserGesture(false)); + final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); + unawaited(controller.setPlatformNavigationDelegate(delegate)); + unawaited(controller.setCustomWidgetCallbacks(onHideCustomWidget: () { + fullscreenExited.complete(); + }, onShowCustomWidget: + (Widget webView, void Function() onHideCustomView) { + fullscreenEntered.complete(); + onHideCustomView(); + })); + + await controller.loadRequest( + LoadRequestParams( + uri: Uri.parse( + 'data:text/html;charset=utf-8;base64,$videoTestBase64', + ), + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams( + key: const Key('webview_widget'), + controller: controller, + ), + ).build(context); + }, + )); + + await pageLoaded.future; + + await tester.pumpAndSettle(); + + // Due to security reasons, Chrome doesn't allow to programmatically + // toggle a video to fullscreen unless the call is directly coming from + // a user triggered event. + // The top half of the loaded web content contains a clickable div, which + // is tapped using the code below, triggering a user event. + // + // The offset of 20 x 20 is chosen at random. + await tester.tapAt(const Offset(20, 20)); + + await expectLater(fullscreenEntered.future, completes); + await expectLater(fullscreenExited.future, completes); + }); }); group('Audio playback policy', () { @@ -664,7 +758,8 @@ Future main() async { }); group('Programmatic Scroll', () { - testWidgets('setAndGetScrollPosition', (WidgetTester tester) async { + testWidgets('setAndGetAndListenScrollPosition', + (WidgetTester tester) async { const String scrollTestPage = ''' @@ -690,6 +785,7 @@ Future main() async { base64Encode(const Utf8Encoder().convert(scrollTestPage)); final Completer pageLoaded = Completer(); + ScrollPositionChange? recordedPosition; final PlatformWebViewController controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); @@ -699,6 +795,10 @@ Future main() async { ); unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); unawaited(controller.setPlatformNavigationDelegate(delegate)); + unawaited(controller.setOnScrollPositionChange( + (ScrollPositionChange contentOffsetChange) { + recordedPosition = contentOffsetChange; + })); await controller.loadRequest( LoadRequestParams( @@ -730,17 +830,22 @@ Future main() async { // time to settle. expect(scrollPos.dx, isNot(X_SCROLL)); expect(scrollPos.dy, isNot(Y_SCROLL)); + expect(recordedPosition, null); await controller.scrollTo(X_SCROLL, Y_SCROLL); scrollPos = await controller.getScrollPosition(); expect(scrollPos.dx, X_SCROLL); expect(scrollPos.dy, Y_SCROLL); + expect(recordedPosition?.x, X_SCROLL); + expect(recordedPosition?.y, Y_SCROLL); // Check scrollBy() (on top of scrollTo()) await controller.scrollBy(X_SCROLL, Y_SCROLL); scrollPos = await controller.getScrollPosition(); expect(scrollPos.dx, X_SCROLL * 2); expect(scrollPos.dy, Y_SCROLL * 2); + expect(recordedPosition?.x, X_SCROLL * 2); + expect(recordedPosition?.y, Y_SCROLL * 2); }); }); @@ -1035,6 +1140,82 @@ Future main() async { }); }); + testWidgets('can receive HTTP basic auth requests', + (WidgetTester tester) async { + final Completer authRequested = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => authRequested.complete()); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we don't get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + AndroidWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(authRequested.future, completes); + }); + + testWidgets('can reply to HTTP basic auth requests', + (WidgetTester tester) async { + final Completer pageFinished = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnPageFinished((_) => pageFinished.complete()); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => request.onProceed( + const WebViewCredential(user: 'user', password: 'password'), + ), + ); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we do not get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + AndroidWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(pageFinished.future, completes); + }); + testWidgets('target _blank opens in same window', (WidgetTester tester) async { final Completer pageLoaded = Completer(); @@ -1226,19 +1407,139 @@ Future main() async { ); }, ); -} -/// Returns the value used for the HTTP User-Agent: request header in subsequent HTTP requests. -Future _getUserAgent(PlatformWebViewController controller) async { - return _runJavaScriptReturningResult(controller, 'navigator.userAgent;'); -} + testWidgets('can receive JavaScript alert dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final Completer alertMessage = Completer(); + unawaited(controller.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + alertMessage.complete(request.message); + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); -Future _runJavaScriptReturningResult( - PlatformWebViewController controller, - String js, -) async { - return jsonDecode(await controller.runJavaScriptReturningResult(js) as String) - as String; + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await controller.runJavaScript('alert("alert message")'); + await expectLater(alertMessage.future, completion('alert message')); + }); + + testWidgets('can receive JavaScript confirm dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final Completer confirmMessage = Completer(); + unawaited(controller.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + confirmMessage.complete(request.message); + return true; + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await controller.runJavaScript('confirm("confirm message")'); + await expectLater(confirmMessage.future, completion('confirm message')); + }); + + testWidgets('can receive JavaScript prompt dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + unawaited(controller.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + return 'return message'; + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + final Object promptResponse = await controller.runJavaScriptReturningResult( + 'prompt("input message", "default text")', + ); + expect(promptResponse, '"return message"'); + }); + + group('Logging', () { + testWidgets('can receive console log messages', + (WidgetTester tester) async { + const String testPage = ''' + + + + WebResourceError test + + +

Test page

+ + + '''; + + final Completer debugMessageReceived = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + + await controller.setOnConsoleMessage((JavaScriptConsoleMessage message) { + debugMessageReceived + .complete('${message.level.name}:${message.message}'); + }); + + await controller.loadHtmlString(testPage); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await expectLater( + debugMessageReceived.future, completion('debug:Debug message')); + }); + }); } class ResizableWebView extends StatefulWidget { diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index 0c3e3411bd09ee7917a46ca3f8f2218cbe7cbe68..4a84e0f2e93b55dcb634a9c6b26d060f1b688375 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -73,6 +73,72 @@ const String kTransparentBackgroundPage = ''' '''; +const String kLogExamplePage = ''' + + + +Load file or HTML string example + + + +

Local demo page

+

+ This page is used to test the forwarding of console logs to Dart. +

+ + + +
+ + + + + +
+ + + +'''; + +const String kAlertTestPage = ''' + + + + + + + +

Click the following button to see the effect

+
+ + + +
+ + +'''; + class WebViewExample extends StatefulWidget { const WebViewExample({super.key, this.cookieManager}); @@ -118,7 +184,7 @@ Page resource error: '''); }) ..setOnNavigationRequest((NavigationRequest request) { - if (request.url.startsWith('https://www.youtube.com/')) { + if (request.url.contains('pub.dev')) { debugPrint('blocking navigation to ${request.url}'); return NavigationDecision.prevent; } @@ -127,6 +193,9 @@ Page resource error: }) ..setOnUrlChange((UrlChange change) { debugPrint('url change to ${change.url}'); + }) + ..setOnHttpAuthRequest((HttpAuthRequest request) { + openDialog(request); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -145,9 +214,11 @@ Page resource error: request.grant(); }, ) - ..loadRequest(LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - )); + ..loadRequest( + LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + ), + ); } @override @@ -176,7 +247,7 @@ Page resource error: return FloatingActionButton( onPressed: () async { final String? url = await _controller.currentUrl(); - if (context.mounted) { + if (mounted) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Favorited $url')), ); @@ -185,6 +256,50 @@ Page resource error: child: const Icon(Icons.favorite), ); } + + Future openDialog(HttpAuthRequest httpRequest) async { + final TextEditingController usernameTextController = + TextEditingController(); + final TextEditingController passwordTextController = + TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('${httpRequest.host}: ${httpRequest.realm ?? '-'}'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + decoration: const InputDecoration(labelText: 'Username'), + autofocus: true, + controller: usernameTextController, + ), + TextField( + decoration: const InputDecoration(labelText: 'Password'), + controller: passwordTextController, + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + httpRequest.onProceed( + WebViewCredential( + user: usernameTextController.text, + password: passwordTextController.text, + ), + ); + Navigator.of(context).pop(); + }, + child: const Text('Authenticate'), + ), + ], + ); + }, + ); + } } enum MenuOptions { @@ -201,6 +316,10 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + videoExample, + logExample, + basicAuthentication, + javaScriptAlert, } class SampleMenu extends StatelessWidget { @@ -261,6 +380,18 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.videoExample: + _onVideoExample(context); + break; + case MenuOptions.logExample: + _onLogExample(); + break; + case MenuOptions.basicAuthentication: + _promptForUrl(context); + break; + case MenuOptions.javaScriptAlert: + _onJavaScriptAlertExample(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -317,6 +448,22 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.transparentBackground, child: Text('Transparent background example'), ), + const PopupMenuItem( + value: MenuOptions.logExample, + child: Text('Log example'), + ), + const PopupMenuItem( + value: MenuOptions.videoExample, + child: Text('Video example'), + ), + const PopupMenuItem( + value: MenuOptions.basicAuthentication, + child: Text('Basic Authentication Example'), + ), + const PopupMenuItem( + value: MenuOptions.javaScriptAlert, + child: Text('JavaScript Alert Example'), + ), ], ); } @@ -412,6 +559,30 @@ class SampleMenu extends StatelessWidget { )); } + Future _onVideoExample(BuildContext context) { + final AndroidWebViewController androidController = + webViewController as AndroidWebViewController; + // #docregion fullscreen_example + androidController.setCustomWidgetCallbacks( + onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, + ); + // #enddocregion fullscreen_example + + return androidController.loadRequest( + LoadRequestParams( + uri: Uri.parse('https://www.youtube.com/watch?v=4AoFA19gbLo'), + ), + ); + } + Future _onDoPostRequest() { return webViewController.loadRequest(LoadRequestParams( uri: Uri.parse('https://httpbin.org/post'), @@ -441,6 +612,28 @@ class SampleMenu extends StatelessWidget { return webViewController.loadHtmlString(kTransparentBackgroundPage); } + Future _onJavaScriptAlertExample(BuildContext context) { + webViewController.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + await _showAlert(context, request.message); + }); + + webViewController.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + final bool result = await _showConfirm(context, request.message); + return result; + }); + + webViewController.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + final String result = + await _showTextInput(context, request.message, request.defaultText); + return result; + }); + + return webViewController.loadHtmlString(kAlertTestPage); + } + Widget _getCookieList(String cookies) { if (cookies == '""') { return Container(); @@ -465,6 +658,108 @@ class SampleMenu extends StatelessWidget { return indexFile.path; } + + Future _onLogExample() { + webViewController + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + debugPrint( + '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); + }); + return webViewController.loadHtmlString(kLogExamplePage); + } + + Future _promptForUrl(BuildContext context) { + final TextEditingController urlTextController = TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Input URL to visit'), + content: TextField( + decoration: const InputDecoration(labelText: 'URL'), + autofocus: true, + controller: urlTextController, + ), + actions: [ + TextButton( + onPressed: () { + if (urlTextController.text.isNotEmpty) { + final Uri? uri = Uri.tryParse(urlTextController.text); + if (uri != null && uri.scheme.isNotEmpty) { + webViewController.loadRequest( + LoadRequestParams(uri: uri), + ); + Navigator.pop(context); + } + } + }, + child: const Text('Visit'), + ), + ], + ); + }, + ); + } + + Future _showAlert(BuildContext context, String message) async { + return showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: const Text('OK')) + ], + ); + }); + } + + Future _showConfirm(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(false); + }, + child: const Text('Cancel')), + TextButton( + onPressed: () { + Navigator.of(ctx).pop(true); + }, + child: const Text('OK')), + ], + ); + }) ?? + false; + } + + Future _showTextInput( + BuildContext context, String message, String? defaultText) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop('Text test'); + }, + child: const Text('Enter')), + ], + ); + }) ?? + ''; + } } class NavigationControls extends StatelessWidget { diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index 286b847a0f978f4f001739c57ebc4998d9d9a343..2d2860f4d2a1f1eb0a6d07edbbc0eab27c1be7ab 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -17,7 +17,10 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_platform_interface: ^2.4.0 + +dependency_overrides: + webview_flutter_platform_interface: + path: ../../webview_flutter_platform_interface dev_dependencies: espresso: ^0.2.0 diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart index e95de8cfa6f1e53b9447c2d89ac32af42dde4e99..9f02d1b5f93fd217987f0caf96b5b145cca6d038 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart @@ -25,25 +25,41 @@ class AndroidWebViewProxy { }); /// Constructs a [android_webview.WebView]. - final android_webview.WebView Function() createAndroidWebView; + final android_webview.WebView Function({ + void Function(int left, int top, int oldLeft, int oldTop)? onScrollChanged, + }) createAndroidWebView; /// Constructs a [android_webview.WebChromeClient]. - final android_webview.WebChromeClient Function( - {void Function(android_webview.WebView webView, int progress)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function(String origin, - android_webview.GeolocationPermissionsCallback callback)? - onGeolocationPermissionsShowPrompt, - void Function(android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt}) createAndroidWebChromeClient; + final android_webview.WebChromeClient Function({ + void Function(android_webview.WebView webView, int progress)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function(String origin, + android_webview.GeolocationPermissionsCallback callback)? + onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function(android_webview.WebChromeClient instance, + android_webview.ConsoleMessage message)? + onConsoleMessage, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? onHideCustomView, + Future Function(String url, String message)? onJsAlert, + Future Function(String url, String message)? onJsConfirm, + Future Function(String url, String message, String defaultValue)? + onJsPrompt, + }) createAndroidWebChromeClient; /// Constructs a [android_webview.WebViewClient]. final android_webview.WebViewClient Function({ @@ -68,6 +84,12 @@ class AndroidWebViewProxy { void Function(android_webview.WebView webView, String url)? urlLoading, void Function(android_webview.WebView webView, String url, bool isReload)? doUpdateVisitedHistory, + void Function( + android_webview.WebView webView, + android_webview.HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest, }) createAndroidWebViewClient; /// Constructs a [android_webview.FlutterAssetManager]. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index 85ec6b902c5712793ac9b0025155dd9dbdc4b7ba..0803198a176ba1b2640874387d7e664e32bb2c89 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -12,7 +12,8 @@ import 'android_webview.g.dart'; import 'android_webview_api_impls.dart'; import 'instance_manager.dart'; -export 'android_webview_api_impls.dart' show FileChooserMode; +export 'android_webview_api_impls.dart' + show ConsoleMessage, ConsoleMessageLevel, FileChooserMode; /// Root of the Java class hierarchy. /// @@ -129,13 +130,10 @@ class GeolocationPermissionsCallback extends JavaObject { /// [Web-based content](https://developer.android.com/guide/webapps). /// /// When a [WebView] is no longer needed [release] must be called. -class WebView extends JavaObject { +class WebView extends View { /// Constructs a new WebView. - /// - /// Due to changes in Flutter 3.0 the [useHybridComposition] doesn't have - /// any effect and should not be exposed publicly. More info here: - /// https://github.com/flutter/flutter/issues/108106 WebView({ + this.onScrollChanged, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -148,6 +146,7 @@ class WebView extends JavaObject { /// create copies. @protected WebView.detached({ + this.onScrollChanged, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -159,6 +158,18 @@ class WebView extends JavaObject { /// The [WebSettings] object used to control the settings for this WebView. late final WebSettings settings = WebSettings(this); + /// Called in response to an internal scroll in this view + /// (i.e., the view scrolled its own contents). + /// + /// This is typically as a result of [scrollBy] or [scrollTo] + /// having been called. + final void Function( + int left, + int top, + int oldLeft, + int oldTop, + )? onScrollChanged; + /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. /// /// This flag can be enabled in order to facilitate debugging of web layouts @@ -447,6 +458,7 @@ class WebView extends JavaObject { @override WebView copy() { return WebView.detached( + onScrollChanged: onScrollChanged, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -694,6 +706,11 @@ class WebSettings extends JavaObject { return api.setSetTextZoomFromInstance(this, textZoom); } + /// Gets the WebView's user-agent string. + Future getUserAgentString() { + return api.getUserAgentStringFromInstance(this); + } + @override WebSettings copy() { return WebSettings.detached( @@ -763,6 +780,7 @@ class WebViewClient extends JavaObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -783,6 +801,7 @@ class WebViewClient extends JavaObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -931,6 +950,14 @@ class WebViewClient extends JavaObject { final void Function(WebView webView, String url, bool isReload)? doUpdateVisitedHistory; + /// This callback is only called for requests that require HTTP authentication. + final void Function( + WebView webView, + HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest; + /// Sets the required synchronous return value for the Java method, /// `WebViewClient.shouldOverrideUrlLoading(...)`. /// @@ -959,6 +986,7 @@ class WebViewClient extends JavaObject { requestLoading: requestLoading, urlLoading: urlLoading, doUpdateVisitedHistory: doUpdateVisitedHistory, + onReceivedHttpAuthRequest: onReceivedHttpAuthRequest, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -1024,6 +1052,18 @@ typedef GeolocationPermissionsHidePrompt = void Function( WebChromeClient instance, ); +/// Signature for the callback that is responsible for showing a custom view. +typedef ShowCustomViewCallback = void Function( + WebChromeClient instance, + View view, + CustomViewCallback callback, +); + +/// Signature for the callback that is responsible for hiding a custom view. +typedef HideCustomViewCallback = void Function( + WebChromeClient instance, +); + /// Handles JavaScript dialogs, favicons, titles, and the progress for [WebView]. class WebChromeClient extends JavaObject { /// Constructs a [WebChromeClient]. @@ -1033,6 +1073,12 @@ class WebChromeClient extends JavaObject { this.onPermissionRequest, this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, + this.onShowCustomView, + this.onHideCustomView, + this.onConsoleMessage, + this.onJsAlert, + this.onJsConfirm, + this.onJsPrompt, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -1052,6 +1098,12 @@ class WebChromeClient extends JavaObject { this.onPermissionRequest, this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, + this.onShowCustomView, + this.onHideCustomView, + this.onConsoleMessage, + this.onJsAlert, + this.onJsConfirm, + this.onJsPrompt, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -1092,9 +1144,35 @@ class WebChromeClient extends JavaObject { /// Notify the host application that a request for Geolocation permissions, /// made with a previous call to [onGeolocationPermissionsShowPrompt] has been /// canceled. - final void Function( - WebChromeClient instance, - )? onGeolocationPermissionsHidePrompt; + final GeolocationPermissionsHidePrompt? onGeolocationPermissionsHidePrompt; + + /// Notify the host application that the current page has entered full screen + /// mode. + /// + /// After this call, web content will no longer be rendered in the WebView, + /// but will instead be rendered in `view`. + final ShowCustomViewCallback? onShowCustomView; + + /// Notify the host application that the current page has exited full screen + /// mode. + final HideCustomViewCallback? onHideCustomView; + + /// Report a JavaScript console message to the host application. + final void Function(WebChromeClient instance, ConsoleMessage message)? + onConsoleMessage; + + /// Notify the host application that the web page wants to display a + /// JavaScript alert() dialog. + final Future Function(String url, String message)? onJsAlert; + + /// Notify the host application that the web page wants to display a + /// JavaScript confirm() dialog. + final Future Function(String url, String message)? onJsConfirm; + + /// Notify the host application that the web page wants to display a + /// JavaScript prompt() dialog. + final Future Function( + String url, String message, String defaultValue)? onJsPrompt; /// Sets the required synchronous return value for the Java method, /// `WebChromeClient.onShowFileChooser(...)`. @@ -1125,13 +1203,119 @@ class WebChromeClient extends JavaObject { ); } + /// Sets the required synchronous return value for the Java method, + /// `WebChromeClient.onShowFileChooser(...)`. + /// + /// The Java method, `WebChromeClient.onConsoleMessage(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the Java method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onConsoleMessage] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnConsoleMessage( + bool value, + ) { + if (value && onConsoleMessage == null) { + throw StateError( + 'Setting this to true requires `onConsoleMessage` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnConsoleMessageFromInstance( + this, + value, + ); + } + + /// Sets the required synchronous return value for the Java method, + /// `WebChromeClient.onJsAlert(...)`. + /// + /// The Java method, `WebChromeClient.onJsAlert(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the Java method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsAlert] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsAlert( + bool value, + ) { + if (value && onJsAlert == null) { + throw StateError( + 'Setting this to true requires `onJsAlert` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsAlertFromInstance(this, value); + } + + /// Sets the required synchronous return value for the Java method, + /// `WebChromeClient.onJsConfirm(...)`. + /// + /// The Java method, `WebChromeClient.onJsConfirm(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the Java method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsConfirm] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsConfirm( + bool value, + ) { + if (value && onJsConfirm == null) { + throw StateError( + 'Setting this to true requires `onJsConfirm` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsConfirmFromInstance(this, value); + } + + /// Sets the required synchronous return value for the Java method, + /// `WebChromeClient.onJsPrompt(...)`. + /// + /// The Java method, `WebChromeClient.onJsPrompt(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the Java method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsPrompt] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsPrompt( + bool value, + ) { + if (value && onJsPrompt == null) { + throw StateError( + 'Setting this to true requires `onJsPrompt` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsPromptFromInstance(this, value); + } + @override WebChromeClient copy() { return WebChromeClient.detached( onProgressChanged: onProgressChanged, onShowFileChooser: onShowFileChooser, + onPermissionRequest: onPermissionRequest, onGeolocationPermissionsShowPrompt: onGeolocationPermissionsShowPrompt, onGeolocationPermissionsHidePrompt: onGeolocationPermissionsHidePrompt, + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, + onConsoleMessage: onConsoleMessage, + onJsAlert: onJsAlert, + onJsConfirm: onJsConfirm, + onJsPrompt: onJsPrompt, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -1370,3 +1554,99 @@ class WebStorage extends JavaObject { ); } } + +/// The basic building block for user interface components. +/// +/// See https://developer.android.com/reference/android/view/View. +class View extends JavaObject { + /// Instantiates a [View] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + View.detached({super.binaryMessenger, super.instanceManager}) + : super.detached(); + + @override + View copy() { + return View.detached( + binaryMessenger: _api.binaryMessenger, + instanceManager: _api.instanceManager, + ); + } +} + +/// A callback interface used by the host application to notify the current page +/// that its custom view has been dismissed. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallback extends JavaObject { + /// Instantiates a [CustomViewCallback] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + CustomViewCallback.detached({ + super.binaryMessenger, + super.instanceManager, + }) : _customViewCallbackApi = CustomViewCallbackHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + + final CustomViewCallbackHostApiImpl _customViewCallbackApi; + + /// Invoked when the host application dismisses the custom view. + Future onCustomViewHidden() { + return _customViewCallbackApi.onCustomViewHiddenFromInstances(this); + } + + @override + CustomViewCallback copy() { + return CustomViewCallback.detached( + binaryMessenger: _customViewCallbackApi.binaryMessenger, + instanceManager: _customViewCallbackApi.instanceManager, + ); + } +} + +/// Represents a request for HTTP authentication. +/// +/// Instances of this class are created by the [WebView] and passed to +/// [WebViewClient.onReceivedHttpAuthRequest]. The host application must call +/// either [HttpAuthHandler.proceed] or [HttpAuthHandler.cancel] to set the +/// WebView's response to the request. +class HttpAuthHandler extends JavaObject { + /// Constructs a [HttpAuthHandler]. + HttpAuthHandler({ + super.binaryMessenger, + super.instanceManager, + }) : super.detached(); + + /// Pigeon Host Api implementation for [HttpAuthHandler]. + @visibleForTesting + static HttpAuthHandlerHostApiImpl api = HttpAuthHandlerHostApiImpl(); + + /// Instructs the WebView to cancel the authentication request. + Future cancel() { + return api.cancelFromInstance(this); + } + + /// Instructs the WebView to proceed with the authentication with the provided + /// credentials. + Future proceed(String username, String password) { + return api.proceedFromInstance(this, username, password); + } + + /// Gets whether the credentials stored for the current host are suitable for + /// use. + /// + /// Credentials are not suitable if they have previously been rejected by the + /// server for the current request. + Future useHttpAuthUsernamePassword() { + return api.useHttpAuthUsernamePasswordFromInstance(this); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index b2a82fdf1ab89f265c8154165ea751ed96c8e9b7..e7ece16f722b675963ffdefa6eb9211618cf6845 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -32,6 +32,42 @@ enum FileChooserMode { save, } +/// Indicates the type of message logged to the console. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel. +enum ConsoleMessageLevel { + /// Indicates a message is logged for debugging. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. + debug, + + /// Indicates a message is provided as an error. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. + error, + + /// Indicates a message is provided as a basic log message. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. + log, + + /// Indicates a message is provided as a tip. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. + tip, + + /// Indicates a message is provided as a warning. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. + warning, + + /// Indicates a message with an unknown level. + /// + /// This does not represent an actual value provided by the platform and only + /// indicates a value was provided that isn't currently supported. + unknown, +} + class WebResourceRequestData { WebResourceRequestData({ required this.url, @@ -131,6 +167,45 @@ class WebViewPoint { } } +/// Represents a JavaScript console message from WebCore. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage +class ConsoleMessage { + ConsoleMessage({ + required this.lineNumber, + required this.message, + required this.level, + required this.sourceId, + }); + + int lineNumber; + + String message; + + ConsoleMessageLevel level; + + String sourceId; + + Object encode() { + return [ + lineNumber, + message, + level.index, + sourceId, + ]; + } + + static ConsoleMessage decode(Object result) { + result as List; + return ConsoleMessage( + lineNumber: result[0]! as int, + message: result[1]! as String, + level: ConsoleMessageLevel.values[result[2]! as int], + sourceId: result[3]! as String, + ); + } +} + /// Host API for managing the native `InstanceManager`. class InstanceManagerHostApi { /// Constructor for [InstanceManagerHostApi]. The [binaryMessenger] named argument is @@ -1060,6 +1135,9 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); + void onScrollChanged( + int webViewInstanceId, int left, int top, int oldLeft, int oldTop); + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1082,6 +1160,39 @@ abstract class WebViewFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null.'); + final List args = (message as List?)!; + final int? arg_webViewInstanceId = (args[0] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_left = (args[1] as int?); + assert(arg_left != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_top = (args[2] as int?); + assert(arg_top != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldLeft = (args[3] as int?); + assert(arg_oldLeft != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldTop = (args[4] as int?); + assert(arg_oldTop != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + api.onScrollChanged(arg_webViewInstanceId!, arg_left!, arg_top!, + arg_oldLeft!, arg_oldTop!); + return; + }); + } + } } } @@ -1424,6 +1535,34 @@ class WebSettingsHostApi { return; } } + + Future getUserAgentString(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as String?)!; + } + } } class JavaScriptChannelHostApi { @@ -1600,6 +1739,9 @@ abstract class WebViewClientFlutterApi { void doUpdateVisitedHistory( int instanceId, int webViewInstanceId, String url, bool isReload); + void onReceivedHttpAuthRequest(int instanceId, int webViewInstanceId, + int httpAuthHandlerInstanceId, String host, String realm); + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1803,6 +1945,39 @@ abstract class WebViewClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_webViewInstanceId = (args[1] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_httpAuthHandlerInstanceId = (args[2] as int?); + assert(arg_httpAuthHandlerInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final String? arg_host = (args[3] as String?); + assert(arg_host != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + final String? arg_realm = (args[4] as String?); + assert(arg_realm != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + api.onReceivedHttpAuthRequest(arg_instanceId!, arg_webViewInstanceId!, + arg_httpAuthHandlerInstanceId!, arg_host!, arg_realm!); + return; + }); + } + } } } @@ -1943,6 +2118,102 @@ class WebChromeClientHostApi { return; } } + + Future setSynchronousReturnValueForOnConsoleMessage( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsAlert( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsConfirm( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsPrompt( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } } class FlutterAssetManagerHostApi { @@ -2012,8 +2283,31 @@ class FlutterAssetManagerHostApi { } } +class _WebChromeClientFlutterApiCodec extends StandardMessageCodec { + const _WebChromeClientFlutterApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is ConsoleMessage) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return ConsoleMessage.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + abstract class WebChromeClientFlutterApi { - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec codec = _WebChromeClientFlutterApiCodec(); void onProgressChanged(int instanceId, int webViewInstanceId, int progress); @@ -2023,6 +2317,13 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView( + int instanceId, int viewIdentifier, int callbackIdentifier); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); + /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. void onGeolocationPermissionsShowPrompt( int instanceId, int paramsInstanceId, String origin); @@ -2030,6 +2331,16 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. void onGeolocationPermissionsHidePrompt(int identifier); + /// Callback to Dart function `WebChromeClient.onConsoleMessage`. + void onConsoleMessage(int instanceId, ConsoleMessage message); + + Future onJsAlert(int instanceId, String url, String message); + + Future onJsConfirm(int instanceId, String url, String message); + + Future onJsPrompt( + int instanceId, String url, String message, String defaultValue); + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -2109,6 +2420,53 @@ abstract class WebChromeClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_viewIdentifier = (args[1] as int?); + assert(arg_viewIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_callbackIdentifier = (args[2] as int?); + assert(arg_callbackIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + api.onShowCustomView( + arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onHideCustomView', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onHideCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onHideCustomView was null, expected non-null int.'); + api.onHideCustomView(arg_instanceId!); + return; + }); + } + } { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', @@ -2156,24 +2514,130 @@ abstract class WebChromeClientFlutterApi { }); } } - } -} - -class WebStorageHostApi { - /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - WebStorageHostApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future create(int arg_instanceId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_android.WebStorageHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage was null, expected non-null int.'); + final ConsoleMessage? arg_message = (args[1] as ConsoleMessage?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage was null, expected non-null ConsoleMessage.'); + api.onConsoleMessage(arg_instanceId!, arg_message!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsAlert was null, expected non-null String.'); + await api.onJsAlert(arg_instanceId!, arg_url!, arg_message!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null String.'); + final bool output = + await api.onJsConfirm(arg_instanceId!, arg_url!, arg_message!); + return output; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String? arg_defaultValue = (args[3] as String?); + assert(arg_defaultValue != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String output = await api.onJsPrompt( + arg_instanceId!, arg_url!, arg_message!, arg_defaultValue!); + return output; + }); + } + } + } +} + +class WebStorageHostApi { + /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + WebStorageHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future create(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebStorageHostApi.create', + codec, + binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_instanceId]) as List?; if (replyList == null) { @@ -2371,6 +2835,123 @@ abstract class PermissionRequestFlutterApi { } } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallbackHostApi { + /// Constructor for [CustomViewCallbackHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + CustomViewCallbackHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + Future onCustomViewHidden(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackHostApi.onCustomViewHidden', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class CustomViewCallbackFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +abstract class ViewFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(ViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.ViewFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.ViewFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.ViewFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -2452,3 +3033,138 @@ abstract class GeolocationPermissionsCallbackFlutterApi { } } } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +class HttpAuthHandlerHostApi { + /// Constructor for [HttpAuthHandlerHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + HttpAuthHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + Future useHttpAuthUsernamePassword(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as bool?)!; + } + } + + /// Handles Dart method `HttpAuthHandler.cancel`. + Future cancel(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + /// Handles Dart method `HttpAuthHandler.proceed`. + Future proceed( + int arg_instanceId, String arg_username, String arg_password) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_username, arg_password]) + as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +abstract class HttpAuthHandlerFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int instanceId); + + static void setup(HttpAuthHandlerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create was null, expected non-null int.'); + api.create(arg_instanceId!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index a2fa1da3477e029058a980d97e87c7f272d6b05a..854ed61bd8fc4c9a7b20b7bfa1214913420ee148 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:typed_data'; import 'dart:ui'; -import 'package:flutter/services.dart' show BinaryMessenger; +import 'package:flutter/services.dart' show BinaryMessenger, Uint8List; import 'android_webview.dart'; import 'android_webview.g.dart'; import 'instance_manager.dart'; -export 'android_webview.g.dart' show FileChooserMode; +export 'android_webview.g.dart' + show ConsoleMessage, ConsoleMessageLevel, FileChooserMode; /// Converts [WebResourceRequestData] to [WebResourceRequest] WebResourceRequest _toWebResourceRequest(WebResourceRequestData data) { @@ -47,6 +47,9 @@ class AndroidWebViewFlutterApis { geolocationPermissionsCallbackFlutterApi, WebViewFlutterApiImpl? webViewFlutterApi, PermissionRequestFlutterApiImpl? permissionRequestFlutterApi, + CustomViewCallbackFlutterApiImpl? customViewCallbackFlutterApi, + ViewFlutterApiImpl? viewFlutterApi, + HttpAuthHandlerFlutterApiImpl? httpAuthHandlerFlutterApi, }) { this.javaObjectFlutterApi = javaObjectFlutterApi ?? JavaObjectFlutterApiImpl(); @@ -66,6 +69,11 @@ class AndroidWebViewFlutterApis { this.webViewFlutterApi = webViewFlutterApi ?? WebViewFlutterApiImpl(); this.permissionRequestFlutterApi = permissionRequestFlutterApi ?? PermissionRequestFlutterApiImpl(); + this.customViewCallbackFlutterApi = + customViewCallbackFlutterApi ?? CustomViewCallbackFlutterApiImpl(); + this.viewFlutterApi = viewFlutterApi ?? ViewFlutterApiImpl(); + this.httpAuthHandlerFlutterApi = + httpAuthHandlerFlutterApi ?? HttpAuthHandlerFlutterApiImpl(); } static bool _haveBeenSetUp = false; @@ -103,6 +111,15 @@ class AndroidWebViewFlutterApis { /// Flutter Api for [PermissionRequest]. late final PermissionRequestFlutterApiImpl permissionRequestFlutterApi; + /// Flutter Api for [CustomViewCallback]. + late final CustomViewCallbackFlutterApiImpl customViewCallbackFlutterApi; + + /// Flutter Api for [View]. + late final ViewFlutterApiImpl viewFlutterApi; + + /// Flutter Api for [HttpAuthHandler]. + late final HttpAuthHandlerFlutterApiImpl httpAuthHandlerFlutterApi; + /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { @@ -116,6 +133,9 @@ class AndroidWebViewFlutterApis { geolocationPermissionsCallbackFlutterApi); WebViewFlutterApi.setup(webViewFlutterApi); PermissionRequestFlutterApi.setup(permissionRequestFlutterApi); + CustomViewCallbackFlutterApi.setup(customViewCallbackFlutterApi); + ViewFlutterApi.setup(viewFlutterApi); + HttpAuthHandlerFlutterApi.setup(httpAuthHandlerFlutterApi); _haveBeenSetUp = true; } } @@ -390,6 +410,18 @@ class WebViewFlutterApiImpl implements WebViewFlutterApi { void create(int identifier) { instanceManager.addHostCreatedInstance(WebView.detached(), identifier); } + + @override + void onScrollChanged( + int webViewInstanceId, int left, int top, int oldLeft, int oldTop) { + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + assert( + webViewInstance != null, + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', + ); + webViewInstance!.onScrollChanged?.call(left, top, oldLeft, oldTop); + } } /// Host api implementation for [WebSettings]. @@ -539,6 +571,11 @@ class WebSettingsHostApiImpl extends WebSettingsHostApi { enabled, ); } + + /// Helper method to convert instances ids to objects. + Future getUserAgentStringFromInstance(WebSettings instance) { + return getUserAgentString(instanceManager.getIdentifier(instance)!); + } } /// Host api implementation for [JavaScriptChannel]. @@ -784,16 +821,49 @@ class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { .getInstanceWithWeakReference(webViewInstanceId) as WebView?; assert( instance != null, - 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId', + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', ); assert( webViewInstance != null, - 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId', + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', ); if (instance!.doUpdateVisitedHistory != null) { instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); } } + + @override + void onReceivedHttpAuthRequest( + int instanceId, + int webViewInstanceId, + int httpAuthHandlerInstanceId, + String host, + String realm, + ) { + final WebViewClient? instance = instanceManager + .getInstanceWithWeakReference(instanceId) as WebViewClient?; + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + final HttpAuthHandler? httpAuthHandlerInstance = + instanceManager.getInstanceWithWeakReference(httpAuthHandlerInstanceId) + as HttpAuthHandler?; + assert( + instance != null, + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', + ); + assert( + webViewInstance != null, + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', + ); + assert( + httpAuthHandlerInstance != null, + 'InstanceManager does not contain a HttpAuthHandler with instanceId: $httpAuthHandlerInstanceId', + ); + if (instance!.onReceivedHttpAuthRequest != null) { + return instance.onReceivedHttpAuthRequest!( + webViewInstance!, httpAuthHandlerInstance!, host, realm); + } + } } /// Host api implementation for [DownloadListener]. @@ -879,6 +949,44 @@ class WebChromeClientHostApiImpl extends WebChromeClientHostApi { value, ); } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnConsoleMessageFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnConsoleMessage( + instanceManager.getIdentifier(instance)!, + value, + ); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsAlertFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsAlert( + instanceManager.getIdentifier(instance)!, value); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsConfirmFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsConfirm( + instanceManager.getIdentifier(instance)!, value); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsPromptFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsPrompt( + instanceManager.getIdentifier(instance)!, value); + } } /// Flutter api implementation for [DownloadListener]. @@ -976,6 +1084,66 @@ class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { request.deny(); } } + + @override + void onShowCustomView( + int instanceId, + int viewIdentifier, + int callbackIdentifier, + ) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onShowCustomView != null) { + return instance.onShowCustomView!( + instance, + instanceManager.getInstanceWithWeakReference(viewIdentifier)!, + instanceManager.getInstanceWithWeakReference(callbackIdentifier)!, + ); + } + } + + @override + void onHideCustomView(int instanceId) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onHideCustomView != null) { + return instance.onHideCustomView!( + instance, + ); + } + } + + @override + void onConsoleMessage(int instanceId, ConsoleMessage message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + instance.onConsoleMessage?.call(instance, message); + } + + @override + Future onJsAlert(int instanceId, String url, String message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsAlert!(url, message); + } + + @override + Future onJsConfirm(int instanceId, String url, String message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsConfirm!(url, message); + } + + @override + Future onJsPrompt( + int instanceId, String url, String message, String defaultValue) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsPrompt!(url, message, defaultValue); + } } /// Host api implementation for [WebStorage]. @@ -1180,6 +1348,96 @@ class PermissionRequestFlutterApiImpl implements PermissionRequestFlutterApi { } } +/// Host api implementation for [CustomViewCallback]. +class CustomViewCallbackHostApiImpl extends CustomViewCallbackHostApi { + /// Constructs a [CustomViewCallbackHostApiImpl]. + CustomViewCallbackHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + /// Helper method to convert instance ids to objects. + Future onCustomViewHiddenFromInstances(CustomViewCallback instance) { + return onCustomViewHidden(instanceManager.getIdentifier(instance)!); + } +} + +/// Flutter API implementation for [CustomViewCallback]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class CustomViewCallbackFlutterApiImpl implements CustomViewCallbackFlutterApi { + /// Constructs a [CustomViewCallbackFlutterApiImpl]. + CustomViewCallbackFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + CustomViewCallback.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + +/// Flutter API implementation for [View]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class ViewFlutterApiImpl implements ViewFlutterApi { + /// Constructs a [ViewFlutterApiImpl]. + ViewFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + View.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + /// Host api implementation for [CookieManager]. class CookieManagerHostApiImpl extends CookieManagerHostApi { /// Constructs a [CookieManagerHostApiImpl]. @@ -1235,3 +1493,68 @@ class CookieManagerHostApiImpl extends CookieManagerHostApi { ); } } + +/// Host api implementation for [HttpAuthHandler]. +class HttpAuthHandlerHostApiImpl extends HttpAuthHandlerHostApi { + /// Constructs a [HttpAuthHandlerHostApiImpl]. + HttpAuthHandlerHostApiImpl({ + super.binaryMessenger, + InstanceManager? instanceManager, + }) : _instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager _instanceManager; + + /// Helper method to convert instance ids to objects. + Future cancelFromInstance(HttpAuthHandler instance) { + return cancel(_instanceManager.getIdentifier(instance)!); + } + + /// Helper method to convert instance ids to objects. + Future proceedFromInstance( + HttpAuthHandler instance, + String username, + String password, + ) { + return proceed( + _instanceManager.getIdentifier(instance)!, + username, + password, + ); + } + + /// Helper method to convert instance ids to objects. + Future useHttpAuthUsernamePasswordFromInstance( + HttpAuthHandler instance, + ) { + return useHttpAuthUsernamePassword( + _instanceManager.getIdentifier(instance)!, + ); + } +} + +/// Flutter API implementation for [HttpAuthHandler]. +class HttpAuthHandlerFlutterApiImpl extends HttpAuthHandlerFlutterApi { + /// Constructs a [HttpAuthHandlerFlutterApiImpl]. + HttpAuthHandlerFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int instanceId) { + instanceManager.addHostCreatedInstance( + HttpAuthHandler(), + instanceId, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index fe4aebf8d0ce572f1852bf706374fa368929a1cc..4753efcaee92ccaa6da01f5ae974de0550df32e4 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -4,6 +4,8 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -11,6 +13,7 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'android_proxy.dart'; import 'android_webview.dart' as android_webview; +import 'android_webview_api_impls.dart'; import 'instance_manager.dart'; import 'platform_views_service_proxy.dart'; import 'weak_reference_utils.dart'; @@ -74,7 +77,7 @@ class AndroidWebViewPermissionResourceType /// Implementation of the [PlatformWebViewController] with the Android WebView API. class AndroidWebViewController extends PlatformWebViewController { - /// Creates a new [AndroidWebViewCookieManager]. + /// Creates a new [AndroidWebViewController]. AndroidWebViewController(PlatformWebViewControllerCreationParams params) : super.implementation(params is AndroidWebViewControllerCreationParams ? params @@ -96,7 +99,15 @@ class AndroidWebViewController extends PlatformWebViewController { /// The native [android_webview.WebView] being controlled. late final android_webview.WebView _webView = - _androidWebViewParams.androidWebViewProxy.createAndroidWebView(); + _androidWebViewParams.androidWebViewProxy.createAndroidWebView( + onScrollChanged: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (int left, int top, int oldLeft, int oldTop) async { + final void Function(ScrollPositionChange)? callback = + weakReference.target?._onScrollPositionChangedCallback; + callback?.call(ScrollPositionChange(left.toDouble(), top.toDouble())); + }; + })); late final android_webview.WebChromeClient _webChromeClient = _androidWebViewParams.androidWebViewProxy.createAndroidWebChromeClient( @@ -137,6 +148,41 @@ class AndroidWebViewController extends PlatformWebViewController { } }; }), + onShowCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (_, android_webview.View view, + android_webview.CustomViewCallback callback) { + final AndroidWebViewController? webViewController = + weakReference.target; + if (webViewController == null) { + callback.onCustomViewHidden(); + return; + } + final OnShowCustomWidgetCallback? onShowCallback = + webViewController._onShowCustomWidgetCallback; + if (onShowCallback == null) { + callback.onCustomViewHidden(); + return; + } + onShowCallback( + AndroidCustomViewWidget.private( + controller: webViewController, + customView: view, + ), + () => callback.onCustomViewHidden(), + ); + }; + }), + onHideCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (android_webview.WebChromeClient instance) { + final OnHideCustomWidgetCallback? onHideCustomViewCallback = + weakReference.target?._onHideCustomWidgetCallback; + if (onHideCustomViewCallback != null) { + onHideCustomViewCallback(); + } + }; + }), onShowFileChooser: withWeakReferenceTo( this, (WeakReference weakReference) { @@ -151,6 +197,42 @@ class AndroidWebViewController extends PlatformWebViewController { }; }, ), + onConsoleMessage: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return (android_webview.WebChromeClient webChromeClient, + android_webview.ConsoleMessage consoleMessage) async { + final void Function(JavaScriptConsoleMessage)? callback = + weakReference.target?._onConsoleLogCallback; + if (callback != null) { + JavaScriptLogLevel logLevel; + switch (consoleMessage.level) { + // Android maps `console.debug` to `MessageLevel.TIP`, it seems + // `MessageLevel.DEBUG` if not being used. + case ConsoleMessageLevel.debug: + case ConsoleMessageLevel.tip: + logLevel = JavaScriptLogLevel.debug; + break; + case ConsoleMessageLevel.error: + logLevel = JavaScriptLogLevel.error; + break; + case ConsoleMessageLevel.warning: + logLevel = JavaScriptLogLevel.warning; + break; + case ConsoleMessageLevel.unknown: + case ConsoleMessageLevel.log: + logLevel = JavaScriptLogLevel.log; + break; + } + + callback(JavaScriptConsoleMessage( + level: logLevel, + message: consoleMessage.message, + )); + } + }; + }, + ), onPermissionRequest: withWeakReferenceTo( this, (WeakReference weakReference) { @@ -194,6 +276,49 @@ class AndroidWebViewController extends PlatformWebViewController { }; }, ), + onJsAlert: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message) async { + final Future Function(JavaScriptAlertDialogRequest)? callback = + weakReference.target?._onJavaScriptAlert; + if (callback != null) { + final JavaScriptAlertDialogRequest request = + JavaScriptAlertDialogRequest(message: message, url: url); + + await callback.call(request); + } + return; + }; + }), + onJsConfirm: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message) async { + final Future Function(JavaScriptConfirmDialogRequest)? callback = + weakReference.target?._onJavaScriptConfirm; + if (callback != null) { + final JavaScriptConfirmDialogRequest request = + JavaScriptConfirmDialogRequest(message: message, url: url); + final bool result = await callback.call(request); + return result; + } + return false; + }; + }), + onJsPrompt: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message, String defaultValue) async { + final Future Function(JavaScriptTextInputDialogRequest)? + callback = weakReference.target?._onJavaScriptPrompt; + if (callback != null) { + final JavaScriptTextInputDialogRequest request = + JavaScriptTextInputDialogRequest( + message: message, url: url, defaultText: defaultValue); + final String result = await callback.call(request); + return result; + } + return ''; + }; + }), ); /// The native [android_webview.FlutterAssetManager] allows managing assets. @@ -212,8 +337,24 @@ class AndroidWebViewController extends PlatformWebViewController { OnGeolocationPermissionsHidePrompt? _onGeolocationPermissionsHidePrompt; + OnShowCustomWidgetCallback? _onShowCustomWidgetCallback; + + OnHideCustomWidgetCallback? _onHideCustomWidgetCallback; + void Function(PlatformWebViewPermissionRequest)? _onPermissionRequestCallback; + void Function(JavaScriptConsoleMessage consoleMessage)? _onConsoleLogCallback; + + Future Function(JavaScriptAlertDialogRequest request)? + _onJavaScriptAlert; + Future Function(JavaScriptConfirmDialogRequest request)? + _onJavaScriptConfirm; + Future Function(JavaScriptTextInputDialogRequest request)? + _onJavaScriptPrompt; + + void Function(ScrollPositionChange scrollPositionChange)? + _onScrollPositionChangedCallback; + /// Whether to enable the platform's webview content debugging tools. /// /// Defaults to false. @@ -433,6 +574,13 @@ class AndroidWebViewController extends PlatformWebViewController { Future setUserAgent(String? userAgent) => _webView.settings.setUserAgentString(userAgent); + @override + Future setOnScrollPositionChange( + void Function(ScrollPositionChange scrollPositionChange)? + onScrollPositionChange) async { + _onScrollPositionChangedCallback = onScrollPositionChange; + } + /// Sets the restrictions that apply on automatic media playback. Future setMediaPlaybackRequiresUserGesture(bool require) { return _webView.settings.setMediaPlaybackRequiresUserGesture(require); @@ -495,6 +643,75 @@ class AndroidWebViewController extends PlatformWebViewController { _onGeolocationPermissionsShowPrompt = onShowPrompt; _onGeolocationPermissionsHidePrompt = onHidePrompt; } + + /// Sets the callbacks that are invoked when the host application wants to + /// show or hide a custom widget. + /// + /// The most common use case these methods are invoked a video element wants + /// to be displayed in fullscreen. + /// + /// The [onShowCustomWidget] notifies the host application that web content + /// from the specified origin wants to be displayed in a custom widget. After + /// this call, web content will no longer be rendered in the `WebViewWidget`, + /// but will instead be rendered in the custom widget. The application may + /// explicitly exit fullscreen mode by invoking `onCustomWidgetHidden` in the + /// [onShowCustomWidget] callback (ex. when the user presses the back + /// button). However, this is generally not necessary as the web page will + /// often show its own UI to close out of fullscreen. Regardless of how the + /// WebView exits fullscreen mode, WebView will invoke [onHideCustomWidget], + /// signaling for the application to remove the custom widget. If this value + /// is `null` when passed to an `AndroidWebViewWidget`, a default handler + /// will be set. + /// + /// The [onHideCustomWidget] notifies the host application that the custom + /// widget must be hidden. After this call, web content will render in the + /// original `WebViewWidget` again. + Future setCustomWidgetCallbacks({ + required OnShowCustomWidgetCallback? onShowCustomWidget, + required OnHideCustomWidgetCallback? onHideCustomWidget, + }) async { + _onShowCustomWidgetCallback = onShowCustomWidget; + _onHideCustomWidgetCallback = onHideCustomWidget; + } + + /// Sets a callback that notifies the host application of any log messages + /// written to the JavaScript console. + @override + Future setOnConsoleMessage( + void Function(JavaScriptConsoleMessage consoleMessage) + onConsoleMessage) async { + _onConsoleLogCallback = onConsoleMessage; + + return _webChromeClient.setSynchronousReturnValueForOnConsoleMessage( + _onConsoleLogCallback != null); + } + + @override + Future getUserAgent() => _webView.settings.getUserAgentString(); + + @override + Future setOnJavaScriptAlertDialog( + Future Function(JavaScriptAlertDialogRequest request) + onJavaScriptAlertDialog) async { + _onJavaScriptAlert = onJavaScriptAlertDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsAlert(true); + } + + @override + Future setOnJavaScriptConfirmDialog( + Future Function(JavaScriptConfirmDialogRequest request) + onJavaScriptConfirmDialog) async { + _onJavaScriptConfirm = onJavaScriptConfirmDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsConfirm(true); + } + + @override + Future setOnJavaScriptTextInputDialog( + Future Function(JavaScriptTextInputDialogRequest request) + onJavaScriptTextInputDialog) async { + _onJavaScriptPrompt = onJavaScriptTextInputDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsPrompt(true); + } } /// Android implementation of [PlatformWebViewPermissionRequest]. @@ -541,6 +758,13 @@ typedef OnGeolocationPermissionsShowPrompt /// Signature for the `setGeolocationPermissionsPromptCallbacks` callback responsible for request the Geolocation API is cancel. typedef OnGeolocationPermissionsHidePrompt = void Function(); +/// Signature for the `setCustomWidgetCallbacks` callback responsible for showing the custom view. +typedef OnShowCustomWidgetCallback = void Function( + Widget widget, void Function() onCustomWidgetHidden); + +/// Signature for the `setCustomWidgetCallbacks` callback responsible for hiding the custom view. +typedef OnHideCustomWidgetCallback = void Function(); + /// A request params used by the host application to set the Geolocation permission state for an origin. @immutable class GeolocationPermissionsRequestParams { @@ -781,6 +1005,7 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { @override Widget build(BuildContext context) { + _trySetDefaultOnShowCustomWidgetCallbacks(context); return PlatformViewLink( // Setting a default key using `params` ensures the `PlatformViewLink` // recreates the PlatformView when changes are made. @@ -803,6 +1028,11 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { params, displayWithHybridComposition: _androidParams.displayWithHybridComposition, + platformViewsServiceProxy: _androidParams.platformViewsServiceProxy, + view: + (_androidParams.controller as AndroidWebViewController)._webView, + instanceManager: _androidParams.instanceManager, + layoutDirection: _androidParams.layoutDirection, ) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) ..create(); @@ -810,32 +1040,138 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { ); } - AndroidViewController _initAndroidView( - PlatformViewCreationParams params, { - required bool displayWithHybridComposition, - }) { - if (displayWithHybridComposition) { - return _androidParams.platformViewsServiceProxy.initExpensiveAndroidView( - id: params.id, - viewType: 'plugins.flutter.io/webview', - layoutDirection: _androidParams.layoutDirection, - creationParams: _androidParams.instanceManager.getIdentifier( - (_androidParams.controller as AndroidWebViewController)._webView), - creationParamsCodec: const StandardMessageCodec(), - ); - } else { - return _androidParams.platformViewsServiceProxy.initSurfaceAndroidView( - id: params.id, - viewType: 'plugins.flutter.io/webview', - layoutDirection: _androidParams.layoutDirection, - creationParams: _androidParams.instanceManager.getIdentifier( - (_androidParams.controller as AndroidWebViewController)._webView), - creationParamsCodec: const StandardMessageCodec(), + // Attempt to handle custom views with a default implementation if it has not + // been set. + void _trySetDefaultOnShowCustomWidgetCallbacks(BuildContext context) { + final AndroidWebViewController controller = + _androidParams.controller as AndroidWebViewController; + + if (controller._onShowCustomWidgetCallback == null) { + controller.setCustomWidgetCallbacks( + onShowCustomWidget: + (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, ); } } } +/// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) +/// that is created by the host platform when web content needs to be displayed +/// in fullscreen mode. +/// +/// The [AndroidCustomViewWidget] cannot be manually instantiated and is +/// provided to the host application through the callbacks specified using the +/// [AndroidWebViewController.setCustomWidgetCallbacks] method. +/// +/// The [AndroidCustomViewWidget] is initialized internally and should only be +/// exposed as a [Widget] externally. The type [AndroidCustomViewWidget] is +/// visible for testing purposes only and should never be called externally. +@visibleForTesting +class AndroidCustomViewWidget extends StatelessWidget { + /// Creates a [AndroidCustomViewWidget]. + /// + /// The [AndroidCustomViewWidget] should only be instantiated internally. + /// This constructor is visible for testing purposes only and should + /// never be called externally. + @visibleForTesting + AndroidCustomViewWidget.private({ + super.key, + required this.controller, + required this.customView, + @visibleForTesting InstanceManager? instanceManager, + @visibleForTesting + this.platformViewsServiceProxy = const PlatformViewsServiceProxy(), + }) : instanceManager = + instanceManager ?? android_webview.JavaObject.globalInstanceManager; + + /// The reference to the Android native view that should be shown. + final android_webview.View customView; + + /// The [PlatformWebViewController] that allows controlling the native web + /// view. + final PlatformWebViewController controller; + + /// Maintains instances used to communicate with the native objects they + /// represent. + /// + /// This field is exposed for testing purposes only and should not be used + /// outside of tests. + @visibleForTesting + final InstanceManager instanceManager; + + /// Proxy that provides access to the platform views service. + /// + /// This service allows creating and controlling platform-specific views. + @visibleForTesting + final PlatformViewsServiceProxy platformViewsServiceProxy; + + @override + Widget build(BuildContext context) { + return PlatformViewLink( + key: key, + viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return AndroidViewSurface( + controller: controller as AndroidViewController, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + gestureRecognizers: const >{}, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initAndroidView( + params, + displayWithHybridComposition: false, + platformViewsServiceProxy: platformViewsServiceProxy, + view: customView, + instanceManager: instanceManager, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } +} + +AndroidViewController _initAndroidView( + PlatformViewCreationParams params, { + required bool displayWithHybridComposition, + required PlatformViewsServiceProxy platformViewsServiceProxy, + required android_webview.View view, + required InstanceManager instanceManager, + TextDirection layoutDirection = TextDirection.ltr, +}) { + final int? instanceId = instanceManager.getIdentifier(view); + + if (displayWithHybridComposition) { + return platformViewsServiceProxy.initExpensiveAndroidView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: layoutDirection, + creationParams: instanceId, + creationParamsCodec: const StandardMessageCodec(), + ); + } else { + return platformViewsServiceProxy.initSurfaceAndroidView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: layoutDirection, + creationParams: instanceId, + creationParamsCodec: const StandardMessageCodec(), + ); + } +} + /// Signature for the `loadRequest` callback responsible for loading the [url] /// after a navigation request has been approved. typedef LoadRequestCallback = Future Function(LoadRequestParams params); @@ -1024,6 +1360,31 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { callback(AndroidUrlChange(url: url, isReload: isReload)); } }, + onReceivedHttpAuthRequest: ( + android_webview.WebView webView, + android_webview.HttpAuthHandler httpAuthHandler, + String host, + String realm, + ) { + final void Function(HttpAuthRequest)? callback = + weakThis.target?._onHttpAuthRequest; + if (callback != null) { + callback( + HttpAuthRequest( + onProceed: (WebViewCredential credential) { + httpAuthHandler.proceed(credential.user, credential.password); + }, + onCancel: () { + httpAuthHandler.cancel(); + }, + host: host, + realm: realm, + ), + ); + } else { + httpAuthHandler.cancel(); + } + }, ); _downloadListener = (this.params as AndroidNavigationDelegateCreationParams) @@ -1080,6 +1441,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { NavigationRequestCallback? _onNavigationRequest; LoadRequestCallback? _onLoadRequest; UrlChangeCallback? _onUrlChange; + HttpAuthRequestCallback? _onHttpAuthRequest; void _handleNavigation( String url, { @@ -1166,4 +1528,11 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { Future setOnUrlChange(UrlChangeCallback onUrlChange) async { _onUrlChange = onUrlChange; } + + @override + Future setOnHttpAuthRequest( + HttpAuthRequestCallback onHttpAuthRequest, + ) async { + _onHttpAuthRequest = onHttpAuthRequest; + } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart b/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart index 95f835ed8a1d7be35cc29ab5bd31a1a7e7c263fb..a9297fa43cb1e109c54099236afc7a0b6c4df64a 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -library webview_flutter_android; - export 'src/android_webview_controller.dart'; export 'src/android_webview_cookie_manager.dart'; export 'src/android_webview_platform.dart'; diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 0a43f89e5eac8e8aec997272595b9b3f312d60ec..8f40d9120ce734c0c081ed2e32a385ff978231e8 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -57,6 +57,42 @@ enum FileChooserMode { save, } +/// Indicates the type of message logged to the console. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel. +enum ConsoleMessageLevel { + /// Indicates a message is logged for debugging. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. + debug, + + /// Indicates a message is provided as an error. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. + error, + + /// Indicates a message is provided as a basic log message. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. + log, + + /// Indicates a message is provided as a tip. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. + tip, + + /// Indicates a message is provided as a warning. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. + warning, + + /// Indicates a message with an unknown level. + /// + /// This does not represent an actual value provided by the platform and only + /// indicates a value was provided that isn't currently supported. + unknown, +} + class WebResourceRequestData { WebResourceRequestData( this.url, @@ -89,6 +125,16 @@ class WebViewPoint { int y; } +/// Represents a JavaScript console message from WebCore. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage +class ConsoleMessage { + late int lineNumber; + late String message; + late ConsoleMessageLevel level; + late String sourceId; +} + /// Handles methods calls to the native Java Object class. /// /// Also handles calls to remove the reference to an instance with `dispose`. @@ -222,6 +268,14 @@ abstract class WebViewHostApi { abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); + + void onScrollChanged( + int webViewInstanceId, + int left, + int top, + int oldLeft, + int oldTop, + ); } @HostApi(dartHostTestHandler: 'TestWebSettingsHostApi') @@ -253,6 +307,8 @@ abstract class WebSettingsHostApi { void setAllowFileAccess(int instanceId, bool enabled); void setTextZoom(int instanceId, int textZoom); + + String getUserAgentString(int instanceId); } @HostApi(dartHostTestHandler: 'TestJavaScriptChannelHostApi') @@ -310,6 +366,14 @@ abstract class WebViewClientFlutterApi { String url, bool isReload, ); + + void onReceivedHttpAuthRequest( + int instanceId, + int webViewInstanceId, + int httpAuthHandlerInstanceId, + String host, + String realm, + ); } @HostApi(dartHostTestHandler: 'TestDownloadListenerHostApi') @@ -337,6 +401,26 @@ abstract class WebChromeClientHostApi { int instanceId, bool value, ); + + void setSynchronousReturnValueForOnConsoleMessage( + int instanceId, + bool value, + ); + + void setSynchronousReturnValueForOnJsAlert( + int instanceId, + bool value, + ); + + void setSynchronousReturnValueForOnJsConfirm( + int instanceId, + bool value, + ); + + void setSynchronousReturnValueForOnJsPrompt( + int instanceId, + bool value, + ); } @HostApi(dartHostTestHandler: 'TestAssetManagerHostApi') @@ -360,6 +444,16 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView( + int instanceId, + int viewIdentifier, + int callbackIdentifier, + ); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); + /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. void onGeolocationPermissionsShowPrompt( int instanceId, @@ -369,6 +463,19 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. void onGeolocationPermissionsHidePrompt(int identifier); + + /// Callback to Dart function `WebChromeClient.onConsoleMessage`. + void onConsoleMessage(int instanceId, ConsoleMessage message); + + @async + void onJsAlert(int instanceId, String url, String message); + + @async + bool onJsConfirm(int instanceId, String url, String message); + + @async + String onJsPrompt( + int instanceId, String url, String message, String defaultValue); } @HostApi(dartHostTestHandler: 'TestWebStorageHostApi') @@ -421,6 +528,45 @@ abstract class PermissionRequestFlutterApi { void create(int instanceId, List resources); } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +@HostApi(dartHostTestHandler: 'TestCustomViewCallbackHostApi') +abstract class CustomViewCallbackHostApi { + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + void onCustomViewHidden(int identifier); +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +@FlutterApi() +abstract class CustomViewCallbackFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); +} + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +@FlutterApi() +abstract class ViewFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -446,3 +592,35 @@ abstract class GeolocationPermissionsCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId); } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +@HostApi(dartHostTestHandler: 'TestHttpAuthHandlerHostApi') +abstract class HttpAuthHandlerHostApi { + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + bool useHttpAuthUsernamePassword(int instanceId); + + /// Handles Dart method `HttpAuthHandler.cancel`. + void cancel(int instanceId); + + /// Handles Dart method `HttpAuthHandler.proceed`. + void proceed(int instanceId, String username, String password); +} + +/// Flutter API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +@FlutterApi() +abstract class HttpAuthHandlerFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int instanceId); +} diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 894448491c5a28101f041a21294c306b4e5349e3..3b314f9cf8cae7642eb5dcfafd7784bb0797053d 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.9.5 +version: 3.15.0 environment: sdk: ">=2.19.0 <4.0.0" @@ -20,16 +20,19 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_platform_interface: ^2.4.0 + webview_flutter_platform_interface: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_platform_interface dev_dependencies: build_runner: ^2.1.4 flutter_test: sdk: flutter - mockito: 5.4.1 + mockito: 5.4.4 pigeon: ^11.0.0 topics: - html - webview - - webview-flutter + - webview-flutter \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart index 3f93d46b77058e87d5457ed39f816af9ccf865c5..36681d092164175089cb72fd4a957b549b4fb754 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart @@ -6,6 +6,7 @@ import 'dart:async'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; import 'package:webview_flutter_android/src/android_proxy.dart'; import 'package:webview_flutter_android/src/android_webview.dart' as android_webview; @@ -15,7 +16,10 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'android_navigation_delegate_test.mocks.dart'; import 'test_android_webview.g.dart'; -@GenerateMocks([TestInstanceManagerHostApi]) +@GenerateMocks([ + TestInstanceManagerHostApi, + android_webview.HttpAuthHandler, +]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -446,27 +450,67 @@ void main() { expect(callbackNavigationRequest.url, 'https://www.google.com'); expect(completer.isCompleted, true); }); - }); - test('onUrlChange', () { - final AndroidNavigationDelegate androidNavigationDelegate = - AndroidNavigationDelegate(_buildCreationParams()); - - late final AndroidUrlChange urlChange; - androidNavigationDelegate.setOnUrlChange( - (UrlChange change) { - urlChange = change as AndroidUrlChange; - }, - ); - - CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( - android_webview.WebView.detached(), - 'https://www.google.com', - false, - ); - - expect(urlChange.url, 'https://www.google.com'); - expect(urlChange.isReload, isFalse); + test('onUrlChange', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + late final AndroidUrlChange urlChange; + androidNavigationDelegate.setOnUrlChange( + (UrlChange change) { + urlChange = change as AndroidUrlChange; + }, + ); + + CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( + android_webview.WebView.detached(), + 'https://www.google.com', + false, + ); + + expect(urlChange.url, 'https://www.google.com'); + expect(urlChange.isReload, isFalse); + }); + + test('onReceivedHttpAuthRequest emits host and realm', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + String? callbackHost; + String? callbackRealm; + androidNavigationDelegate.setOnHttpAuthRequest((HttpAuthRequest request) { + callbackHost = request.host; + callbackRealm = request.realm; + }); + + const String expectedHost = 'expectedHost'; + const String expectedRealm = 'expectedRealm'; + + CapturingWebViewClient.lastCreatedDelegate.onReceivedHttpAuthRequest!( + android_webview.WebView.detached(), + android_webview.HttpAuthHandler(), + expectedHost, + expectedRealm, + ); + + expect(callbackHost, expectedHost); + expect(callbackRealm, expectedRealm); + }); + + test('onReceivedHttpAuthRequest calls cancel by default', () { + AndroidNavigationDelegate(_buildCreationParams()); + + final MockHttpAuthHandler mockAuthHandler = MockHttpAuthHandler(); + + CapturingWebViewClient.lastCreatedDelegate.onReceivedHttpAuthRequest!( + android_webview.WebView.detached(), + mockAuthHandler, + 'host', + 'realm', + ); + + verify(mockAuthHandler.cancel()); + }); }); } @@ -489,6 +533,7 @@ class CapturingWebViewClient extends android_webview.WebViewClient { super.onPageFinished, super.onPageStarted, super.onReceivedError, + super.onReceivedHttpAuthRequest, super.onReceivedRequestError, super.requestLoading, super.urlLoading, @@ -517,7 +562,13 @@ class CapturingWebChromeClient extends android_webview.WebChromeClient { super.onShowFileChooser, super.onGeolocationPermissionsShowPrompt, super.onGeolocationPermissionsHidePrompt, + super.onShowCustomView, + super.onHideCustomView, super.onPermissionRequest, + super.onConsoleMessage, + super.onJsAlert, + super.onJsConfirm, + super.onJsPrompt, super.binaryMessenger, super.instanceManager, }) : super.detached() { diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart index aa0bf6569d8da57732ee52325e3d3ab24361a2e4..ee783f3777cf26d66d4d0ccef6cfba333c53aaa4 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart @@ -1,16 +1,21 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/android_navigation_delegate_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i4; + import 'package:mockito/mockito.dart' as _i1; +import 'package:webview_flutter_android/src/android_webview.dart' as _i2; -import 'test_android_webview.g.dart' as _i2; +import 'test_android_webview.g.dart' as _i3; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -18,11 +23,21 @@ import 'test_android_webview.g.dart' as _i2; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +class _FakeJavaObject_0 extends _i1.SmartFake implements _i2.JavaObject { + _FakeJavaObject_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + /// A class which mocks [TestInstanceManagerHostApi]. /// /// See the documentation for Mockito's code generation for more information. class MockTestInstanceManagerHostApi extends _i1.Mock - implements _i2.TestInstanceManagerHostApi { + implements _i3.TestInstanceManagerHostApi { MockTestInstanceManagerHostApi() { _i1.throwOnMissingStub(this); } @@ -36,3 +51,63 @@ class MockTestInstanceManagerHostApi extends _i1.Mock returnValueForMissingStub: null, ); } + +/// A class which mocks [HttpAuthHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockHttpAuthHandler extends _i1.Mock implements _i2.HttpAuthHandler { + MockHttpAuthHandler() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.Future cancel() => (super.noSuchMethod( + Invocation.method( + #cancel, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future proceed( + String? username, + String? password, + ) => + (super.noSuchMethod( + Invocation.method( + #proceed, + [ + username, + password, + ], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future useHttpAuthUsernamePassword() => (super.noSuchMethod( + Invocation.method( + #useHttpAuthUsernamePassword, + [], + ), + returnValue: _i4.Future.value(false), + ) as _i4.Future); + + @override + _i2.JavaObject copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeJavaObject_0( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.JavaObject); +} diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index 2809a40d885ce691037887cd6e4e2a3c454c3279..f912e8d5e64af012df357c5f3423c4eec3ead56f 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -19,7 +19,9 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'android_navigation_delegate_test.dart'; import 'android_webview_controller_test.mocks.dart'; import 'android_webview_test.mocks.dart' - show MockTestGeolocationPermissionsCallbackHostApi; + show + MockTestCustomViewCallbackHostApi, + MockTestGeolocationPermissionsCallbackHostApi; import 'test_android_webview.g.dart'; @GenerateNiceMocks(>[ @@ -65,6 +67,19 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? onHideCustomView, + void Function(android_webview.WebChromeClient instance, + android_webview.ConsoleMessage message)? + onConsoleMessage, + Future Function(String url, String message)? onJsAlert, + Future Function(String url, String message)? onJsConfirm, + Future Function(String url, String message, String defaultValue)? + onJsPrompt, })? createWebChromeClient, android_webview.WebView? mockWebView, android_webview.WebViewClient? mockWebViewClient, @@ -79,27 +94,47 @@ void main() { androidWebStorage: mockWebStorage ?? MockWebStorage(), androidWebViewProxy: AndroidWebViewProxy( createAndroidWebChromeClient: createWebChromeClient ?? - ( - {void Function(android_webview.WebView, int)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( + ({ + void Function(android_webview.WebView, int)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function( + String origin, + android_webview.GeolocationPermissionsCallback callback, + )? onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function( android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function( - String origin, - android_webview.GeolocationPermissionsCallback - callback, - )? onGeolocationPermissionsShowPrompt, - void Function( - android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt}) => + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + void Function(android_webview.WebChromeClient instance, + android_webview.ConsoleMessage message)? + onConsoleMessage, + Future Function(String url, String message)? + onJsAlert, + Future Function(String url, String message)? + onJsConfirm, + Future Function( + String url, String message, String defaultValue)? + onJsPrompt, + }) => MockWebChromeClient(), - createAndroidWebView: () => nonNullMockWebView, + createAndroidWebView: ( + {dynamic Function( + int left, int top, int oldLeft, int oldTop)? + onScrollChanged}) => + nonNullMockWebView, createAndroidWebViewClient: ({ void Function(android_webview.WebView webView, String url)? onPageFinished, @@ -112,6 +147,12 @@ void main() { String description, String failingUrl, )? onReceivedError, + void Function( + android_webview.WebView webView, + android_webview.HttpAuthHandler hander, + String host, + String realm, + )? onReceivedHttpAuthRequest, void Function( android_webview.WebView webView, android_webview.WebResourceRequest request, @@ -590,6 +631,12 @@ void main() { dynamic onGeolocationPermissionsShowPrompt, dynamic onGeolocationPermissionsHidePrompt, dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onConsoleMessage, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, }) { onShowFileChooserCallback = onShowFileChooser!; return mockWebChromeClient; @@ -658,6 +705,12 @@ void main() { void Function(android_webview.WebChromeClient instance)? onGeolocationPermissionsHidePrompt, dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onConsoleMessage, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, }) { onGeoPermissionHandle = onGeolocationPermissionsShowPrompt!; onGeoPermissionHidePromptHandle = onGeolocationPermissionsHidePrompt!; @@ -693,6 +746,82 @@ void main() { expect(testValue, 'changed'); }); + test('setCustomViewCallbacks', () async { + final MockTestCustomViewCallbackHostApi mockApi = + MockTestCustomViewCallbackHostApi(); + TestCustomViewCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final android_webview.CustomViewCallback testCallback = + android_webview.CustomViewCallback.detached( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); + + late final void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback) onShowCustomViewHandle; + late final void Function(android_webview.WebChromeClient instance) + onHideCustomViewHandle; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + dynamic onConsoleMessage, + }) { + onShowCustomViewHandle = onShowCustomView!; + onHideCustomViewHandle = onHideCustomView!; + return mockWebChromeClient; + }, + ); + + final android_webview.View testView = android_webview.View.detached(); + bool showCustomViewCalled = false; + bool hideCustomViewCalled = false; + + await controller.setCustomWidgetCallbacks( + onShowCustomWidget: + (Widget widget, OnHideCustomWidgetCallback callback) async { + showCustomViewCalled = true; + }, + onHideCustomWidget: () { + hideCustomViewCalled = true; + }, + ); + + onShowCustomViewHandle( + mockWebChromeClient, + testView, + android_webview.CustomViewCallback.detached(), + ); + + expect(showCustomViewCalled, true); + + onHideCustomViewHandle(mockWebChromeClient); + expect(hideCustomViewCalled, true); + }); + test('setOnPlatformPermissionRequest', () async { late final void Function( android_webview.WebChromeClient instance, @@ -710,6 +839,12 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onConsoleMessage, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, }) { onPermissionRequestCallback = onPermissionRequest!; return mockWebChromeClient; @@ -762,6 +897,12 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onConsoleMessage, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, }) { onPermissionRequestCallback = onPermissionRequest!; return mockWebChromeClient; @@ -787,6 +928,233 @@ void main() { expect(callbackCalled, isFalse); }); + group('JavaScript Dialog', () { + test('setOnJavaScriptAlertDialog', () async { + late final Future Function(String url, String message) + onJsAlertCallback; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + Future Function(String url, String message)? onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, + dynamic onConsoleMessage, + }) { + onJsAlertCallback = onJsAlert!; + return mockWebChromeClient; + }, + ); + + late final String message; + await controller.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + message = request.message; + return; + }); + + const String callbackMessage = 'Message'; + await onJsAlertCallback('', callbackMessage); + expect(message, callbackMessage); + }); + + test('setOnJavaScriptConfirmDialog', () async { + late final Future Function(String url, String message) + onJsConfirmCallback; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onJsAlert, + Future Function(String url, String message)? onJsConfirm, + dynamic onJsPrompt, + dynamic onConsoleMessage, + }) { + onJsConfirmCallback = onJsConfirm!; + return mockWebChromeClient; + }, + ); + + late final String message; + const bool callbackReturnValue = true; + await controller.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + message = request.message; + return callbackReturnValue; + }); + + const String callbackMessage = 'Message'; + final bool returnValue = await onJsConfirmCallback('', callbackMessage); + + expect(message, callbackMessage); + expect(returnValue, callbackReturnValue); + }); + + test('setOnJavaScriptTextInputDialog', () async { + late final Future Function( + String url, String message, String defaultValue) onJsPromptCallback; + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onJsAlert, + dynamic onJsConfirm, + Future Function( + String url, String message, String defaultText)? + onJsPrompt, + dynamic onConsoleMessage, + }) { + onJsPromptCallback = onJsPrompt!; + return mockWebChromeClient; + }, + ); + + late final String message; + late final String? defaultText; + const String callbackReturnValue = 'Return Value'; + await controller.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + message = request.message; + defaultText = request.defaultText; + return callbackReturnValue; + }); + + const String callbackMessage = 'Message'; + const String callbackDefaultText = 'Default Text'; + + final String returnValue = + await onJsPromptCallback('', callbackMessage, callbackDefaultText); + + expect(message, callbackMessage); + expect(defaultText, callbackDefaultText); + expect(returnValue, callbackReturnValue); + }); + }); + + test('setOnConsoleLogCallback', () async { + late final void Function( + android_webview.WebChromeClient instance, + android_webview.ConsoleMessage message, + ) onConsoleMessageCallback; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, + void Function( + android_webview.WebChromeClient, + android_webview.ConsoleMessage, + )? onConsoleMessage, + }) { + onConsoleMessageCallback = onConsoleMessage!; + return mockWebChromeClient; + }, + ); + + final Map logs = + {}; + await controller.setOnConsoleMessage( + (JavaScriptConsoleMessage message) async { + logs[message.message] = message.level; + }, + ); + + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Debug message', + level: ConsoleMessageLevel.debug, + sourceId: 'source', + ), + ); + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Error message', + level: ConsoleMessageLevel.error, + sourceId: 'source', + ), + ); + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Log message', + level: ConsoleMessageLevel.log, + sourceId: 'source', + ), + ); + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Tip message', + level: ConsoleMessageLevel.tip, + sourceId: 'source', + ), + ); + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Warning message', + level: ConsoleMessageLevel.warning, + sourceId: 'source', + ), + ); + onConsoleMessageCallback( + mockWebChromeClient, + ConsoleMessage( + lineNumber: 42, + message: 'Unknown message', + level: ConsoleMessageLevel.unknown, + sourceId: 'source', + ), + ); + + expect(logs.length, 6); + expect(logs['Debug message'], JavaScriptLogLevel.debug); + expect(logs['Error message'], JavaScriptLogLevel.error); + expect(logs['Log message'], JavaScriptLogLevel.log); + expect(logs['Tip message'], JavaScriptLogLevel.debug); + expect(logs['Warning message'], JavaScriptLogLevel.warning); + expect(logs['Unknown message'], JavaScriptLogLevel.log); + }); + test('runJavaScript', () async { final MockWebView mockWebView = MockWebView(); final AndroidWebViewController controller = createControllerWithMocks( @@ -1056,6 +1424,20 @@ void main() { verify(mockWebView.settings).called(1); verify(mockSettings.setUserAgentString('Test Framework')).called(1); }); + + test('getUserAgent', () async { + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockSettings: mockSettings, + ); + + const String userAgent = 'str'; + + when(mockSettings.getUserAgentString()) + .thenAnswer((_) => Future.value(userAgent)); + + expect(await controller.getUserAgent(), userAgent); + }); }); test('setMediaPlaybackRequiresUserGesture', () async { @@ -1217,6 +1599,80 @@ void main() { ); }); + testWidgets('default handling of custom views', + (WidgetTester tester) async { + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomViewCallback; + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + dynamic onHideCustomView, + dynamic onConsoleMessage, + dynamic onJsAlert, + dynamic onJsConfirm, + dynamic onJsPrompt, + }) { + onShowCustomViewCallback = onShowCustomView; + return mockWebChromeClient; + }, + ); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget( + MaterialApp( + home: Builder( + builder: (BuildContext context) => webViewWidget.build(context), + ), + ), + ); + await tester.pumpAndSettle(); + + onShowCustomViewCallback!( + MockWebChromeClient(), + android_webview.WebView.detached(), + android_webview.CustomViewCallback.detached(), + ); + await tester.pumpAndSettle(); + + expect(find.byType(AndroidCustomViewWidget), findsOneWidget); + }); + testWidgets('PlatformView is recreated when the controller changes', (WidgetTester tester) async { final MockPlatformViewsServiceProxy mockPlatformViewsService = @@ -1346,4 +1802,67 @@ void main() { ); }); }); + + group('AndroidCustomViewWidget', () { + testWidgets('Builds Android custom view using supplied parameters', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + key: const Key('test_custom_view'), + customView: android_webview.View.detached(), + controller: controller, + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + + expect(find.byType(PlatformViewLink), findsOneWidget); + expect(find.byKey(const Key('test_custom_view')), findsOneWidget); + }); + + testWidgets('displayWithHybridComposition should be false', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + }); } diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index f6e7124c4d95f97562c936f7207851b5ccffabb1..a7abc51261db6bc585376a58580616bfa9831b52 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/android_webview_controller_test.dart. // Do not manually edit this file. @@ -9,9 +9,9 @@ import 'dart:ui' as _i4; import 'package:flutter/foundation.dart' as _i11; import 'package:flutter/gestures.dart' as _i12; -import 'package:flutter/material.dart' as _i13; import 'package:flutter/services.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i13; import 'package:webview_flutter_android/src/android_proxy.dart' as _i10; import 'package:webview_flutter_android/src/android_webview.dart' as _i2; import 'package:webview_flutter_android/src/android_webview_controller.dart' @@ -28,6 +28,8 @@ import 'test_android_webview.g.dart' as _i15; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -254,6 +256,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidWebChromeClient), ), ) as _i2.WebChromeClient); + @override _i2.WebViewClient get androidWebViewClient => (super.noSuchMethod( Invocation.getter(#androidWebViewClient), @@ -266,6 +269,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidWebViewClient), ), ) as _i2.WebViewClient); + @override _i2.DownloadListener get androidDownloadListener => (super.noSuchMethod( Invocation.getter(#androidDownloadListener), @@ -278,6 +282,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidDownloadListener), ), ) as _i2.DownloadListener); + @override _i3.PlatformNavigationDelegateCreationParams get params => (super.noSuchMethod( @@ -292,6 +297,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformNavigationDelegateCreationParams); + @override _i9.Future setOnLoadRequest(_i8.LoadRequestCallback? onLoadRequest) => (super.noSuchMethod( @@ -302,6 +308,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnNavigationRequest( _i3.NavigationRequestCallback? onNavigationRequest) => @@ -313,6 +320,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( @@ -323,6 +331,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( @@ -333,6 +342,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( @@ -343,6 +353,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnWebResourceError( _i3.WebResourceErrorCallback? onWebResourceError) => @@ -354,6 +365,7 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( @@ -364,6 +376,19 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + + @override + _i9.Future setOnHttpAuthRequest( + _i3.HttpAuthRequestCallback? onHttpAuthRequest) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override _i9.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( @@ -387,6 +412,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), @@ -400,6 +426,7 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformWebViewControllerCreationParams); + @override _i9.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -409,6 +436,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -418,6 +446,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadHtmlString( String? html, { @@ -432,6 +461,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( @@ -442,6 +472,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -451,6 +482,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -460,6 +492,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -469,6 +502,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -478,6 +512,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -487,6 +522,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future reload() => (super.noSuchMethod( Invocation.method( @@ -496,6 +532,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -505,6 +542,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -514,6 +552,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setPlatformNavigationDelegate( _i3.PlatformNavigationDelegate? handler) => @@ -525,6 +564,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -534,6 +574,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -556,6 +597,7 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i9.Future); + @override _i9.Future addJavaScriptChannel( _i3.JavaScriptChannelParams? javaScriptChannelParams) => @@ -567,6 +609,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -577,6 +620,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -586,6 +630,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollTo( int? x, @@ -602,6 +647,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollBy( int? x, @@ -618,6 +664,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -639,6 +686,7 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Offset>); + @override _i9.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -648,6 +696,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -657,6 +706,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -667,6 +717,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -676,6 +727,19 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + + @override + _i9.Future setOnScrollPositionChange( + void Function(_i3.ScrollPositionChange)? onScrollPositionChange) => + (super.noSuchMethod( + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -686,6 +750,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -695,6 +760,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnShowFileSelector( _i9.Future> Function(_i8.FileSelectorParams)? @@ -707,6 +773,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setOnPlatformPermissionRequest( void Function(_i3.PlatformWebViewPermissionRequest)? @@ -719,6 +786,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setGeolocationPermissionsPromptCallbacks({ _i8.OnGeolocationPermissionsShowPrompt? onShowPrompt, @@ -736,6 +804,85 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + + @override + _i9.Future setCustomWidgetCallbacks({ + required _i8.OnShowCustomWidgetCallback? onShowCustomWidget, + required _i8.OnHideCustomWidgetCallback? onHideCustomWidget, + }) => + (super.noSuchMethod( + Invocation.method( + #setCustomWidgetCallbacks, + [], + { + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, + }, + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future setOnConsoleMessage( + void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => + (super.noSuchMethod( + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future getUserAgent() => (super.noSuchMethod( + Invocation.method( + #getUserAgent, + [], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future setOnJavaScriptAlertDialog( + _i9.Future Function(_i3.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future setOnJavaScriptConfirmDialog( + _i9.Future Function(_i3.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future setOnJavaScriptTextInputDialog( + _i9.Future Function(_i3.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewProxy]. @@ -744,24 +891,69 @@ class MockAndroidWebViewController extends _i1.Mock class MockAndroidWebViewProxy extends _i1.Mock implements _i10.AndroidWebViewProxy { @override - _i2.WebView Function() get createAndroidWebView => (super.noSuchMethod( + _i2.WebView Function( + {dynamic Function( + int, + int, + int, + int, + )? onScrollChanged}) get createAndroidWebView => (super.noSuchMethod( Invocation.getter(#createAndroidWebView), - returnValue: () => _FakeWebView_7( + returnValue: ( + {dynamic Function( + int, + int, + int, + int, + )? onScrollChanged}) => + _FakeWebView_7( this, Invocation.getter(#createAndroidWebView), ), - returnValueForMissingStub: () => _FakeWebView_7( + returnValueForMissingStub: ( + {dynamic Function( + int, + int, + int, + int, + )? onScrollChanged}) => + _FakeWebView_7( this, Invocation.getter(#createAndroidWebView), ), - ) as _i2.WebView Function()); + ) as _i2.WebView Function( + {dynamic Function( + int, + int, + int, + int, + )? onScrollChanged})); + @override _i2.WebChromeClient Function({ + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, _i9.Future Function( String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, + _i9.Future Function( + String, + String, + )? onJsAlert, + _i9.Future Function( + String, + String, + )? onJsConfirm, + _i9.Future Function( + String, + String, + String, + )? onJsPrompt, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -770,6 +962,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -777,12 +974,30 @@ class MockAndroidWebViewProxy extends _i1.Mock }) get createAndroidWebChromeClient => (super.noSuchMethod( Invocation.getter(#createAndroidWebChromeClient), returnValue: ({ + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, _i9.Future Function( String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, + _i9.Future Function( + String, + String, + )? onJsAlert, + _i9.Future Function( + String, + String, + )? onJsConfirm, + _i9.Future Function( + String, + String, + String, + )? onJsPrompt, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -791,6 +1006,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -801,12 +1021,30 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createAndroidWebChromeClient), ), returnValueForMissingStub: ({ + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, _i9.Future Function( String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, + _i9.Future Function( + String, + String, + )? onJsAlert, + _i9.Future Function( + String, + String, + )? onJsConfirm, + _i9.Future Function( + String, + String, + String, + )? onJsPrompt, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -815,6 +1053,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -825,11 +1068,29 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createAndroidWebChromeClient), ), ) as _i2.WebChromeClient Function({ + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, _i9.Future Function( String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, + _i9.Future Function( + String, + String, + )? onJsAlert, + _i9.Future Function( + String, + String, + )? onJsConfirm, + _i9.Future Function( + String, + String, + String, + )? onJsPrompt, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -838,11 +1099,17 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, )? onShowFileChooser, })); + @override _i2.WebViewClient Function({ void Function( @@ -864,6 +1131,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -899,6 +1172,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -937,6 +1216,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -975,6 +1260,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -989,6 +1280,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, )? urlLoading, })); + @override _i2.FlutterAssetManager Function() get createFlutterAssetManager => (super.noSuchMethod( @@ -1002,6 +1294,7 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createFlutterAssetManager), ), ) as _i2.FlutterAssetManager Function()); + @override _i2.JavaScriptChannel Function( String, { @@ -1028,6 +1321,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, { required void Function(String) postMessage, })); + @override _i2.DownloadListener Function( {required void Function( @@ -1070,6 +1364,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, int, ) onDownloadStart})); + @override _i9.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( @@ -1100,6 +1395,7 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#instanceManager), ), ) as _i5.InstanceManager); + @override _i6.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( @@ -1113,12 +1409,14 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#platformViewsServiceProxy), ), ) as _i6.PlatformViewsServiceProxy); + @override bool get displayWithHybridComposition => (super.noSuchMethod( Invocation.getter(#displayWithHybridComposition), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i3.PlatformWebViewController get controller => (super.noSuchMethod( Invocation.getter(#controller), @@ -1131,12 +1429,14 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#controller), ), ) as _i3.PlatformWebViewController); + @override _i4.TextDirection get layoutDirection => (super.noSuchMethod( Invocation.getter(#layoutDirection), returnValue: _i4.TextDirection.rtl, returnValueForMissingStub: _i4.TextDirection.rtl, ) as _i4.TextDirection); + @override Set<_i11.Factory<_i12.OneSequenceGestureRecognizer>> get gestureRecognizers => (super.noSuchMethod( @@ -1158,18 +1458,21 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); + @override int get viewId => (super.noSuchMethod( Invocation.getter(#viewId), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override bool get awaitingCreation => (super.noSuchMethod( Invocation.getter(#awaitingCreation), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i7.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), @@ -1182,6 +1485,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock Invocation.getter(#pointTransformer), ), ) as _i7.PointTransformer); + @override set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( Invocation.setter( @@ -1190,12 +1494,14 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override List<_i7.PlatformViewCreatedCallback> get createdCallbacks => (super.noSuchMethod( @@ -1203,6 +1509,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: <_i7.PlatformViewCreatedCallback>[], returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], ) as List<_i7.PlatformViewCreatedCallback>); + @override _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( Invocation.method( @@ -1212,6 +1519,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future create({ _i4.Size? size, @@ -1229,6 +1537,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( Invocation.method( @@ -1250,6 +1559,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Size>); + @override _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => (super.noSuchMethod( @@ -1260,6 +1570,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override void addOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1270,6 +1581,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1280,6 +1592,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( @@ -1290,8 +1603,9 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override - _i9.Future dispatchPointerEvent(_i13.PointerEvent? event) => + _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -1300,6 +1614,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearFocus() => (super.noSuchMethod( Invocation.method( @@ -1309,6 +1624,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future dispose() => (super.noSuchMethod( Invocation.method( @@ -1334,6 +1650,7 @@ class MockFlutterAssetManager extends _i1.Mock returnValue: _i9.Future>.value([]), returnValueForMissingStub: _i9.Future>.value([]), ) as _i9.Future>); + @override _i9.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( @@ -1341,8 +1658,21 @@ class MockFlutterAssetManager extends _i1.Mock #getAssetFilePathByName, [name], ), - returnValue: _i9.Future.value(''), - returnValueForMissingStub: _i9.Future.value(''), + returnValue: _i9.Future.value(_i13.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + )), + returnValueForMissingStub: + _i9.Future.value(_i13.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + )), ) as _i9.Future); } @@ -1353,15 +1683,23 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), - returnValue: '', - returnValueForMissingStub: '', + returnValue: _i13.dummyValue( + this, + Invocation.getter(#channelName), + ), + returnValueForMissingStub: _i13.dummyValue( + this, + Invocation.getter(#channelName), + ), ) as String); + @override void Function(String) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), returnValue: (String message) {}, returnValueForMissingStub: (String message) {}, ) as void Function(String)); + @override _i2.JavaScriptChannel copy() => (super.noSuchMethod( Invocation.method( @@ -1395,6 +1733,7 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: [], returnValueForMissingStub: [], ) as List); + @override _i9.Future grant(List? resources) => (super.noSuchMethod( Invocation.method( @@ -1404,6 +1743,7 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future deny() => (super.noSuchMethod( Invocation.method( @@ -1413,6 +1753,7 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i2.PermissionRequest copy() => (super.noSuchMethod( Invocation.method( @@ -1495,6 +1836,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock ), ), ) as _i7.ExpensiveAndroidViewController); + @override _i7.SurfaceAndroidViewController initSurfaceAndroidView({ required int? id, @@ -1561,18 +1903,21 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); + @override int get viewId => (super.noSuchMethod( Invocation.getter(#viewId), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override bool get awaitingCreation => (super.noSuchMethod( Invocation.getter(#awaitingCreation), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i7.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), @@ -1585,6 +1930,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock Invocation.getter(#pointTransformer), ), ) as _i7.PointTransformer); + @override set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( Invocation.setter( @@ -1593,12 +1939,14 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override List<_i7.PlatformViewCreatedCallback> get createdCallbacks => (super.noSuchMethod( @@ -1606,6 +1954,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: <_i7.PlatformViewCreatedCallback>[], returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], ) as List<_i7.PlatformViewCreatedCallback>); + @override _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( Invocation.method( @@ -1615,6 +1964,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future create({ _i4.Size? size, @@ -1632,6 +1982,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( Invocation.method( @@ -1653,6 +2004,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Size>); + @override _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => (super.noSuchMethod( @@ -1663,6 +2015,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override void addOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1673,6 +2026,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1683,6 +2037,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( @@ -1693,8 +2048,9 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override - _i9.Future dispatchPointerEvent(_i13.PointerEvent? event) => + _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -1703,6 +2059,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearFocus() => (super.noSuchMethod( Invocation.method( @@ -1712,6 +2069,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future dispose() => (super.noSuchMethod( Invocation.method( @@ -1737,6 +2095,48 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + + @override + _i9.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [value], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + + @override + _i9.Future setSynchronousReturnValueForOnJsAlert(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [value], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future setSynchronousReturnValueForOnJsConfirm(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [value], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future setSynchronousReturnValueForOnJsPrompt(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [value], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -1773,6 +2173,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( @@ -1783,6 +2184,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( @@ -1793,6 +2195,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( @@ -1802,6 +2205,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( @@ -1812,6 +2216,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -1822,6 +2227,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setSupportZoom(bool? support) => (super.noSuchMethod( Invocation.method( @@ -1831,6 +2237,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( @@ -1841,6 +2248,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( Invocation.method( @@ -1850,6 +2258,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -1859,6 +2268,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -1868,6 +2278,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -1877,6 +2288,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -1886,6 +2298,30 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + + @override + _i9.Future getUserAgentString() => (super.noSuchMethod( + Invocation.method( + #getUserAgentString, + [], + ), + returnValue: _i9.Future.value(_i13.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], + ), + )), + returnValueForMissingStub: + _i9.Future.value(_i13.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], + ), + )), + ) as _i9.Future); + @override _i2.WebSettings copy() => (super.noSuchMethod( Invocation.method( @@ -1925,6 +2361,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); + @override _i9.Future loadData({ required String? data, @@ -1944,6 +2381,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadDataWithBaseUrl({ String? baseUrl, @@ -1967,6 +2405,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future loadUrl( String? url, @@ -1983,6 +2422,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future postUrl( String? url, @@ -1999,6 +2439,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -2008,6 +2449,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -2017,6 +2459,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -2026,6 +2469,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); + @override _i9.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -2035,6 +2479,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -2044,6 +2489,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future reload() => (super.noSuchMethod( Invocation.method( @@ -2053,6 +2499,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -2062,6 +2509,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -2072,6 +2520,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -2081,6 +2530,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollTo( int? x, @@ -2097,6 +2547,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future scrollBy( int? x, @@ -2113,6 +2564,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -2122,6 +2574,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(0), returnValueForMissingStub: _i9.Future.value(0), ) as _i9.Future); + @override _i9.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -2131,6 +2584,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(0), returnValueForMissingStub: _i9.Future.value(0), ) as _i9.Future); + @override _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -2152,6 +2606,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i9.Future<_i4.Offset>); + @override _i9.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -2162,6 +2617,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -2173,6 +2629,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -2184,6 +2641,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -2194,6 +2652,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -2204,6 +2663,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -2213,6 +2673,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -2251,6 +2712,7 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( @@ -2287,6 +2749,7 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override _i2.WebStorage copy() => (super.noSuchMethod( Invocation.method( @@ -2320,6 +2783,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { returnValue: (int __p0) {}, returnValueForMissingStub: (int __p0) {}, ) as void Function(int)); + @override set onWeakReferenceRemoved(void Function(int)? _onWeakReferenceRemoved) => super.noSuchMethod( @@ -2329,6 +2793,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ); + @override int addDartCreatedInstance(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2338,6 +2803,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override int? removeWeakReference(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2346,6 +2812,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as int?); + @override T? remove(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -2354,6 +2821,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as T?); + @override T? getInstanceWithWeakReference(int? identifier) => (super.noSuchMethod( @@ -2363,6 +2831,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as T?); + @override int? getIdentifier(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2371,6 +2840,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as int?); + @override void addHostCreatedInstance( _i5.Copyable? instance, @@ -2386,6 +2856,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ); + @override bool containsIdentifier(int? identifier) => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index ee0b48188ef60620e527612fd5d54f25339a57d2..ee5e848858fedcb7d7d5f60c8cea105265860d85 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/android_webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -19,6 +19,8 @@ import 'test_android_webview.g.dart' as _i7; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -91,6 +93,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeAllCookies() => (super.noSuchMethod( Invocation.method( @@ -99,6 +102,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future setAcceptThirdPartyCookies( _i2.WebView? webView, @@ -115,6 +119,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.CookieManager copy() => (super.noSuchMethod( Invocation.method( @@ -145,6 +150,7 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#webViewIdentifier), returnValue: 0, ) as int); + @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), @@ -153,6 +159,7 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformWebViewControllerCreationParams); + @override _i5.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -162,6 +169,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -171,6 +179,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadHtmlString( String? html, { @@ -185,6 +194,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( @@ -195,6 +205,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -203,6 +214,7 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -211,6 +223,7 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -219,6 +232,7 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -228,6 +242,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -237,6 +252,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -246,6 +262,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -255,6 +272,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -264,6 +282,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setPlatformNavigationDelegate( _i3.PlatformNavigationDelegate? handler) => @@ -275,6 +294,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -284,6 +304,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -299,6 +320,7 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i5.Future); + @override _i5.Future addJavaScriptChannel( _i3.JavaScriptChannelParams? javaScriptChannelParams) => @@ -310,6 +332,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -320,6 +343,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -328,6 +352,7 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollTo( int? x, @@ -344,6 +369,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollBy( int? x, @@ -360,6 +386,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -374,6 +401,7 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i5.Future<_i4.Offset>); + @override _i5.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -383,6 +411,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -392,6 +421,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -402,6 +432,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -411,6 +442,19 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setOnScrollPositionChange( + void Function(_i3.ScrollPositionChange)? onScrollPositionChange) => + (super.noSuchMethod( + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -421,6 +465,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -430,6 +475,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnShowFileSelector( _i5.Future> Function(_i6.FileSelectorParams)? @@ -442,6 +488,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOnPlatformPermissionRequest( void Function(_i3.PlatformWebViewPermissionRequest)? @@ -454,6 +501,7 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setGeolocationPermissionsPromptCallbacks({ _i6.OnGeolocationPermissionsShowPrompt? onShowPrompt, @@ -471,6 +519,84 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setCustomWidgetCallbacks({ + required _i6.OnShowCustomWidgetCallback? onShowCustomWidget, + required _i6.OnHideCustomWidgetCallback? onHideCustomWidget, + }) => + (super.noSuchMethod( + Invocation.method( + #setCustomWidgetCallbacks, + [], + { + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, + }, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnConsoleMessage( + void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => + (super.noSuchMethod( + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getUserAgent() => (super.noSuchMethod( + Invocation.method( + #getUserAgent, + [], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptAlertDialog( + _i5.Future Function(_i3.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptConfirmDialog( + _i5.Future Function(_i3.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOnJavaScriptTextInputDialog( + _i5.Future Function(_i3.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => + (super.noSuchMethod( + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [TestInstanceManagerHostApi]. diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart index 194f1b17e587ffc3c1acc8e620b7ca568920c9e9..d542c498772c2b9b101dd392e3fcb8add65919c1 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart @@ -18,6 +18,7 @@ import 'test_android_webview.g.dart'; DownloadListener, JavaScriptChannel, TestCookieManagerHostApi, + TestCustomViewCallbackHostApi, TestDownloadListenerHostApi, TestGeolocationPermissionsCallbackHostApi, TestInstanceManagerHostApi, @@ -527,6 +528,13 @@ void main() { 100, )); }); + + test('getUserAgentString', () async { + const String userAgent = 'str'; + when(mockPlatformHostApi.getUserAgentString(webSettingsInstanceId)) + .thenReturn(userAgent); + expect(await webSettings.getUserAgentString(), userAgent); + }); }); group('JavaScriptChannel', () { @@ -1037,6 +1045,163 @@ void main() { expect(callbackParameters, [instance, request]); }); + test('onShowCustomView', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const int instanceIdentifier = 0; + late final List callbackParameters; + final WebChromeClient instance = WebChromeClient.detached( + onShowCustomView: ( + WebChromeClient instance, + View view, + CustomViewCallback callback, + ) { + callbackParameters = [ + instance, + view, + callback, + ]; + }, + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + final WebChromeClientFlutterApiImpl flutterApi = + WebChromeClientFlutterApiImpl( + instanceManager: instanceManager, + ); + + final View view = View.detached( + instanceManager: instanceManager, + ); + const int viewIdentifier = 50; + instanceManager.addHostCreatedInstance(view, viewIdentifier); + + final CustomViewCallback callback = CustomViewCallback.detached( + instanceManager: instanceManager, + ); + const int callbackIdentifier = 51; + instanceManager.addHostCreatedInstance(callback, callbackIdentifier); + + flutterApi.onShowCustomView( + instanceIdentifier, + viewIdentifier, + callbackIdentifier, + ); + + expect(callbackParameters, [ + instance, + view, + callback, + ]); + }); + + test('onHideCustomView', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const int instanceIdentifier = 0; + late final List callbackParameters; + final WebChromeClient instance = WebChromeClient.detached( + onHideCustomView: ( + WebChromeClient instance, + ) { + callbackParameters = [ + instance, + ]; + }, + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + final WebChromeClientFlutterApiImpl flutterApi = + WebChromeClientFlutterApiImpl( + instanceManager: instanceManager, + ); + + flutterApi.onHideCustomView(instanceIdentifier); + + expect(callbackParameters, [instance]); + }); + + test('onConsoleMessage', () async { + late final List result; + when(mockWebChromeClient.onConsoleMessage).thenReturn( + (WebChromeClient instance, ConsoleMessage message) { + result = [instance, message]; + }, + ); + + final ConsoleMessage message = ConsoleMessage( + lineNumber: 0, + message: 'message', + level: ConsoleMessageLevel.error, + sourceId: 'sourceId', + ); + + flutterApi.onConsoleMessage( + mockWebChromeClientInstanceId, + message, + ); + expect(result[0], mockWebChromeClient); + expect(result[1], message); + }); + + test('setSynchronousReturnValueForOnConsoleMessage', () { + final MockTestWebChromeClientHostApi mockHostApi = + MockTestWebChromeClientHostApi(); + TestWebChromeClientHostApi.setup(mockHostApi); + + WebChromeClient.api = + WebChromeClientHostApiImpl(instanceManager: instanceManager); + + final WebChromeClient webChromeClient = WebChromeClient.detached(); + instanceManager.addHostCreatedInstance(webChromeClient, 2); + + webChromeClient.setSynchronousReturnValueForOnConsoleMessage(false); + + verify( + mockHostApi.setSynchronousReturnValueForOnConsoleMessage(2, false), + ); + }); + + test( + 'setSynchronousReturnValueForOnConsoleMessage throws StateError when onConsoleMessage is null', + () { + final MockTestWebChromeClientHostApi mockHostApi = + MockTestWebChromeClientHostApi(); + TestWebChromeClientHostApi.setup(mockHostApi); + + WebChromeClient.api = + WebChromeClientHostApiImpl(instanceManager: instanceManager); + + final WebChromeClient clientWithNullCallback = + WebChromeClient.detached(); + instanceManager.addHostCreatedInstance(clientWithNullCallback, 2); + + expect( + () => clientWithNullCallback + .setSynchronousReturnValueForOnConsoleMessage(true), + throwsStateError, + ); + + final WebChromeClient clientWithNonnullCallback = + WebChromeClient.detached( + onConsoleMessage: (_, __) async {}, + ); + instanceManager.addHostCreatedInstance(clientWithNonnullCallback, 3); + + clientWithNonnullCallback + .setSynchronousReturnValueForOnConsoleMessage(true); + + verify( + mockHostApi.setSynchronousReturnValueForOnConsoleMessage(3, true), + ); + }); + test('copy', () { expect(WebChromeClient.detached().copy(), isA()); }); @@ -1096,6 +1261,73 @@ void main() { expect(instance.mode, FileChooserMode.openMultiple); expect(instance.filenameHint, 'filenameHint'); }); + + group('CustomViewCallback', () { + tearDown(() { + TestCustomViewCallbackHostApi.setup(null); + }); + + test('onCustomViewHidden', () async { + final MockTestCustomViewCallbackHostApi mockApi = + MockTestCustomViewCallbackHostApi(); + TestCustomViewCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final CustomViewCallback instance = CustomViewCallback.detached( + instanceManager: instanceManager, + ); + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + await instance.onCustomViewHidden(); + + verify(mockApi.onCustomViewHidden(instanceIdentifier)); + }); + + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final CustomViewCallbackFlutterApiImpl api = + CustomViewCallbackFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + api.create(instanceIdentifier); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); + + group('View', () { + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final ViewFlutterApiImpl api = ViewFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + api.create(instanceIdentifier); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); }); group('CookieManager', () { diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart index a7f825fa16c8a75321391bb4687d7a6d4842a935..4a9ced6a07b861ccc91635b4833e93172f3841b5 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart @@ -1,22 +1,25 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/android_webview_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:typed_data' as _i7; +import 'dart:typed_data' as _i8; import 'dart:ui' as _i4; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:webview_flutter_android/src/android_webview.dart' as _i2; import 'package:webview_flutter_android/src/android_webview.g.dart' as _i3; -import 'test_android_webview.g.dart' as _i6; +import 'test_android_webview.g.dart' as _i7; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -126,6 +129,7 @@ class MockCookieManagerHostApi extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setCookie( int? arg_identifier, @@ -144,6 +148,7 @@ class MockCookieManagerHostApi extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeAllCookies(int? arg_identifier) => (super.noSuchMethod( Invocation.method( @@ -152,6 +157,7 @@ class MockCookieManagerHostApi extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future setAcceptThirdPartyCookies( int? arg_identifier, @@ -203,6 +209,7 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { String, int, )); + @override _i2.DownloadListener copy() => (super.noSuchMethod( Invocation.method( @@ -230,13 +237,18 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#channelName), + ), ) as String); + @override void Function(String) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), returnValue: (String message) {}, ) as void Function(String)); + @override _i2.JavaScriptChannel copy() => (super.noSuchMethod( Invocation.method( @@ -257,7 +269,7 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { /// /// See the documentation for Mockito's code generation for more information. class MockTestCookieManagerHostApi extends _i1.Mock - implements _i6.TestCookieManagerHostApi { + implements _i7.TestCookieManagerHostApi { MockTestCookieManagerHostApi() { _i1.throwOnMissingStub(this); } @@ -270,6 +282,7 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setCookie( int? identifier, @@ -287,6 +300,7 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i5.Future removeAllCookies(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -295,6 +309,7 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override void setAcceptThirdPartyCookies( int? identifier, @@ -314,11 +329,30 @@ class MockTestCookieManagerHostApi extends _i1.Mock ); } +/// A class which mocks [TestCustomViewCallbackHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestCustomViewCallbackHostApi extends _i1.Mock + implements _i7.TestCustomViewCallbackHostApi { + MockTestCustomViewCallbackHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void onCustomViewHidden(int? identifier) => super.noSuchMethod( + Invocation.method( + #onCustomViewHidden, + [identifier], + ), + returnValueForMissingStub: null, + ); +} + /// A class which mocks [TestDownloadListenerHostApi]. /// /// See the documentation for Mockito's code generation for more information. class MockTestDownloadListenerHostApi extends _i1.Mock - implements _i6.TestDownloadListenerHostApi { + implements _i7.TestDownloadListenerHostApi { MockTestDownloadListenerHostApi() { _i1.throwOnMissingStub(this); } @@ -337,7 +371,7 @@ class MockTestDownloadListenerHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestGeolocationPermissionsCallbackHostApi extends _i1.Mock - implements _i6.TestGeolocationPermissionsCallbackHostApi { + implements _i7.TestGeolocationPermissionsCallbackHostApi { MockTestGeolocationPermissionsCallbackHostApi() { _i1.throwOnMissingStub(this); } @@ -367,7 +401,7 @@ class MockTestGeolocationPermissionsCallbackHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestInstanceManagerHostApi extends _i1.Mock - implements _i6.TestInstanceManagerHostApi { + implements _i7.TestInstanceManagerHostApi { MockTestInstanceManagerHostApi() { _i1.throwOnMissingStub(this); } @@ -386,7 +420,7 @@ class MockTestInstanceManagerHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestJavaObjectHostApi extends _i1.Mock - implements _i6.TestJavaObjectHostApi { + implements _i7.TestJavaObjectHostApi { MockTestJavaObjectHostApi() { _i1.throwOnMissingStub(this); } @@ -405,7 +439,7 @@ class MockTestJavaObjectHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestJavaScriptChannelHostApi extends _i1.Mock - implements _i6.TestJavaScriptChannelHostApi { + implements _i7.TestJavaScriptChannelHostApi { MockTestJavaScriptChannelHostApi() { _i1.throwOnMissingStub(this); } @@ -431,7 +465,7 @@ class MockTestJavaScriptChannelHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestWebChromeClientHostApi extends _i1.Mock - implements _i6.TestWebChromeClientHostApi { + implements _i7.TestWebChromeClientHostApi { MockTestWebChromeClientHostApi() { _i1.throwOnMissingStub(this); } @@ -444,6 +478,7 @@ class MockTestWebChromeClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setSynchronousReturnValueForOnShowFileChooser( int? instanceId, @@ -459,13 +494,74 @@ class MockTestWebChromeClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + + @override + void setSynchronousReturnValueForOnConsoleMessage( + int? instanceId, + bool? value, + ) => + super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [ + instanceId, + value, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setSynchronousReturnValueForOnJsAlert( + int? instanceId, + bool? value, + ) => + super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [ + instanceId, + value, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setSynchronousReturnValueForOnJsConfirm( + int? instanceId, + bool? value, + ) => + super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [ + instanceId, + value, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setSynchronousReturnValueForOnJsPrompt( + int? instanceId, + bool? value, + ) => + super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [ + instanceId, + value, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebSettingsHostApi]. /// /// See the documentation for Mockito's code generation for more information. class MockTestWebSettingsHostApi extends _i1.Mock - implements _i6.TestWebSettingsHostApi { + implements _i7.TestWebSettingsHostApi { MockTestWebSettingsHostApi() { _i1.throwOnMissingStub(this); } @@ -485,6 +581,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setDomStorageEnabled( int? instanceId, @@ -500,6 +597,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setJavaScriptCanOpenWindowsAutomatically( int? instanceId, @@ -515,6 +613,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setSupportMultipleWindows( int? instanceId, @@ -530,6 +629,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setJavaScriptEnabled( int? instanceId, @@ -545,6 +645,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setUserAgentString( int? instanceId, @@ -560,6 +661,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setMediaPlaybackRequiresUserGesture( int? instanceId, @@ -575,6 +677,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setSupportZoom( int? instanceId, @@ -590,6 +693,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setLoadWithOverviewMode( int? instanceId, @@ -605,6 +709,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setUseWideViewPort( int? instanceId, @@ -620,6 +725,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setDisplayZoomControls( int? instanceId, @@ -635,6 +741,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setBuiltInZoomControls( int? instanceId, @@ -650,6 +757,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setAllowFileAccess( int? instanceId, @@ -665,6 +773,7 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setTextZoom( int? instanceId, @@ -680,13 +789,28 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + + @override + String getUserAgentString(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #getUserAgentString, + [instanceId], + ), + returnValue: _i6.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [instanceId], + ), + ), + ) as String); } /// A class which mocks [TestWebStorageHostApi]. /// /// See the documentation for Mockito's code generation for more information. class MockTestWebStorageHostApi extends _i1.Mock - implements _i6.TestWebStorageHostApi { + implements _i7.TestWebStorageHostApi { MockTestWebStorageHostApi() { _i1.throwOnMissingStub(this); } @@ -699,6 +823,7 @@ class MockTestWebStorageHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void deleteAllData(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -713,7 +838,7 @@ class MockTestWebStorageHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestWebViewClientHostApi extends _i1.Mock - implements _i6.TestWebViewClientHostApi { + implements _i7.TestWebViewClientHostApi { MockTestWebViewClientHostApi() { _i1.throwOnMissingStub(this); } @@ -726,6 +851,7 @@ class MockTestWebViewClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setSynchronousReturnValueForShouldOverrideUrlLoading( int? instanceId, @@ -747,7 +873,7 @@ class MockTestWebViewClientHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestWebViewHostApi extends _i1.Mock - implements _i6.TestWebViewHostApi { + implements _i7.TestWebViewHostApi { MockTestWebViewHostApi() { _i1.throwOnMissingStub(this); } @@ -760,6 +886,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadData( int? instanceId, @@ -779,6 +906,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadDataWithBaseUrl( int? instanceId, @@ -802,6 +930,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadUrl( int? instanceId, @@ -819,11 +948,12 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void postUrl( int? instanceId, String? url, - _i7.Uint8List? data, + _i8.Uint8List? data, ) => super.noSuchMethod( Invocation.method( @@ -836,11 +966,13 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override String? getUrl(int? instanceId) => (super.noSuchMethod(Invocation.method( #getUrl, [instanceId], )) as String?); + @override bool canGoBack(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -849,6 +981,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override bool canGoForward(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -857,6 +990,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override void goBack(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -865,6 +999,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void goForward(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -873,6 +1008,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void reload(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -881,6 +1017,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void clearCache( int? instanceId, @@ -896,6 +1033,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i5.Future evaluateJavascript( int? instanceId, @@ -911,11 +1049,13 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override String? getTitle(int? instanceId) => (super.noSuchMethod(Invocation.method( #getTitle, [instanceId], )) as String?); + @override void scrollTo( int? instanceId, @@ -933,6 +1073,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void scrollBy( int? instanceId, @@ -950,6 +1091,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override int getScrollX(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -958,6 +1100,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getScrollY(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -966,6 +1109,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override _i3.WebViewPoint getScrollPosition(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -980,6 +1124,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), ), ) as _i3.WebViewPoint); + @override void setWebContentsDebuggingEnabled(bool? enabled) => super.noSuchMethod( Invocation.method( @@ -988,6 +1133,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setWebViewClient( int? instanceId, @@ -1003,6 +1149,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void addJavaScriptChannel( int? instanceId, @@ -1018,6 +1165,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeJavaScriptChannel( int? instanceId, @@ -1033,6 +1181,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setDownloadListener( int? instanceId, @@ -1048,6 +1197,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setWebChromeClient( int? instanceId, @@ -1063,6 +1213,7 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setBackgroundColor( int? instanceId, @@ -1084,7 +1235,7 @@ class MockTestWebViewHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestAssetManagerHostApi extends _i1.Mock - implements _i6.TestAssetManagerHostApi { + implements _i7.TestAssetManagerHostApi { MockTestAssetManagerHostApi() { _i1.throwOnMissingStub(this); } @@ -1097,13 +1248,20 @@ class MockTestAssetManagerHostApi extends _i1.Mock ), returnValue: [], ) as List); + @override String getAssetFilePathByName(String? name) => (super.noSuchMethod( Invocation.method( #getAssetFilePathByName, [name], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + ), ) as String); } @@ -1111,7 +1269,7 @@ class MockTestAssetManagerHostApi extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockTestPermissionRequestHostApi extends _i1.Mock - implements _i6.TestPermissionRequestHostApi { + implements _i7.TestPermissionRequestHostApi { MockTestPermissionRequestHostApi() { _i1.throwOnMissingStub(this); } @@ -1131,6 +1289,7 @@ class MockTestPermissionRequestHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void deny(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -1159,6 +1318,48 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setSynchronousReturnValueForOnJsAlert(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future setSynchronousReturnValueForOnJsConfirm(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future setSynchronousReturnValueForOnJsPrompt(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -1191,6 +1392,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); + @override _i5.Future loadData({ required String? data, @@ -1210,6 +1412,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadDataWithBaseUrl({ String? baseUrl, @@ -1233,6 +1436,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadUrl( String? url, @@ -1249,10 +1453,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future postUrl( String? url, - _i7.Uint8List? data, + _i8.Uint8List? data, ) => (super.noSuchMethod( Invocation.method( @@ -1265,6 +1470,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -1273,6 +1479,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -1281,6 +1488,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -1289,6 +1497,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -1298,6 +1507,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -1307,6 +1517,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -1316,6 +1527,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -1325,6 +1537,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -1334,6 +1547,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -1342,6 +1556,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollTo( int? x, @@ -1358,6 +1573,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollBy( int? x, @@ -1374,6 +1590,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -1382,6 +1599,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -1390,6 +1608,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -1404,6 +1623,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i5.Future<_i4.Offset>); + @override _i5.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -1414,6 +1634,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -1425,6 +1646,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -1436,6 +1658,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -1446,6 +1669,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -1456,6 +1680,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -1465,6 +1690,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -1500,6 +1726,7 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart index c9e6e4bfadac7ddc52487e40e78e21c78339627a..d8b4dea0fb83893b10f58965d873411526588aff 100644 --- a/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/instance_manager_test.dart. // Do not manually edit this file. @@ -11,6 +11,8 @@ import 'test_android_webview.g.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/surface_android_test.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/surface_android_test.dart index d022ab282c92df2c8d91eaab998a8ce4b886dbc5..9d41208b5f649f646535400c273c7db02d5f4ffe 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/surface_android_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/surface_android_test.dart @@ -17,8 +17,7 @@ void main() { late List log; setUpAll(() { - _ambiguate(TestDefaultBinaryMessengerBinding.instance)! - .defaultBinaryMessenger + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler( SystemChannels.platform_views, (MethodCall call) async { @@ -38,8 +37,7 @@ void main() { }); tearDownAll(() { - _ambiguate(TestDefaultBinaryMessengerBinding.instance)! - .defaultBinaryMessenger + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform_views, null); }); @@ -122,9 +120,3 @@ class TestWebViewPlatformCallbacksHandler @override void onWebResourceError(WebResourceError error) {} } - -/// This allows a value of type T or T? to be treated as a value of type T?. -/// -/// We use this so that APIs that have become non-nullable can still be used -/// with `!` and `?` on the stable branch. -T? _ambiguate(T? value) => value; diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart index 864dbaa04aa083b36f4545c8686c07ced281dedc..32731152a380985574bdd499f08f498895d0d9e8 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/legacy/webview_android_cookie_manager_test.dart. // Do not manually edit this file. @@ -12,6 +12,8 @@ import 'package:webview_flutter_android/src/android_webview.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -53,6 +55,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeAllCookies() => (super.noSuchMethod( Invocation.method( @@ -61,6 +64,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ), returnValue: _i3.Future.value(false), ) as _i3.Future); + @override _i3.Future setAcceptThirdPartyCookies( _i2.WebView? webView, @@ -77,6 +81,7 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i2.CookieManager copy() => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.dart index b0962ea812dbdb1c1d7cb67008be849addceb8d0..121a623e0ef7fae8459c7ac5c7f59259e25d1e8a 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.dart @@ -724,7 +724,7 @@ void main() { onReceivedRequestError: anyNamed('onReceivedRequestError'), requestLoading: anyNamed('requestLoading'), urlLoading: anyNamed('urlLoading'), - )).captured.single as Function(android_webview.WebView, String); + )).captured.single as void Function(android_webview.WebView, String); onPageStarted(mockWebView, 'https://google.com'); verify(mockCallbacksHandler.onPageStarted('https://google.com')); @@ -741,7 +741,7 @@ void main() { onReceivedRequestError: anyNamed('onReceivedRequestError'), requestLoading: anyNamed('requestLoading'), urlLoading: anyNamed('urlLoading'), - )).captured.single as Function(android_webview.WebView, String); + )).captured.single as void Function(android_webview.WebView, String); onPageFinished(mockWebView, 'https://google.com'); verify(mockCallbacksHandler.onPageFinished('https://google.com')); @@ -759,7 +759,7 @@ void main() { onReceivedRequestError: anyNamed('onReceivedRequestError'), requestLoading: anyNamed('requestLoading'), urlLoading: anyNamed('urlLoading'), - )).captured.single as Function( + )).captured.single as void Function( android_webview.WebView, int, String, String); onReceivedError( @@ -795,7 +795,7 @@ void main() { onReceivedRequestError: captureAnyNamed('onReceivedRequestError'), requestLoading: anyNamed('requestLoading'), urlLoading: anyNamed('urlLoading'), - )).captured.single as Function( + )).captured.single as void Function( android_webview.WebView, android_webview.WebResourceRequest, android_webview.WebResourceError, @@ -844,7 +844,7 @@ void main() { onReceivedRequestError: anyNamed('onReceivedRequestError'), requestLoading: anyNamed('requestLoading'), urlLoading: captureAnyNamed('urlLoading'), - )).captured.single as Function(android_webview.WebView, String); + )).captured.single as void Function(android_webview.WebView, String); urlLoading(mockWebView, 'https://google.com'); verify(mockCallbacksHandler.onNavigationRequest( @@ -872,7 +872,7 @@ void main() { onReceivedRequestError: anyNamed('onReceivedRequestError'), requestLoading: captureAnyNamed('requestLoading'), urlLoading: anyNamed('urlLoading'), - )).captured.single as Function( + )).captured.single as void Function( android_webview.WebView, android_webview.WebResourceRequest, ); diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index b82f8dea91e68275a57a8130a713eda77f7c5fff..f7a11fb9e8722c15d64853df2ac1f8477fa60fb9 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_android/test/legacy/webview_android_widget_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; +import 'dart:typed_data' as _i7; import 'dart:ui' as _i3; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:webview_flutter_android/src/android_webview.dart' as _i2; import 'package:webview_flutter_android/src/legacy/webview_android_widget.dart' - as _i7; + as _i8; import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart' as _i4; @@ -18,6 +19,8 @@ import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_ // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -136,6 +139,7 @@ class MockFlutterAssetManager extends _i1.Mock ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( @@ -143,7 +147,13 @@ class MockFlutterAssetManager extends _i1.Mock #getAssetFilePathByName, [name], ), - returnValue: _i5.Future.value(''), + returnValue: _i5.Future.value(_i6.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + )), ) as _i5.Future); } @@ -164,6 +174,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( @@ -174,6 +185,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( @@ -184,6 +196,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( @@ -193,6 +206,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( @@ -203,6 +217,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -213,6 +228,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setSupportZoom(bool? support) => (super.noSuchMethod( Invocation.method( @@ -222,6 +238,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( @@ -232,6 +249,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( Invocation.method( @@ -241,6 +259,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -250,6 +269,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -259,6 +279,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -268,6 +289,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -277,6 +299,22 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future getUserAgentString() => (super.noSuchMethod( + Invocation.method( + #getUserAgentString, + [], + ), + returnValue: _i5.Future.value(_i6.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], + ), + )), + ) as _i5.Future); + @override _i2.WebSettings copy() => (super.noSuchMethod( Invocation.method( @@ -310,6 +348,7 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.WebStorage copy() => (super.noSuchMethod( Invocation.method( @@ -342,6 +381,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); + @override _i5.Future loadData({ required String? data, @@ -361,6 +401,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadDataWithBaseUrl({ String? baseUrl, @@ -384,6 +425,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadUrl( String? url, @@ -400,10 +442,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future postUrl( String? url, - _i6.Uint8List? data, + _i7.Uint8List? data, ) => (super.noSuchMethod( Invocation.method( @@ -416,6 +459,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -424,6 +468,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -432,6 +477,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -440,6 +486,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -449,6 +496,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -458,6 +506,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -467,6 +516,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -476,6 +526,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -485,6 +536,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -493,6 +545,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollTo( int? x, @@ -509,6 +562,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future scrollBy( int? x, @@ -525,6 +579,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -533,6 +588,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -541,6 +597,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -555,6 +612,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i5.Future<_i3.Offset>); + @override _i5.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -565,6 +623,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -576,6 +635,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -587,6 +647,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -597,6 +658,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -607,6 +669,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( Invocation.method( @@ -616,6 +679,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -644,23 +708,33 @@ class MockWebResourceRequest extends _i1.Mock @override String get url => (super.noSuchMethod( Invocation.getter(#url), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#url), + ), ) as String); + @override bool get isForMainFrame => (super.noSuchMethod( Invocation.getter(#isForMainFrame), returnValue: false, ) as bool); + @override bool get hasGesture => (super.noSuchMethod( Invocation.getter(#hasGesture), returnValue: false, ) as bool); + @override String get method => (super.noSuchMethod( Invocation.getter(#method), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#method), + ), ) as String); + @override Map get requestHeaders => (super.noSuchMethod( Invocation.getter(#requestHeaders), @@ -699,6 +773,7 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { String, int, )); + @override _i2.DownloadListener copy() => (super.noSuchMethod( Invocation.method( @@ -719,7 +794,7 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { /// /// See the documentation for Mockito's code generation for more information. class MockWebViewAndroidJavaScriptChannel extends _i1.Mock - implements _i7.WebViewAndroidJavaScriptChannel { + implements _i8.WebViewAndroidJavaScriptChannel { MockWebViewAndroidJavaScriptChannel() { _i1.throwOnMissingStub(this); } @@ -733,16 +808,22 @@ class MockWebViewAndroidJavaScriptChannel extends _i1.Mock Invocation.getter(#javascriptChannelRegistry), ), ) as _i4.JavascriptChannelRegistry); + @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#channelName), + ), ) as String); + @override void Function(String) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), returnValue: (String message) {}, ) as void Function(String)); + @override _i2.JavaScriptChannel copy() => (super.noSuchMethod( Invocation.method( @@ -777,6 +858,48 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setSynchronousReturnValueForOnJsAlert(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future setSynchronousReturnValueForOnJsConfirm(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future setSynchronousReturnValueForOnJsPrompt(bool? value) => + (super.noSuchMethod( + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -812,6 +935,7 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( @@ -842,6 +966,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock Invocation.getter(#channels), returnValue: {}, ) as Map); + @override void onJavascriptChannelMessage( String? channel, @@ -857,6 +982,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void updateJavascriptChannelsFromSet(Set<_i4.JavascriptChannel>? channels) => super.noSuchMethod( @@ -893,6 +1019,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.FutureOr); + @override void onPageStarted(String? url) => super.noSuchMethod( Invocation.method( @@ -901,6 +1028,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onPageFinished(String? url) => super.noSuchMethod( Invocation.method( @@ -909,6 +1037,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onProgress(int? progress) => super.noSuchMethod( Invocation.method( @@ -917,6 +1046,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onWebResourceError(_i4.WebResourceError? error) => super.noSuchMethod( Invocation.method( @@ -930,7 +1060,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock /// A class which mocks [WebViewProxy]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebViewProxy extends _i1.Mock implements _i7.WebViewProxy { +class MockWebViewProxy extends _i1.Mock implements _i8.WebViewProxy { MockWebViewProxy() { _i1.throwOnMissingStub(this); } @@ -949,6 +1079,7 @@ class MockWebViewProxy extends _i1.Mock implements _i7.WebViewProxy { ), ), ) as _i2.WebView); + @override _i2.WebViewClient createWebViewClient({ void Function( @@ -1008,6 +1139,7 @@ class MockWebViewProxy extends _i1.Mock implements _i7.WebViewProxy { ), ), ) as _i2.WebViewClient); + @override _i5.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index a018fccdcbe7f3f8060c276e03e9444e36096f71..41d66e0320e7457f24a95e1d673e197874944e2b 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -999,6 +999,8 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); + String getUserAgentString(int instanceId); + static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1365,6 +1367,29 @@ abstract class TestWebSettingsHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString was null, expected non-null int.'); + final String output = api.getUserAgentString(arg_instanceId!); + return [output]; + }); + } + } } } @@ -1516,6 +1541,14 @@ abstract class TestWebChromeClientHostApi { void setSynchronousReturnValueForOnShowFileChooser( int instanceId, bool value); + void setSynchronousReturnValueForOnConsoleMessage(int instanceId, bool value); + + void setSynchronousReturnValueForOnJsAlert(int instanceId, bool value); + + void setSynchronousReturnValueForOnJsConfirm(int instanceId, bool value); + + void setSynchronousReturnValueForOnJsPrompt(int instanceId, bool value); + static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1568,6 +1601,114 @@ abstract class TestWebChromeClientHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage was null, expected non-null int.'); + final bool? arg_value = (args[1] as bool?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnConsoleMessage( + arg_instanceId!, arg_value!); + return []; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert was null, expected non-null int.'); + final bool? arg_value = (args[1] as bool?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnJsAlert( + arg_instanceId!, arg_value!); + return []; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm was null, expected non-null int.'); + final bool? arg_value = (args[1] as bool?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnJsConfirm( + arg_instanceId!, arg_value!); + return []; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt was null, expected non-null int.'); + final bool? arg_value = (args[1] as bool?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnJsPrompt( + arg_instanceId!, arg_value!); + return []; + }); + } + } } } @@ -1764,6 +1905,49 @@ abstract class TestPermissionRequestHostApi { } } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class TestCustomViewCallbackHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + void onCustomViewHidden(int identifier); + + static void setup(TestCustomViewCallbackHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackHostApi.onCustomViewHidden', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.CustomViewCallbackHostApi.onCustomViewHidden was null, expected non-null int.'); + api.onCustomViewHidden(arg_identifier!); + return []; + }); + } + } + } +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -1815,3 +1999,104 @@ abstract class TestGeolocationPermissionsCallbackHostApi { } } } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +abstract class TestHttpAuthHandlerHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + bool useHttpAuthUsernamePassword(int instanceId); + + /// Handles Dart method `HttpAuthHandler.cancel`. + void cancel(int instanceId); + + /// Handles Dart method `HttpAuthHandler.proceed`. + void proceed(int instanceId, String username, String password); + + static void setup(TestHttpAuthHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword was null, expected non-null int.'); + final bool output = api.useHttpAuthUsernamePassword(arg_instanceId!); + return [output]; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel was null, expected non-null int.'); + api.cancel(arg_instanceId!); + return []; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null int.'); + final String? arg_username = (args[1] as String?); + assert(arg_username != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null String.'); + final String? arg_password = (args[2] as String?); + assert(arg_password != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null String.'); + api.proceed(arg_instanceId!, arg_username!, arg_password!); + return []; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/.gitignore b/packages/webview_flutter/webview_flutter_ohos/.gitignore index ae1f1838ee7e87b1fa976268adc723e1020af38e..6665baf5ad7de7fd7352c04cfa1b6d9e318a73c9 100644 --- a/packages/webview_flutter/webview_flutter_ohos/.gitignore +++ b/packages/webview_flutter/webview_flutter_ohos/.gitignore @@ -35,3 +35,10 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +pubspec.lock +GeneratedPluginRegistrant* +ohos/**/oh_modules +ohos/**.har +ohos/**/BuildProfile.ets +ohos/**/oh-package-lock.json5 diff --git a/packages/webview_flutter/webview_flutter_ohos/CHANGELOG.md b/packages/webview_flutter/webview_flutter_ohos/CHANGELOG.md index 07981a332b5eaa004af23e3575569478246fff71..2178cd4454c036ea48c56324ceb07b3a909eacb4 100644 --- a/packages/webview_flutter/webview_flutter_ohos/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_ohos/CHANGELOG.md @@ -2,6 +2,10 @@ * Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. +## 3.14.0 + +* Adds support to show JavaScript dialog. See `AndroidWebViewController.setOnJavaScriptAlertDialog`, `AndroidWebViewController.setOnJavaScriptConfirmDialog` and `AndroidWebViewController.setOnJavaScriptTextInputDialog`. + ## 3.9.3 * Fixes bug where the `PlatformWebViewWidget` was rebuilt unnecessarily. diff --git a/packages/webview_flutter/webview_flutter_ohos/example/lib/main.dart b/packages/webview_flutter/webview_flutter_ohos/example/lib/main.dart index ef50394a635f440a737dce3b7b99bc43723ceda1..213a511c98a8d02a7a9be95b14e522eba27a02e6 100644 --- a/packages/webview_flutter/webview_flutter_ohos/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_ohos/example/lib/main.dart @@ -20,6 +20,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:path_provider/path_provider.dart'; import 'package:webview_flutter_ohos/webview_flutter_ohos.dart'; @@ -37,8 +38,8 @@ const String kNavigationExamplePage = ''' The navigation delegate is set to block navigation to the youtube website.

@@ -84,6 +85,72 @@ const String kTransparentBackgroundPage = ''' '''; +const String kLogExamplePage = ''' + + + +Load file or HTML string example + + + +

Local demo page

+

+ This page is used to test the forwarding of console logs to Dart. +

+ + + +
+ + + + + +
+ + + +'''; + +const String kAlertTestPage = ''' + + + + + + + +

Click the following button to see the effect

+
+ + + +
+ + +'''; + class WebViewExample extends StatefulWidget { const WebViewExample({super.key, this.cookieManager}); @@ -96,14 +163,23 @@ class WebViewExample extends StatefulWidget { class _WebViewExampleState extends State { late final PlatformWebViewController _controller; + Future getUserAgent() async { + String userAgent = await _controller.getUserAgent() ?? ''; + if(defaultTargetPlatform != TargetPlatform.ohos){ + return userAgent; + } + return '$userAgent HuaweiBrower'; + } + @override void initState() { super.initState(); + _controller = PlatformWebViewController( OhosWebViewControllerCreationParams(), ) ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setBackgroundColor(const Color(0x80000000)) + ..setBackgroundColor(const Color(0x00000000)) ..setPlatformNavigationDelegate( PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), @@ -128,7 +204,7 @@ Page resource error: '''); }) ..setOnNavigationRequest((NavigationRequest request) { - if (request.url.startsWith('https://www.youtube.com/')) { + if (request.url.contains('iqiyi')) { debugPrint('blocking navigation to ${request.url}'); return NavigationDecision.prevent; } @@ -137,6 +213,9 @@ Page resource error: }) ..setOnUrlChange((UrlChange change) { debugPrint('url change to ${change.url}'); + }) + ..setOnHttpAuthRequest((HttpAuthRequest request) { + openDialog(request); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -155,9 +234,15 @@ Page resource error: request.grant(); }, ) - ..loadRequest(LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - )); + ..loadRequest( + LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + ), + ); + + getUserAgent().then((String userAgent){ + _controller.setUserAgent(userAgent); + }); } @override @@ -186,7 +271,7 @@ Page resource error: return FloatingActionButton( onPressed: () async { final String? url = await _controller.currentUrl(); - if (context.mounted) { + if (mounted) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Favorited $url')), ); @@ -195,6 +280,50 @@ Page resource error: child: const Icon(Icons.favorite), ); } + + Future openDialog(HttpAuthRequest httpRequest) async { + final TextEditingController usernameTextController = + TextEditingController(); + final TextEditingController passwordTextController = + TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('${httpRequest.host}: ${httpRequest.realm ?? '-'}'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + decoration: const InputDecoration(labelText: 'Username'), + autofocus: true, + controller: usernameTextController, + ), + TextField( + decoration: const InputDecoration(labelText: 'Password'), + controller: passwordTextController, + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + httpRequest.onProceed( + WebViewCredential( + user: usernameTextController.text, + password: passwordTextController.text, + ), + ); + Navigator.of(context).pop(); + }, + child: const Text('Authenticate'), + ), + ], + ); + }, + ); + } } enum MenuOptions { @@ -211,6 +340,10 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + videoExample, + logExample, + basicAuthentication, + javaScriptAlert, } class SampleMenu extends StatelessWidget { @@ -271,6 +404,18 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.videoExample: + _onVideoExample(context); + break; + case MenuOptions.logExample: + _onLogExample(); + break; + case MenuOptions.basicAuthentication: + _promptForUrl(context); + break; + case MenuOptions.javaScriptAlert: + _onJavaScriptAlertExample(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -327,6 +472,22 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.transparentBackground, child: Text('Transparent background example'), ), + const PopupMenuItem( + value: MenuOptions.logExample, + child: Text('Log example'), + ), + const PopupMenuItem( + value: MenuOptions.videoExample, + child: Text('Video example'), + ), + const PopupMenuItem( + value: MenuOptions.basicAuthentication, + child: Text('Basic Authentication Example'), + ), + const PopupMenuItem( + value: MenuOptions.javaScriptAlert, + child: Text('JavaScript Alert Example'), + ), ], ); } @@ -422,6 +583,30 @@ class SampleMenu extends StatelessWidget { )); } + Future _onVideoExample(BuildContext context) { + final OhosWebViewController ohosController = + webViewController as OhosWebViewController; + // #docregion fullscreen_example + ohosController.setCustomWidgetCallbacks( + onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, + ); + // #enddocregion fullscreen_example + + return ohosController.loadRequest( + LoadRequestParams( + uri: Uri.parse('https://www.youtube.com/watch?v=4AoFA19gbLo'), + ), + ); + } + Future _onDoPostRequest() { return webViewController.loadRequest(LoadRequestParams( uri: Uri.parse('https://httpbin.org/post'), @@ -451,6 +636,28 @@ class SampleMenu extends StatelessWidget { return webViewController.loadHtmlString(kTransparentBackgroundPage); } + Future _onJavaScriptAlertExample(BuildContext context) { + webViewController.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + await _showAlert(context, request.message); + }); + + webViewController.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + final bool result = await _showConfirm(context, request.message); + return result; + }); + + webViewController.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + final String result = + await _showTextInput(context, request.message, request.defaultText); + return result; + }); + + return webViewController.loadHtmlString(kAlertTestPage); + } + Widget _getCookieList(String cookies) { if (cookies == '""') { return Container(); @@ -475,6 +682,110 @@ class SampleMenu extends StatelessWidget { return indexFile.path; } + + Future _onLogExample() { + webViewController + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + if (kDebugMode) { + debugPrint( + '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); + } + }); + return webViewController.loadHtmlString(kLogExamplePage); + } + + Future _promptForUrl(BuildContext context) { + final TextEditingController urlTextController = TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Input URL to visit'), + content: TextField( + decoration: const InputDecoration(labelText: 'URL'), + autofocus: true, + controller: urlTextController, + ), + actions: [ + TextButton( + onPressed: () { + if (urlTextController.text.isNotEmpty) { + final Uri? uri = Uri.tryParse(urlTextController.text); + if (uri != null && uri.scheme.isNotEmpty) { + webViewController.loadRequest( + LoadRequestParams(uri: uri), + ); + Navigator.pop(context); + } + } + }, + child: const Text('Visit'), + ), + ], + ); + }, + ); + } + + Future _showAlert(BuildContext context, String message) async { + return showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: const Text('OK')) + ], + ); + }); + } + + Future _showConfirm(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(false); + }, + child: const Text('Cancel')), + TextButton( + onPressed: () { + Navigator.of(ctx).pop(true); + }, + child: const Text('OK')), + ], + ); + }) ?? + false; + } + + Future _showTextInput( + BuildContext context, String message, String? defaultText) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop('Text test'); + }, + child: const Text('Enter')), + ], + ); + }) ?? + ''; + } } class NavigationControls extends StatelessWidget { diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/build-profile.json5 b/packages/webview_flutter/webview_flutter_ohos/example/ohos/build-profile.json5 index a6f1e04c238b5264323839f7f27e7e91275737e1..1d12140d202702d7c73d64f1b291fe5c45a660ce 100644 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/build-profile.json5 +++ b/packages/webview_flutter/webview_flutter_ohos/example/ohos/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "4.1.0(11)", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS" } ] diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 b/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 index 491a0712f4ad9b05d079bf177fbc08424065bf7c..a1e72840d839cebea4520acb6d1e9afff8c3cf01 100755 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 +++ b/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-config.json5 @@ -13,9 +13,8 @@ * limitations under the License. */ -{ - "hvigorVersion": "4.1.2", +{ + "modelVersion": "5.0.0", "dependencies": { - "@ohos/hvigor-ohos-plugin": "4.1.2" } } \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js b/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js deleted file mode 100755 index 8ec2d0156d8cca1c9ced7289a8f76c4d2efed7d8..0000000000000000000000000000000000000000 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigor/hvigor-wrapper.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var e=require("path"),t=require("os"),n=require("fs"),r=require("child_process"),u=require("process"),o=require("tty"),i=require("util"),s=require("url"),c=require("constants"),a=require("stream"),l=require("assert"),f=require("zlib"),D=require("net"),d=require("crypto"),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E={},h={},C=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h,"__esModule",{value:!0}),h.maxPathLength=h.isMac=h.isLinux=h.isWindows=void 0;const m=C(t),F="Windows_NT",y="Darwin";function g(){return m.default.type()===F}function A(){return m.default.type()===y}h.isWindows=g,h.isLinux=function(){return"Linux"===m.default.type()},h.isMac=A,h.maxPathLength=function(){return A()?1016:g()?259:4095},function(n){var r=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return u(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.LOG_LEVEL=n.ANALYZE=n.PARALLEL=n.INCREMENTAL=n.DAEMON=n.DOT=n.PROPERTIES=n.HVIGOR_POOL_CACHE_TTL=n.HVIGOR_POOL_CACHE_CAPACITY=n.HVIGOR_POOL_MAX_CORE_SIZE=n.HVIGOR_POOL_MAX_SIZE=n.ENABLE_SIGN_TASK_KEY=n.HVIGOR_CACHE_DIR_KEY=n.WORK_SPACE=n.HVIGOR_PROJECT_WRAPPER_HOME=n.HVIGOR_PROJECT_ROOT_DIR=n.HVIGOR_PROJECT_CACHES_HOME=n.HVIGOR_PNPM_STORE_PATH=n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.PROJECT_CACHES=n.HVIGOR_WRAPPER_TOOLS_HOME=n.HVIGOR_USER_HOME=n.DEFAULT_PACKAGE_JSON=n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=n.PNPM=n.HVIGOR=n.NPM_TOOL=n.PNPM_TOOL=n.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const i=o(t),s=o(e),c=h;n.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",n.PNPM_TOOL=(0,c.isWindows)()?"pnpm.cmd":"pnpm",n.NPM_TOOL=(0,c.isWindows)()?"npm.cmd":"npm",n.HVIGOR="hvigor",n.PNPM="pnpm",n.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",n.DEFAULT_PACKAGE_JSON="package.json",n.HVIGOR_USER_HOME=s.resolve(i.homedir(),".hvigor"),n.HVIGOR_WRAPPER_TOOLS_HOME=s.resolve(n.HVIGOR_USER_HOME,"wrapper","tools"),n.PROJECT_CACHES="project_caches",n.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=s.resolve(n.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",n.PNPM_TOOL),n.HVIGOR_PNPM_STORE_PATH=s.resolve(n.HVIGOR_USER_HOME,"caches"),n.HVIGOR_PROJECT_CACHES_HOME=s.resolve(n.HVIGOR_USER_HOME,n.PROJECT_CACHES),n.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),n.HVIGOR_PROJECT_WRAPPER_HOME=s.resolve(n.HVIGOR_PROJECT_ROOT_DIR,n.HVIGOR),n.WORK_SPACE="workspace",n.HVIGOR_CACHE_DIR_KEY="hvigor.cacheDir",n.ENABLE_SIGN_TASK_KEY="enableSignTask",n.HVIGOR_POOL_MAX_SIZE="hvigor.pool.maxSize",n.HVIGOR_POOL_MAX_CORE_SIZE="hvigor.pool.maxCoreSize",n.HVIGOR_POOL_CACHE_CAPACITY="hvigor.pool.cache.capacity",n.HVIGOR_POOL_CACHE_TTL="hvigor.pool.cache.ttl",n.PROPERTIES="properties",n.DOT=".",n.DAEMON="daemon",n.INCREMENTAL="incremental",n.PARALLEL="typeCheck",n.ANALYZE="analyze",n.LOG_LEVEL="logLevel"}(E);var v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.logError=S.logInfo=S.logErrorAndExit=void 0,S.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},S.logInfo=function(e){console.log(e)},S.logError=function(e){console.error(e)};var w=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),O=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&w(t,e,n);return O(t,e),t};Object.defineProperty(v,"__esModule",{value:!0});var b=v.executeBuild=void 0;const B=_(n),I=_(e),x=S,P=r;b=v.executeBuild=function(e){const t=I.resolve(e,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=B.realpathSync(t),n=process.argv.slice(2),r=(0,P.spawn)("node",[e,...n],{env:process.env});r.stdout.on("data",(e=>{(0,x.logInfo)(`${e.toString().trim()}`)})),r.stderr.on("data",(e=>{(0,x.logError)(`${e.toString().trim()}`)})),r.on("exit",((e,t)=>{process.exit(null!=e?e:-1)}))}catch(n){(0,x.logErrorAndExit)(`Error: ENOENT: no such file ${t},delete ${e} and retry.`)}};var N,T,k,R,M,L={},j={},$={exports:{}},H={exports:{}};function G(){if(T)return N;T=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return N=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function U(){if(R)return k;return R=1,k=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{t=t||process.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in r))||"codeship"===r.CI_NAME?1:o;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:(r.TERM,o)}(t);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return n("no-color")||n("no-colors")||n("color=false")?u=!1:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=!0),"FORCE_COLOR"in r&&(u=0===r.FORCE_COLOR.length||0!==parseInt(r.FORCE_COLOR,10)),W={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)}}function Q(){return K||(K=1,function(e,t){const n=o,r=i;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=X();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=U()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Y,Y.exports)),Y.exports}q=$,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?q.exports=(M||(M=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=U()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(H,H.exports)),H.exports):q.exports=Q();var ee=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=te(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,se=e=>e&&"object"==typeof e&&!Array.isArray(e),ce=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${ne.inspect(e,{depth:5})}) - ${n}`)}))};var ae={configure:e=>{re("New configuration to be validated: ",e),ce(e,ie(se(e)),"must be an object."),re(`Calling pre-processing listeners (${ue.length})`),ue.forEach((t=>t(e))),re("Configuration pre-processing finished."),re(`Calling configuration listeners (${oe.length})`),oe.forEach((t=>t(e))),re("Configuration finished.")},addListener:e=>{oe.push(e),re(`Added listener, now ${oe.length} listeners`)},addPreProcessingListener:e=>{ue.push(e),re(`Added pre-processing listener, now ${ue.length} listeners`)},throwExceptionIf:ce,anObject:se,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:ie},le={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),D=n(u.getSeconds()),d=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,D).replace(/SSS/g,d).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(le);const fe=le.exports,De=t,de=i,pe=e,Ee=s,he=$.exports("log4js:layouts"),Ce={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function me(e){return e?`[${Ce[e][0]}m`:""}function Fe(e){return e?`[${Ce[e][1]}m`:""}function ye(e,t){return n=de.format("[%s] [%s] %s - ",fe.asString(e.startTime),e.level.toString(),e.categoryName),me(r=t)+n+Fe(r);var n,r}function ge(e){return ye(e)+de.format(...e.data)}function Ae(e){return ye(e,e.level.colour)+de.format(...e.data)}function ve(e){return de.format(...e.data)}function Se(e){return e.data[0]}function we(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(pe.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.slice(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.slice(1),10);t.lengthve,basic:()=>ge,colored:()=>Ae,coloured:()=>Ae,pattern:e=>we(e&&e.pattern,e&&e.tokens),dummy:()=>Se};var _e={basicLayout:ge,messagePassThroughLayout:ve,patternLayout:we,colouredLayout:Ae,coloredLayout:Ae,dummyLayout:Se,addLayout(e,t){Oe[e]=t},layout:(e,t)=>Oe[e]&&Oe[e](t)};const be=ae,Be=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Ie{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Ie?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Ie[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Ie[n]=new Ie(e[t].value,n,e[t].colour);const r=Ie.levels.findIndex((e=>e.levelStr===n));r>-1?Ie.levels[r]=Ie[n]:Ie.levels.push(Ie[n])})),Ie.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Ie.getLevel(e)),this.level===e.level}}Ie.levels=[],Ie.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),be.addListener((e=>{const t=e.levels;if(t){be.throwExceptionIf(e,be.not(be.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{be.throwExceptionIf(e,be.not(be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),be.throwExceptionIf(e,be.not(be.anObject(t[n])),`level "${n}" must be an object`),be.throwExceptionIf(e,be.not(t[n].value),`level "${n}" must have a 'value' property`),be.throwExceptionIf(e,be.not(be.anInteger(t[n].value)),`level "${n}".value must have an integer value`),be.throwExceptionIf(e,be.not(t[n].colour),`level "${n}" must have a 'colour' property`),be.throwExceptionIf(e,be.not(Be.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Be.join(", ")}`)}))}})),be.addListener((e=>{Ie.addLevels(e.levels)}));var xe=Ie,Pe={exports:{}},Ne={};/*! (c) 2020 Andrea Giammarchi */ -const{parse:Te,stringify:ke}=JSON,{keys:Re}=Object,Me=String,Le="string",je={},$e="object",He=(e,t)=>t,Ge=e=>e instanceof Me?Me(e):e,Ue=(e,t)=>typeof t===Le?new Me(t):t,Ve=(e,t,n,r)=>{const u=[];for(let o=Re(n),{length:i}=o,s=0;s{const r=Me(t.push(n)-1);return e.set(n,r),r},We=(e,t)=>{const n=Te(e,Ue).map(Ge),r=n[0],u=t||He,o=typeof r===$e&&r?Ve(n,new Set,r,u):r;return u.call({"":o},"",o)};Ne.parse=We;const ze=(e,t,n)=>{const r=t&&typeof t===$e?(e,n)=>""===e||-1Te(ze(e));Ne.fromJSON=e=>We(ke(e));const Ke=Ne,qe=xe;const Ye=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const t=this.deMap[e];this.serMap[t]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};let Ze=class{constructor(e,t,n,r,u,o){if(this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,this.error=o,void 0!==u){if(!u||"object"!=typeof u||Array.isArray(u))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==u[e]&&(this[e]=u[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Ke.stringify(this,((e,t)=>(t instanceof Error&&(t=Object.assign({message:t.message,stack:t.stack},t)),Ye.serialise(t))))}static deserialise(e){let t;try{const n=Ke.parse(e,((e,t)=>{if(t&&t.message&&t.stack){const e=new Error(t);Object.keys(t).forEach((n=>{e[n]=t[n]})),t=e}return Ye.deserialise(t)}));this._getLocationKeys().forEach((e=>{void 0!==n[e]&&(n.location||(n.location={}),n.location[e]=n[e])})),t=new Ze(n.categoryName,qe.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),t.startTime=new Date(n.startTime),t.pid=n.pid,n.cluster&&(t.cluster=n.cluster)}catch(n){t=new Ze("log4js",qe.ERROR,["Unable to parse log:",e,"because: ",n])}return t}};var Xe=Ze;const Qe=$.exports("log4js:clustering"),et=Xe,tt=ae;let nt=!1,rt=null;try{rt=require("cluster")}catch(e){Qe("cluster module not present"),nt=!0}const ut=[];let ot=!1,it="NODE_APP_INSTANCE";const st=()=>ot&&"0"===process.env[it],ct=()=>nt||rt&&rt.isMaster||st(),at=e=>{ut.forEach((t=>t(e)))},lt=(e,t)=>{if(Qe("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Qe("received message: ",t.data);const e=et.deserialise(t.data);at(e)}};nt||tt.addListener((e=>{ut.length=0,({pm2:ot,disableClustering:nt,pm2InstanceVar:it="NODE_APP_INSTANCE"}=e),Qe(`clustering disabled ? ${nt}`),Qe(`cluster.isMaster ? ${rt&&rt.isMaster}`),Qe(`pm2 enabled ? ${ot}`),Qe(`pm2InstanceVar = ${it}`),Qe(`process.env[${it}] = ${process.env[it]}`),ot&&process.removeListener("message",lt),rt&&rt.removeListener&&rt.removeListener("message",lt),nt||e.disableClustering?Qe("Not listening for cluster messages, because clustering disabled."):st()?(Qe("listening for PM2 broadcast messages"),process.on("message",lt)):rt&&rt.isMaster?(Qe("listening for cluster messages"),rt.on("message",lt)):Qe("not listening for messages, because we are not a master process")}));var ft={onlyOnMaster:(e,t)=>ct()?e():t,isMaster:ct,send:e=>{ct()?at(e):(ot||(e.cluster={workerId:rt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ut.push(e)}},Dt={};function dt(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.slice(-1).toLocaleUpperCase(),u=e.slice(0,-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function pt(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:dt},e)}const Et={dateFile:pt,file:pt,fileSync:pt};Dt.modifyConfig=e=>Et[e.type]?Et[e.type](e):e;var ht={};const Ct=console.log.bind(console);ht.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{Ct(e(n,t))}}(n,e.timezoneOffset)};var mt={};mt.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var Ft={};Ft.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var yt={};yt.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;u.isLessThanOrEqualTo(t)&&o.isGreaterThanOrEqualTo(t)&&n(e)}}(e.level,e.maxLevel,u,r)};var gt={};const At=$.exports("log4js:categoryFilter");gt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{At(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(At("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var vt={};const St=$.exports("log4js:noLogFilter");vt.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{St(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(St("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var wt={},Ot={exports:{}},_t={},bt={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}},Bt=c,It=process.cwd,xt=null,Pt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return xt||(xt=It.call(process)),xt};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var Nt=process.chdir;process.chdir=function(e){xt=null,Nt.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Nt)}var Tt=function(e){Bt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,Bt.O_WRONLY|Bt.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,Bt.O_WRONLY|Bt.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){Bt.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,Bt.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,Bt.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===Pt&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,D){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var kt=a.Stream,Rt=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);kt.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Mt=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:Lt(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},Lt=Object.getPrototypeOf||function(e){return e.__proto__};var jt,$t,Ht=n,Gt=Tt,Ut=Rt,Vt=Mt,Jt=i;function Wt(e,t){Object.defineProperty(e,jt,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(jt=Symbol.for("graceful-fs.queue"),$t=Symbol.for("graceful-fs.previous")):(jt="___graceful-fs.queue",$t="___graceful-fs.previous");var zt=function(){};if(Jt.debuglog?zt=Jt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(zt=function(){var e=Jt.format.apply(Jt,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!Ht[jt]){var Kt=p[jt]||[];Wt(Ht,Kt),Ht.close=function(e){function t(t,n){return e.call(Ht,t,(function(e){e||Qt(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,$t,{value:e}),t}(Ht.close),Ht.closeSync=function(e){function t(t){e.apply(Ht,arguments),Qt()}return Object.defineProperty(t,$t,{value:e}),t}(Ht.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){zt(Ht[jt]),l.equal(Ht[jt].length,0)}))}p[jt]||Wt(p,Ht[jt]);var qt,Yt=Zt(Vt(Ht));function Zt(e){Gt(e),e.gracefulify=Zt,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):Xt([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):Xt([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=Ut(e);D=s.ReadStream,d=s.WriteStream}var c=e.ReadStream;c&&(D.prototype=Object.create(c.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(d.prototype=Object.create(a.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var l=D;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=d;function D(e,t){return this instanceof D?(c.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function d(e,t){return this instanceof d?(a.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):Xt([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function Xt(e){zt("ENQUEUE",e[0].name,e[1]),Ht[jt].push(e),en()}function Qt(){for(var e=Date.now(),t=0;t2&&(Ht[jt][t][3]=e,Ht[jt][t][4]=e);en()}function en(){if(clearTimeout(qt),qt=void 0,0!==Ht[jt].length){var e=Ht[jt].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)zt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){zt("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(zt("RETRY",t.name,n),t.apply(null,n.concat([u]))):Ht[jt].push(e)}void 0===qt&&(qt=setTimeout(en,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ht.__patched&&(Yt=Zt(Ht),Ht.__patched=!0),function(e){const t=bt.fromCallback,n=Yt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(_t);const tn=e;function nn(e){return(e=tn.normalize(tn.resolve(e)).split(tn.sep)).length>0?e[0]:null}const rn=/[<>:"|?*]/;var un=function(e){const t=nn(e);return e=e.replace(t,""),rn.test(e)};const on=Yt,sn=e,cn=un,an=parseInt("0777",8);var ln=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&cn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||on;void 0===o&&(o=an&~process.umask()),u||(u=null),r=r||function(){},t=sn.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(sn.dirname(t)===t)return r(o);e(sn.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const fn=Yt,Dn=e,dn=un,pn=parseInt("0777",8);var En=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||fn;if("win32"===process.platform&&dn(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=pn&~process.umask()),r||(r=null),t=Dn.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Dn.dirname(t)===t)throw u;r=e(Dn.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const hn=(0,bt.fromCallback)(ln);var Cn={mkdirs:hn,mkdirsSync:En,mkdirp:hn,mkdirpSync:En,ensureDir:hn,ensureDirSync:En};const mn=Yt;var Fn=function(e,t,n,r){mn.open(e,"r+",((e,u)=>{if(e)return r(e);mn.futimes(u,t,n,(e=>{mn.close(u,(t=>{r&&r(e||t)}))}))}))},yn=function(e,t,n){const r=mn.openSync(e,"r+");return mn.futimesSync(r,t,n),mn.closeSync(r)};const gn=Yt,An=e,vn=10,Sn=5,wn=0,On=process.versions.node.split("."),_n=Number.parseInt(On[0],10),bn=Number.parseInt(On[1],10),Bn=Number.parseInt(On[2],10);function In(){if(_n>vn)return!0;if(_n===vn){if(bn>Sn)return!0;if(bn===Sn&&Bn>=wn)return!0}return!1}function xn(e,t){const n=An.resolve(e).split(An.sep).filter((e=>e)),r=An.resolve(t).split(An.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Pn(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Nn,Tn,kn={checkPaths:function(e,t,n,r){!function(e,t,n){In()?gn.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);gn.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):gn.stat(e,((e,r)=>{if(e)return n(e);gn.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&xn(e,t)?r(new Error(Pn(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=In()?gn.statSync(e,{bigint:!0}):gn.statSync(e);try{r=In()?gn.statSync(t,{bigint:!0}):gn.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&xn(e,t))throw new Error(Pn(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=An.resolve(An.dirname(t)),s=An.resolve(An.dirname(r));if(s===i||s===An.parse(s).root)return o();In()?gn.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o))):gn.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(Pn(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=An.resolve(An.dirname(t)),i=An.resolve(An.dirname(r));if(i===o||i===An.parse(i).root)return;let s;try{s=In()?gn.statSync(i,{bigint:!0}):gn.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(Pn(t,r,u));return e(t,n,i,u)},isSrcSubdir:xn};const Rn=Yt,Mn=e,Ln=Cn.mkdirsSync,jn=yn,$n=kn;function Hn(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Rn.statSync:Rn.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Rn.mkdirSync(n),Un(t,n,r),Rn.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return Un(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Rn.unlinkSync(n),Gn(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):Gn(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Rn.readlinkSync(t);r.dereference&&(u=Mn.resolve(process.cwd(),u));if(e){let e;try{e=Rn.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Rn.symlinkSync(u,n);throw e}if(r.dereference&&(e=Mn.resolve(process.cwd(),e)),$n.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Rn.statSync(n).isDirectory()&&$n.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Rn.unlinkSync(t),Rn.symlinkSync(e,t)}(u,n)}return Rn.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function Gn(e,t,n,r){return"function"==typeof Rn.copyFileSync?(Rn.copyFileSync(t,n),Rn.chmodSync(n,e.mode),r.preserveTimestamps?jn(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Tn?Nn:(Tn=1,Nn=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Rn.openSync(t,"r"),s=Rn.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=Mn.join(t,e),o=Mn.join(n,e),{destStat:i}=$n.checkPathsSync(u,o,"copy");return Hn(i,u,o,r)}(r,e,t,n)))}var Vn=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=$n.checkPathsSync(e,t,"copy");return $n.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=Mn.dirname(n);Rn.existsSync(u)||Ln(u);return Hn(e,t,n,r)}(u,e,t,n)},Jn={copySync:Vn};const Wn=bt.fromPromise,zn=_t;var Kn={pathExists:Wn((function(e){return zn.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:zn.existsSync};const qn=Yt,Yn=e,Zn=Cn.mkdirs,Xn=Kn.pathExists,Qn=Fn,er=kn;function tr(e,t,n,r,u){const o=Yn.dirname(n);Xn(o,((i,s)=>i?u(i):s?rr(e,t,n,r,u):void Zn(o,(o=>o?u(o):rr(e,t,n,r,u)))))}function nr(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function rr(e,t,n,r,u){return r.filter?nr(ur,e,t,n,r,u):ur(e,t,n,r,u)}function ur(e,t,n,r,u){(r.dereference?qn.stat:qn.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){qn.mkdir(n,(o=>{if(o)return u(o);sr(t,n,r,(t=>t?u(t):qn.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return sr(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();qn.unlink(n,(o=>o?u(o):or(e,t,n,r,u)))}(e,n,r,u,o):or(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){qn.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Yn.resolve(process.cwd(),o)),e?void qn.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?qn.symlink(o,n,u):u(t):(r.dereference&&(i=Yn.resolve(process.cwd(),i)),er.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&er.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){qn.unlink(t,(r=>r?n(r):qn.symlink(e,t,n)))}(o,n,u)))):qn.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function or(e,t,n,r,u){return"function"==typeof qn.copyFile?qn.copyFile(t,n,(t=>t?u(t):ir(e,n,r,u))):function(e,t,n,r,u){const o=qn.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=qn.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>ir(e,n,r,u)))}))}(e,t,n,r,u)}function ir(e,t,n,r){qn.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?Qn(t,e.atime,e.mtime,r):r()))}function sr(e,t,n,r){qn.readdir(e,((u,o)=>u?r(u):cr(o,e,t,n,r)))}function cr(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Yn.join(n,t),s=Yn.join(r,t);er.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;rr(a,i,s,u,(t=>t?o(t):cr(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var ar=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),er.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;er.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?nr(tr,s,e,t,n,r):tr(s,e,t,n,r)))}))};var lr={copy:(0,bt.fromCallback)(ar)};const fr=Yt,Dr=e,dr=l,pr="win32"===process.platform;function Er(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||fr[t],e[t+="Sync"]=e[t]||fr[t]})),e.maxBusyTries=e.maxBusyTries||3}function hr(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr.strictEqual(typeof n,"function","rimraf: callback function required"),dr(t,"rimraf: invalid options argument provided"),dr.strictEqual(typeof t,"object","rimraf: options should be object"),Er(t),Cr(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rCr(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Cr(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&pr?mr(e,t,r,n):u&&u.isDirectory()?yr(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return pr?mr(e,t,r,n):yr(e,t,r,n);if("EISDIR"===r.code)return yr(e,t,r,n)}return n(r)}))))}function mr(e,t,n,r){dr(e),dr(t),dr("function"==typeof r),n&&dr(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?yr(e,t,n,r):t.unlink(e,r)}))}))}function Fr(e,t,n){let r;dr(e),dr(t),n&&dr(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Ar(e,t,n):t.unlinkSync(e)}function yr(e,t,n,r){dr(e),dr(t),n&&dr(n instanceof Error),dr("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){dr(e),dr(t),dr("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{hr(Dr.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function gr(e,t){let n;Er(t=t||{}),dr(e,"rimraf: missing path"),dr.strictEqual(typeof e,"string","rimraf: path should be a string"),dr(t,"rimraf: missing options"),dr.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&pr&&Fr(e,t,n)}try{n&&n.isDirectory()?Ar(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return pr?Fr(e,t,n):Ar(e,t,n);if("EISDIR"!==n.code)throw n;Ar(e,t,n)}}function Ar(e,t,n){dr(e),dr(t),n&&dr(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(dr(e),dr(t),t.readdirSync(e).forEach((n=>gr(Dr.join(e,n),t))),!pr){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var vr=hr;hr.sync=gr;const Sr=vr;var wr={remove:(0,bt.fromCallback)(Sr),removeSync:Sr.sync};const Or=bt.fromCallback,_r=Yt,br=e,Br=Cn,Ir=wr,xr=Or((function(e,t){t=t||function(){},_r.readdir(e,((n,r)=>{if(n)return Br.mkdirs(e,t);r=r.map((t=>br.join(e,t))),function e(){const n=r.pop();if(!n)return t();Ir.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function Pr(e){let t;try{t=_r.readdirSync(e)}catch(t){return Br.mkdirsSync(e)}t.forEach((t=>{t=br.join(e,t),Ir.removeSync(t)}))}var Nr={emptyDirSync:Pr,emptydirSync:Pr,emptyDir:xr,emptydir:xr};const Tr=bt.fromCallback,kr=e,Rr=Yt,Mr=Cn,Lr=Kn.pathExists;var jr={createFile:Tr((function(e,t){function n(){Rr.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Rr.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=kr.dirname(e);Lr(o,((e,r)=>e?t(e):r?n():void Mr.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Rr.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=kr.dirname(e);Rr.existsSync(n)||Mr.mkdirsSync(n),Rr.writeFileSync(e,"")}};const $r=bt.fromCallback,Hr=e,Gr=Yt,Ur=Cn,Vr=Kn.pathExists;var Jr={createLink:$r((function(e,t,n){function r(e,t){Gr.link(e,t,(e=>{if(e)return n(e);n(null)}))}Vr(t,((u,o)=>u?n(u):o?n(null):void Gr.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=Hr.dirname(t);Vr(o,((u,i)=>u?n(u):i?r(e,t):void Ur.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(Gr.existsSync(t))return;try{Gr.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=Hr.dirname(t);return Gr.existsSync(n)||Ur.mkdirsSync(n),Gr.linkSync(e,t)}};const Wr=e,zr=Yt,Kr=Kn.pathExists;var qr={symlinkPaths:function(e,t,n){if(Wr.isAbsolute(e))return zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=Wr.dirname(t),u=Wr.join(r,e);return Kr(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):zr.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:Wr.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(Wr.isAbsolute(e)){if(n=zr.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=Wr.dirname(t),u=Wr.join(r,e);if(n=zr.existsSync(u),n)return{toCwd:u,toDst:e};if(n=zr.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Wr.relative(r,e)}}}};const Yr=Yt;var Zr={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Yr.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Yr.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Xr=bt.fromCallback,Qr=e,eu=Yt,tu=Cn.mkdirs,nu=Cn.mkdirsSync,ru=qr.symlinkPaths,uu=qr.symlinkPathsSync,ou=Zr.symlinkType,iu=Zr.symlinkTypeSync,su=Kn.pathExists;var cu={createSymlink:Xr((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,su(t,((u,o)=>u?r(u):o?r(null):void ru(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,ou(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=Qr.dirname(t);su(o,((n,i)=>n?r(n):i?eu.symlink(e,t,u,r):void tu(o,(n=>{if(n)return r(n);eu.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(eu.existsSync(t))return;const r=uu(e,t);e=r.toDst,n=iu(r.toCwd,n);const u=Qr.dirname(t);return eu.existsSync(u)||nu(u),eu.symlinkSync(e,t,n)}};var au,lu={createFile:jr.createFile,createFileSync:jr.createFileSync,ensureFile:jr.createFile,ensureFileSync:jr.createFileSync,createLink:Jr.createLink,createLinkSync:Jr.createLinkSync,ensureLink:Jr.createLink,ensureLinkSync:Jr.createLinkSync,createSymlink:cu.createSymlink,createSymlinkSync:cu.createSymlinkSync,ensureSymlink:cu.createSymlink,ensureSymlinkSync:cu.createSymlinkSync};try{au=Yt}catch(e){au=n}function fu(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Du(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var du={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||au,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Du(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||au,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Du(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||au,o="";try{o=fu(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||au,u=fu(t,n);return r.writeFileSync(e,u,n)}},pu=du;const Eu=bt.fromCallback,hu=pu;var Cu={readJson:Eu(hu.readFile),readJsonSync:hu.readFileSync,writeJson:Eu(hu.writeFile),writeJsonSync:hu.writeFileSync};const mu=e,Fu=Cn,yu=Kn.pathExists,gu=Cu;var Au=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=mu.dirname(e);yu(u,((o,i)=>o?r(o):i?gu.writeJson(e,t,n,r):void Fu.mkdirs(u,(u=>{if(u)return r(u);gu.writeJson(e,t,n,r)}))))};const vu=Yt,Su=e,wu=Cn,Ou=Cu;var _u=function(e,t,n){const r=Su.dirname(e);vu.existsSync(r)||wu.mkdirsSync(r),Ou.writeJsonSync(e,t,n)};const bu=bt.fromCallback,Bu=Cu;Bu.outputJson=bu(Au),Bu.outputJsonSync=_u,Bu.outputJSON=Bu.outputJson,Bu.outputJSONSync=Bu.outputJsonSync,Bu.writeJSON=Bu.writeJson,Bu.writeJSONSync=Bu.writeJsonSync,Bu.readJSON=Bu.readJson,Bu.readJSONSync=Bu.readJsonSync;var Iu=Bu;const xu=Yt,Pu=e,Nu=Jn.copySync,Tu=wr.removeSync,ku=Cn.mkdirpSync,Ru=kn;function Mu(e,t,n){try{xu.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Nu(e,t,r),Tu(e)}(e,t,n)}}var Lu=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Ru.checkPathsSync(e,t,"move");return Ru.checkParentPathsSync(e,u,t,"move"),ku(Pu.dirname(t)),function(e,t,n){if(n)return Tu(t),Mu(e,t,n);if(xu.existsSync(t))throw new Error("dest already exists.");return Mu(e,t,n)}(e,t,r)},ju={moveSync:Lu};const $u=Yt,Hu=e,Gu=lr.copy,Uu=wr.remove,Vu=Cn.mkdirp,Ju=Kn.pathExists,Wu=kn;function zu(e,t,n,r){$u.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};Gu(e,t,u,(t=>t?r(t):Uu(e,r)))}(e,t,n,r):r()))}var Ku=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Wu.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;Wu.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);Vu(Hu.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return Uu(t,(u=>u?r(u):zu(e,t,n,r)));Ju(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):zu(e,t,n,r)))}(e,t,u,r)))}))}))};var qu={move:(0,bt.fromCallback)(Ku)};const Yu=bt.fromCallback,Zu=Yt,Xu=e,Qu=Cn,eo=Kn.pathExists;var to={outputFile:Yu((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Xu.dirname(e);eo(u,((o,i)=>o?r(o):i?Zu.writeFile(e,t,n,r):void Qu.mkdirs(u,(u=>{if(u)return r(u);Zu.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Xu.dirname(e);if(Zu.existsSync(n))return Zu.writeFileSync(e,...t);Qu.mkdirsSync(n),Zu.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},_t,Jn,lr,Nr,lu,Iu,Cn,ju,qu,to,Kn,wr);const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Ot);const no=$.exports("streamroller:fileNameFormatter"),ro=e;const uo=$.exports("streamroller:fileNameParser"),oo=le.exports;const io=$.exports("streamroller:moveAndMaybeCompressFile"),so=Ot.exports,co=f;var ao=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return io(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await so.pathExists(e))if(io(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=so.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=so.createReadStream(e).on("open",(()=>{t.pipe(co.createGzip()).pipe(i)})).on("error",(t=>{io(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{io(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),so.unlink(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),so.truncate(e).then(r).catch((t=>{io(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(io(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),so.unlink(t).then((()=>{u(e)})).catch((e=>{io(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(io(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{io(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await so.move(e,t,{overwrite:!0})}catch(n){if(io(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){io("moveAndMaybeCompressFile: trying copy+truncate instead");try{await so.copy(e,t,{overwrite:!0}),await so.truncate(e)}catch(e){io("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else io("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const lo=$.exports("streamroller:RollingFileWriteStream"),fo=Ot.exports,Do=e,po=t,Eo=()=>new Date,ho=le.exports,{Writable:Co}=a,mo=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=ro.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,D=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(no(`_formatFileName: date=${e}, index=${t}`),D.reduce(((n,r)=>r(n,t,e)),s))},Fo=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(uo("it is gzipped"),t.isCompressed=!0,e.slice(0,-3)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(uo("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(uo("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];uo("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),uo(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=oo.parse(n,i,new Date(0,0));return oo.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return uo(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(uo("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},yo=ao;var go=class extends Co{constructor(e,t){if(lo(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Do.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Do.sep}`)&&(e=e.replace("~",po.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Do.parse(e),""===this.fileObject.dir&&(this.fileObject=Do.parse(Do.join(process.cwd(),e))),this.fileFormatter=mo({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return lo(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{lo(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(lo(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==ho(this.options.pattern,Eo())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return lo("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){lo(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await yo(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?ho(this.options.pattern,Eo()):null,lo(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await fo.readdir(this.fileObject.dir).catch((()=>[]));lo(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:Eo().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return fo.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Do.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(fo.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;fo.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=fo.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(lo(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),lo("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Do.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,lo(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>fo.unlink(e).catch((t=>{lo(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Ao=go;var vo=class extends Ao{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const So=go;var wo={RollingFileWriteStream:go,RollingFileStream:vo,DateRollingFileStream:class extends So{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Oo=$.exports("log4js:file"),_o=e,bo=wo,Bo=t,Io=Bo.EOL;let xo=!1;const Po=new Set;function No(){Po.forEach((e=>{e.sighupHandler()}))}wt.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(_o.sep))throw new Error(`Filename is a directory: ${e}`);function i(e,t,n,r){const u=new bo.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}e=e.replace(new RegExp(`^~(?=${_o.sep}.+)`),Bo.homedir()),e=_o.normalize(e),Oo("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let s=i(e,n,r,u);const c=function(e){if(s.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}s.write(t(e,o)+Io,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){s.end((()=>{s=i(e,n,r,u)}))},c.sighupHandler=function(){Oo("SIGHUP handler called."),c.reopen()},c.shutdown=function(e){Po.delete(c),0===Po.size&&xo&&(process.removeListener("SIGHUP",No),xo=!1),s.end("","utf-8",e)},Po.add(c),xo||(process.on("SIGHUP",No),xo=!0),c}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var To={};const ko=wo,Ro=t.EOL;function Mo(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new ko.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Ro,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}To.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Mo(e.filename,e.pattern,n,e,e.timezoneOffset)};var Lo={};const jo=$.exports("log4js:fileSync"),$o=e,Ho=n,Go=t,Uo=Go.EOL;function Vo(e,t){const n=e=>{try{return Ho.mkdirSync(e,{recursive:!0})}catch(t){if("ENOENT"===t.code)return n($o.dirname(e)),n(e);if("EEXIST"!==t.code&&"EROFS"!==t.code)throw t;try{if(Ho.statSync(e).isDirectory())return e;throw t}catch(e){throw t}}};n($o.dirname(e)),Ho.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}class Jo{constructor(e,t,n,r){if(jo("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=Ho.statSync(e).size}catch(t){Vo(e,r)}return t}(this.filename)}shouldRoll(){return jo("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${$o.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.slice(`${$o.basename(e)}.`.length),10)||0}function o(e,t){return u(e)-u(t)}function i(n){const r=u(n);if(jo(`Index of ${n} is ${r}`),0===t.backups)Ho.truncateSync(e,0);else if(r ${e}.${r+1}`),Ho.renameSync($o.join($o.dirname(e),n),`${e}.${r+1}`)}}jo("Rolling, rolling, rolling"),jo("Renaming the old files"),Ho.readdirSync($o.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;jo("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),jo("writing the chunk to the file"),n.currentSize+=e.length,Ho.appendFileSync(n.filename,e)}}Lo.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){if("string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith($o.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${$o.sep}.+)`),Go.homedir()),e=$o.normalize(e),jo("Creating fileSync appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");const i=function(e,t,n){let r;var o;return t?r=new Jo(e,t,n,u):(Vo(o=e,u),r={write(e){Ho.appendFileSync(o,e)}}),r}(e,n,r);return e=>{i.write(t(e,o)+Uo)}}(e.filename,n,e.maxLogSize,e.backups,r,e.timezoneOffset)};var Wo={};const zo=$.exports("log4js:tcp"),Ko=D;Wo.configure=function(e,t){zo(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){zo("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(zo("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(zo("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){zo(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=Ko.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{zo("socket connected"),c(),n=!0})),u.on("drain",(()=>{zo("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{zo("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){zo("shutdown called"),r.length&&o?(zo("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const qo=e,Yo=$.exports("log4js:appenders"),Zo=ae,Xo=ft,Qo=xe,ei=_e,ti=Dt,ni=new Map;ni.set("console",ht),ni.set("stdout",mt),ni.set("stderr",Ft),ni.set("logLevelFilter",yt),ni.set("categoryFilter",gt),ni.set("noLogFilter",vt),ni.set("file",wt),ni.set("dateFile",To),ni.set("fileSync",Lo),ni.set("tcp",Wo);const ri=new Map,ui=(e,t)=>{let n;try{const t=`${e}.cjs`;n=require.resolve(t),Yo("Loading module from ",t)}catch(t){n=e,Yo("Loading module from ",e)}try{return require(n)}catch(n){return void Zo.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},oi=new Set,ii=(e,t)=>{if(ri.has(e))return ri.get(e);if(!t.appenders[e])return!1;if(oi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);oi.add(e),Yo(`Creating appender ${e}`);const n=si(e,t);return oi.delete(e),ri.set(e,n),n},si=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ni.get(e)||ui(`./${e}`,t)||ui(e,t)||require.main&&require.main.filename&&ui(qo.join(qo.dirname(require.main.filename),e),t)||ui(qo.join(process.cwd(),e),t))(n.type,t);return Zo.throwExceptionIf(t,Zo.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&(process.emitWarning(`Appender ${n.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Yo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${n.type} exports an appender function.`)),r.shutdown&&(process.emitWarning(`Appender ${n.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Yo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${n.type} exports a shutdown function.`)),Yo(`${e}: clustering.isMaster ? ${Xo.isMaster()}`),Yo(`${e}: appenderModule is ${i.inspect(r)}`),Xo.onlyOnMaster((()=>(Yo(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ti.modifyConfig(n),ei,(e=>ii(e,t)),Qo))),(()=>{}))},ci=e=>{if(ri.clear(),oi.clear(),!e)return;const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type||"multiprocess"===e.appenders[n].type)&&ii(n,e)}))},ai=()=>{ci()};ai(),Zo.addListener((e=>{Zo.throwExceptionIf(e,Zo.not(Zo.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Zo.throwExceptionIf(e,Zo.not(t.length),"must define at least one appender."),t.forEach((t=>{Zo.throwExceptionIf(e,Zo.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),Zo.addListener(ci),Pe.exports=ri,Pe.exports.init=ai;var li={exports:{}};!function(e){const t=$.exports("log4js:categories"),n=ae,r=xe,u=Pe.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.slice(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c()};a(),n.addListener(c);const l=e=>{if(t(`configForCategory: searching for config for ${e}`),o.has(e))return t(`configForCategory: ${e} exists in config, returning it`),o.get(e);let n;return e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, cloning from parents`),n={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),n={...o.get("default")}),o.set(e,n),n};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,t)=>{l(e).level=t},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(li);const fi=$.exports("log4js:logger"),Di=Xe,di=xe,pi=ft,Ei=li.exports,hi=ae,Ci=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function mi(e,t=4){try{const n=e.stack.split("\n").slice(t);if(!n.length)return null;const r=Ci.exec(n[0]);if(r&&6===r.length){let e="",t="",u="";return r[1]&&""!==r[1]&&([t,u]=r[1].replace(/[[\]]/g,"").split(" as "),u=u||"",t.includes(".")&&([e,t]=t.split("."))),{fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n"),className:e,functionName:t,functionAlias:u,callerName:r[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}let Fi=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.callStackSkipIndex=0,this.parseCallStack=mi,fi(`Logger created (${this.category}, ${this.level})`)}get level(){return di.getLevel(Ei.getLevelForCategory(this.category),di.OFF)}set level(e){Ei.setLevelForCategory(this.category,di.getLevel(e,this.level))}get useCallStack(){return Ei.getEnableCallStackForCategory(this.category)}set useCallStack(e){Ei.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...t){const n=di.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,t):hi.validIdentifier(e)&&t.length>0?(this.log(di.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(di.INFO,`[${e}]`,...t)):this.log(di.INFO,e,...t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){fi(`sending log data (${e}) to appenders`);const n=t.find((e=>e instanceof Error));let r;if(this.useCallStack){try{n&&(r=this.parseCallStack(n,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const u=new Di(this.category,e,t,this.context,r,n);pi.send(u)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=mi}}};function yi(e){const t=di.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Fi.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Fi.prototype[n]=function(...e){this.log(t,...e)}}di.levels.forEach(yi),hi.addListener((()=>{di.levels.forEach(yi)}));var gi=Fi;const Ai=xe;function vi(e){return e.originalUrl||e.url}function Si(e,t){for(let n=0;n{if(void 0!==e._logging)return i();if("function"!=typeof t.nolog){const n=function(e){let t=null;if(e instanceof RegExp&&(t=e),"string"==typeof e&&(t=new RegExp(e)),Array.isArray(e)){const n=e.map((e=>e.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);if(n&&n.test(e.originalUrl))return i()}if(n.isLevelEnabled(r)||"auto"===t.level){const i=new Date,{writeHead:s}=o;e._logging=!0,o.writeHead=(e,t)=>{o.writeHead=s,o.writeHead(e,t),o.__statusCode=e,o.__headers=t||{}};let c=!1;const a=()=>{if(c)return;if(c=!0,"function"==typeof t.nolog&&!0===t.nolog(e,o))return void(e._logging=!1);o.responseTime=new Date-i,o.statusCode&&"auto"===t.level&&(r=Ai.INFO,o.statusCode>=300&&(r=Ai.WARN),o.statusCode>=400&&(r=Ai.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ai.getLevel(t.level,r))}return r}(o.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:vi(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eSi(e,s)));t&&n.log(r,t)}else n.log(r,Si(u,s));t.context&&n.removeContext("res")};o.on("end",a),o.on("finish",a),o.on("error",a),o.on("close",a)}return i()}},Hi=Bi;let Gi=!1;function Ui(e){if(!Gi)return;Ii("Received log event ",e);Mi.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function Vi(e){Gi&&Ji();let t=e;return"string"==typeof t&&(t=function(e){Ii(`Loading configuration from ${e}`);try{return JSON.parse(xi.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ii(`Configuration is ${t}`),Ni.configure(Pi(t)),ji.onMessage(Ui),Gi=!0,Wi}function Ji(e=(()=>{})){if("function"!=typeof e)throw new TypeError("Invalid callback passed to shutdown");Ii("Shutdown called. Disabling all log writing."),Gi=!1;const t=Array.from(Ri.values());Ri.init(),Mi.init();const n=t.reduce(((e,t)=>t.shutdown?e+1:e),0);0===n&&(Ii("No appenders with shutdown functions found."),e());let r,u=0;function o(t){r=r||t,u+=1,Ii(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ii("All shutdown functions completed."),e(r))}Ii(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o)))}const Wi={getLogger:function(e){return Gi||Vi(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Li(e||"default")},configure:Vi,shutdown:Ji,connectLogger:$i,levels:ki,addLayout:Ti.addLayout,recording:function(){return Hi}};var zi=Wi;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addCustomPLlugin=e.addCustomTask=e.hvigorTrace=void 0;const t=zi;e.hvigorTrace={totalTime:0,moduleNum:0,taskTime:{},isIncremental:!0,hasIncremental:!1,isParallel:!0,IS_DAEMON:!0,LOG_LEVEL:t.levels.INFO.levelStr,IS_HVIGORFILE_TYPE_CHECK:!1},e.addCustomTask=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_TASKS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.NAME!==t.NAME))),r.push(t),e.hvigorTrace.CUSTOM_TASKS=r},e.addCustomPLlugin=function(t){var n;let r=null!==(n=e.hvigorTrace.CUSTOM_PLUGINS)&&void 0!==n?n:[];r.length>0&&(r=r.filter((e=>e.PLUGIN_ID!==t.PLUGIN_ID))),r.push({PLUGIN_ID:t.PLUGIN_ID}),e.hvigorTrace.CUSTOM_PLUGINS=r}}(j);var Ki,qi={};Ki=qi,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isCI=void 0,Ki.isCI=function(){return!("false"===process.env.CI||!(process.env.BUILD_ID||process.env.BUILD_NUMBER||process.env.CI||process.env.CI_APP_ID||process.env.CI_BUILD_ID||process.env.CI_BUILD_NUMBER||process.env.CI_NAME||process.env.CONTINUOUS_INTEGRATION||process.env.RUN_ID||Ki.name))};var Yi={};!function(e){var t=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashFile=e.hash=e.createHash=void 0;const r=t(d),u=t(n);e.createHash=(e="MD5")=>r.default.createHash(e);e.hash=(t,n)=>(0,e.createHash)(n).update(t).digest("hex");e.hashFile=(t,n)=>{if(u.default.existsSync(t))return(0,e.hash)(u.default.readFileSync(t,"utf-8"),n)}}(Yi);var Zi={},Xi={},Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.Unicode=void 0;class es{}Qi.Unicode=es,es.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,es.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,es.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.JudgeUtil=void 0;const ts=Qi;Xi.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&ts.Unicode.SPACE_SEPARATOR.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||ts.Unicode.ID_START.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||ts.Unicode.ID_CONTINUE.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ns=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.parseJsonText=Zi.parseJsonFile=void 0;const rs=ns(n),us=ns(t),os=ns(e),is=Xi;var ss;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(ss||(ss={}));let cs,as,ls,fs,Ds,ds,ps="start",Es=[],hs=0,Cs=1,ms=0,Fs=!1,ys="default",gs="'",As=1;function vs(e,t=!1){as=String(e),ps="start",Es=[],hs=0,Cs=1,ms=0,fs=void 0,Fs=t;do{cs=Ss(),xs[ps]()}while("eof"!==cs.type);return fs}function Ss(){for(ys="default",Ds="",gs="'",As=1;;){ds=ws();const e=_s[ys]();if(e)return e}}function ws(){if(as[hs])return String.fromCodePoint(as.codePointAt(hs))}function Os(){const e=ws();return"\n"===e?(Cs++,ms=0):e?ms+=e.length:ms++,e&&(hs+=e.length),e}Zi.parseJsonFile=function(e,t=!1,n="utf-8"){const r=rs.default.readFileSync(os.default.resolve(e),{encoding:n});try{return vs(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");if(2===n.length)throw new Error(`${n[0].trim()}${us.default.EOL}\t at ${e}:${n[1].trim()}`)}throw new Error(`${e} is not in valid JSON/JSON5 format.`)}},Zi.parseJsonText=vs;const _s={default(){switch(ds){case"/":return Os(),void(ys="comment");case void 0:return Os(),bs("eof")}if(!is.JudgeUtil.isIgnoreChar(ds)&&!is.JudgeUtil.isSpaceSeparator(ds))return _s[ps]();Os()},start(){ys="value"},beforePropertyName(){switch(ds){case"$":case"_":return Ds=Os(),void(ys="identifierName");case"\\":return Os(),void(ys="identifierNameStartEscape");case"}":return bs("punctuator",Os());case'"':case"'":return gs=ds,Os(),void(ys="string")}if(is.JudgeUtil.isIdStartChar(ds))return Ds+=Os(),void(ys="identifierName");throw ks(ss.Char,Os())},afterPropertyName(){if(":"===ds)return bs("punctuator",Os());throw ks(ss.Char,Os())},beforePropertyValue(){ys="value"},afterPropertyValue(){switch(ds){case",":case"}":return bs("punctuator",Os())}throw ks(ss.Char,Os())},beforeArrayValue(){if("]"===ds)return bs("punctuator",Os());ys="value"},afterArrayValue(){switch(ds){case",":case"]":return bs("punctuator",Os())}throw ks(ss.Char,Os())},end(){throw ks(ss.Char,Os())},comment(){switch(ds){case"*":return Os(),void(ys="multiLineComment");case"/":return Os(),void(ys="singleLineComment")}throw ks(ss.Char,Os())},multiLineComment(){switch(ds){case"*":return Os(),void(ys="multiLineCommentAsterisk");case void 0:throw ks(ss.Char,Os())}Os()},multiLineCommentAsterisk(){switch(ds){case"*":return void Os();case"/":return Os(),void(ys="default");case void 0:throw ks(ss.Char,Os())}Os(),ys="multiLineComment"},singleLineComment(){switch(ds){case"\n":case"\r":case"\u2028":case"\u2029":return Os(),void(ys="default");case void 0:return Os(),bs("eof")}Os()},value(){switch(ds){case"{":case"[":return bs("punctuator",Os());case"n":return Os(),Bs("ull"),bs("null",null);case"t":return Os(),Bs("rue"),bs("boolean",!0);case"f":return Os(),Bs("alse"),bs("boolean",!1);case"-":case"+":return"-"===Os()&&(As=-1),void(ys="numerical");case".":case"0":case"I":case"N":return void(ys="numerical");case'"':case"'":return gs=ds,Os(),Ds="",void(ys="string")}if(void 0===ds||!is.JudgeUtil.isDigitWithoutZero(ds))throw ks(ss.Char,Os());ys="numerical"},numerical(){switch(ds){case".":return Ds=Os(),void(ys="decimalPointLeading");case"0":return Ds=Os(),void(ys="zero");case"I":return Os(),Bs("nfinity"),bs("numeric",As*(1/0));case"N":return Os(),Bs("aN"),bs("numeric",NaN)}if(void 0!==ds&&is.JudgeUtil.isDigitWithoutZero(ds))return Ds=Os(),void(ys="decimalInteger");throw ks(ss.Char,Os())},zero(){switch(ds){case".":case"e":case"E":return void(ys="decimal");case"x":case"X":return Ds+=Os(),void(ys="hexadecimal")}return bs("numeric",0)},decimalInteger(){switch(ds){case".":case"e":case"E":return void(ys="decimal")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimal(){switch(ds){case".":Ds+=Os(),ys="decimalFraction";break;case"e":case"E":Ds+=Os(),ys="decimalExponent"}},decimalPointLeading(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalFraction");throw ks(ss.Char,Os())},decimalFraction(){switch(ds){case"e":case"E":return Ds+=Os(),void(ys="decimalExponent")}if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},decimalExponent(){switch(ds){case"+":case"-":return Ds+=Os(),void(ys="decimalExponentSign")}if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentSign(){if(is.JudgeUtil.isDigit(ds))return Ds+=Os(),void(ys="decimalExponentInteger");throw ks(ss.Char,Os())},decimalExponentInteger(){if(!is.JudgeUtil.isDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},hexadecimal(){if(is.JudgeUtil.isHexDigit(ds))return Ds+=Os(),void(ys="hexadecimalInteger");throw ks(ss.Char,Os())},hexadecimalInteger(){if(!is.JudgeUtil.isHexDigit(ds))return bs("numeric",As*Number(Ds));Ds+=Os()},identifierNameStartEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":break;default:if(!is.JudgeUtil.isIdStartChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},identifierName(){switch(ds){case"$":case"_":case"‌":case"‍":return void(Ds+=Os());case"\\":return Os(),void(ys="identifierNameEscape")}if(!is.JudgeUtil.isIdContinueChar(ds))return bs("identifier",Ds);Ds+=Os()},identifierNameEscape(){if("u"!==ds)throw ks(ss.Char,Os());Os();const e=Is();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!is.JudgeUtil.isIdContinueChar(e))throw ks(ss.Identifier)}Ds+=e,ys="identifierName"},string(){switch(ds){case"\\":return Os(),void(Ds+=function(){const e=ws(),t=function(){switch(ws()){case"b":return Os(),"\b";case"f":return Os(),"\f";case"n":return Os(),"\n";case"r":return Os(),"\r";case"t":return Os(),"\t";case"v":return Os(),"\v"}return}();if(t)return t;switch(e){case"0":if(Os(),is.JudgeUtil.isDigit(ws()))throw ks(ss.Char,Os());return"\0";case"x":return Os(),function(){let e="",t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());if(e+=Os(),t=ws(),!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());return e+=Os(),String.fromCodePoint(parseInt(e,16))}();case"u":return Os(),Is();case"\n":case"\u2028":case"\u2029":return Os(),"";case"\r":return Os(),"\n"===ws()&&Os(),""}if(void 0===e||is.JudgeUtil.isDigitWithoutZero(e))throw ks(ss.Char,Os());return Os()}());case'"':case"'":if(ds===gs){const e=bs("string",Ds);return Os(),e}return void(Ds+=Os());case"\n":case"\r":case void 0:throw ks(ss.Char,Os());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${Ts(e)}' in strings is not valid ECMAScript; consider escaping.`)}(ds)}Ds+=Os()}};function bs(e,t){return{type:e,value:t,line:Cs,column:ms}}function Bs(e){for(const t of e){if(ws()!==t)throw ks(ss.Char,Os());Os()}}function Is(){let e="",t=4;for(;t-- >0;){const t=ws();if(!is.JudgeUtil.isHexDigit(t))throw ks(ss.Char,Os());e+=Os()}return String.fromCodePoint(parseInt(e,16))}const xs={start(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},beforePropertyName(){switch(cs.type){case"identifier":case"string":return ls=cs.value,void(ps="afterPropertyName");case"punctuator":return void Ns();case"eof":throw ks(ss.EOF)}},afterPropertyName(){if("eof"===cs.type)throw ks(ss.EOF);ps="beforePropertyValue"},beforePropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);Ps()},afterPropertyValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforePropertyName");case"}":Ns()}},beforeArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);"punctuator"!==cs.type||"]"!==cs.value?Ps():Ns()},afterArrayValue(){if("eof"===cs.type)throw ks(ss.EOF);switch(cs.value){case",":return void(ps="beforeArrayValue");case"]":Ns()}},end(){}};function Ps(){const e=function(){let e;switch(cs.type){case"punctuator":switch(cs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=cs.value}return e}();if(Fs&&"object"==typeof e&&(e._line=Cs,e._column=ms),void 0===fs)fs=e;else{const t=Es[Es.length-1];Array.isArray(t)?Fs&&"object"!=typeof e?t.push({value:e,_line:Cs,_column:ms}):t.push(e):t[ls]=Fs&&"object"!=typeof e?{value:e,_line:Cs,_column:ms}:e}!function(e){if(e&&"object"==typeof e)Es.push(e),ps=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ns(){Es.pop();const e=Es[Es.length-1];ps=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function Ts(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function ks(e,t){let n="";switch(e){case ss.Char:n=void 0===t?`JSON5: invalid end of input at ${Cs}:${ms}`:`JSON5: invalid character '${Ts(t)}' at ${Cs}:${ms}`;break;case ss.EOF:n=`JSON5: invalid end of input at ${Cs}:${ms}`;break;case ss.Identifier:ms-=5,n=`JSON5: invalid identifier character at ${Cs}:${ms}`}const r=new Rs(n);return r.lineNumber=Cs,r.columnNumber=ms,r}class Rs extends SyntaxError{}var Ms={},Ls=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),js=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ls(t,e,n);return js(t,e),t},Hs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isFileExists=Ms.offlinePluginConversion=Ms.executeCommand=Ms.getNpmPath=Ms.hasNpmPackInPaths=void 0;const Gs=r,Us=Hs(n),Vs=$s(e),Js=E,Ws=S;Ms.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},Ms.getNpmPath=function(){const e=process.execPath;return Vs.join(Vs.dirname(e),Js.NPM_TOOL)},Ms.executeCommand=function(e,t,n){0!==(0,Gs.spawnSync)(e,t,n).status&&(0,Ws.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},Ms.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?Vs.resolve(e,Js.HVIGOR,t.replace("file:","")):t},Ms.isFileExists=function(e){return Us.default.existsSync(e)&&Us.default.statSync(e).isFile()};var zs={};!function(u){var o=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0}),u.executeInstallPnpm=u.isPnpmInstalled=u.environmentHandler=u.checkNpmConifg=u.PNPM_VERSION=void 0;const a=r,l=s(n),f=c(t),D=s(e),d=E,h=S,C=Ms;u.PNPM_VERSION="7.30.0",u.checkNpmConifg=function(){const e=D.resolve(d.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=D.resolve(f.default.homedir(),".npmrc");if((0,C.isFileExists)(e)||(0,C.isFileExists)(t))return;const n=(0,C.getNpmPath)(),r=(0,a.spawnSync)(n,["config","get","prefix"],{cwd:d.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=D.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,C.isFileExists)(u)||(0,h.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},u.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},u.isPnpmInstalled=function(){return!!l.existsSync(d.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,C.hasNpmPackInPaths)("pnpm",[d.HVIGOR_WRAPPER_TOOLS_HOME])},u.executeInstallPnpm=function(){(0,h.logInfo)(`Installing pnpm@${u.PNPM_VERSION}...`);const e=(0,C.getNpmPath)();!function(){const e=D.resolve(d.HVIGOR_WRAPPER_TOOLS_HOME,d.DEFAULT_PACKAGE_JSON);try{l.existsSync(d.HVIGOR_WRAPPER_TOOLS_HOME)||l.mkdirSync(d.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const t={dependencies:{}};t.dependencies[d.PNPM]=u.PNPM_VERSION,l.writeFileSync(e,JSON.stringify(t))}catch(t){(0,h.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${e} failed.`)}}(),(0,C.executeCommand)(e,["install","pnpm"],{cwd:d.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,h.logInfo)("Pnpm install success.")}}(zs);var Ks=p&&p.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qs=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ys=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ks(t,e,n);return qs(t,e),t},Zs=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L,"__esModule",{value:!0});var Xs=L.initProjectWorkSpace=void 0;const Qs=Ys(n),ec=Zs(t),tc=Ys(e),nc=Zs(u),rc=j,uc=E,oc=qi,ic=Yi,sc=Zi,cc=S,ac=Ms,lc=zs;let fc,Dc,dc;function pc(e,t,n){return void 0!==n.dependencies&&(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===tc.normalize(n.dependencies[e])}Xs=L.initProjectWorkSpace=function(){if(fc=function(){const e=tc.resolve(uc.HVIGOR_PROJECT_WRAPPER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);Qs.existsSync(e)||(0,cc.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`);return(0,sc.parseJsonFile)(e)}(),dc=function(e){let t;t=function(e){const t=e.hvigorVersion;if(t.startsWith("file:")||t.endsWith(".tgz"))return!1;const n=e.dependencies,r=Object.getOwnPropertyNames(n);for(const e of r){const t=n[e];if(t.startsWith("file:")||t.endsWith(".tgz"))return!1}if(1===r.length&&"@ohos/hvigor-ohos-plugin"===r[0])return t>"2.5.0";return!1}(e)?function(e){let t=`${uc.HVIGOR_ENGINE_PACKAGE_NAME}@${e.hvigorVersion}`;const n=e.dependencies;if(n){Object.getOwnPropertyNames(n).sort().forEach((e=>{t+=`,${e}@${n[e]}`}))}return(0,ic.hash)(t)}(e):(0,ic.hash)(nc.default.cwd());return tc.resolve(ec.default.homedir(),".hvigor","project_caches",t)}(fc),Dc=function(){const e=tc.resolve(dc,uc.WORK_SPACE,uc.DEFAULT_PACKAGE_JSON);return Qs.existsSync(e)?(0,sc.parseJsonFile)(e):{dependencies:{}}}(),function(){const e=tc.resolve(uc.HVIGOR_USER_HOME,uc.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(Qs.existsSync(e))(0,sc.parseJsonFile)(e)}(),!(0,ac.hasNpmPackInPaths)(uc.HVIGOR_ENGINE_PACKAGE_NAME,[tc.join(dc,uc.WORK_SPACE)])||(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion)!==Dc.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}const t=e(fc),n=e(Dc);if(t+1!==n)return!1;for(const e in null==fc?void 0:fc.dependencies)if(!(0,ac.hasNpmPackInPaths)(e,[tc.join(dc,uc.WORK_SPACE)])||!pc(e,fc,Dc))return!1;return!0}())try{const e=nc.default.hrtime();(0,lc.checkNpmConifg)(),function(){(0,cc.logInfo)("Hvigor installing...");for(const e in fc.dependencies)fc.dependencies[e]&&(fc.dependencies[e]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.dependencies[e]));const e={dependencies:{...fc.dependencies}};e.dependencies[uc.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ac.offlinePluginConversion)(uc.HVIGOR_PROJECT_ROOT_DIR,fc.hvigorVersion);const t=tc.join(dc,uc.WORK_SPACE);try{Qs.mkdirSync(t,{recursive:!0});const n=tc.resolve(t,uc.DEFAULT_PACKAGE_JSON);Qs.writeFileSync(n,JSON.stringify(e))}catch(e){(0,cc.logErrorAndExit)(e)}(function(){const e=["config","set","store-dir",uc.HVIGOR_PNPM_STORE_PATH],t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)})(),function(){const e=["install"];(0,oc.isCI)()&&e.push("--no-frozen-lockfile");const t={cwd:tc.join(dc,uc.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,ac.executeCommand)(uc.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,t)}(),(0,cc.logInfo)("Hvigor install success.")}();const t=nc.default.hrtime(e);rc.hvigorTrace.HVIGOR_INSTALL_TIME=1e9*t[0]+t[1]}catch(e){!function(){const e=tc.join(dc,uc.WORK_SPACE);if((0,cc.logInfo)("Hvigor cleaning..."),!Qs.existsSync(e))return;const t=Qs.readdirSync(e);if(!t||0===t.length)return;const n=tc.resolve(dc,"node_modules","@ohos","hvigor","bin","hvigor.js");Qs.existsSync(n)&&(0,ac.executeCommand)(nc.default.argv[0],[n,"--stop-daemon"],{});try{t.forEach((t=>{Qs.rmSync(tc.resolve(e,t),{recursive:!0})}))}catch(t){(0,cc.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${e}.`)}}()}return dc},function(){zs.environmentHandler(),zs.isPnpmInstalled()||(zs.checkNpmConifg(),zs.executeInstallPnpm());const t=Xs();b(e.join(t,E.WORK_SPACE))}(); \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw b/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw deleted file mode 100755 index 1f9378f2393618e98c87f3a0c4a70477c64da2be..0000000000000000000000000000000000000000 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -# ---------------------------------------------------------------------------- -# Hvigor startup script, version 1.0.0 -# -# Required ENV vars: -# ------------------ -# NODE_HOME - location of a Node home dir -# or -# Add /usr/local/nodejs/bin to the PATH environment variable -# ---------------------------------------------------------------------------- - -HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) -HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js -warn() { - echo "" - echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -error() { - echo "" - echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" -} - -fail() { - error "$@" - exit 1 -} - -# Determine node to start hvigor wrapper script -if [ -n "${NODE_HOME}" ];then - EXECUTABLE_NODE="${NODE_HOME}/bin/node" - if [ ! -x "$EXECUTABLE_NODE" ];then - fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" - fi -else - EXECUTABLE_NODE="node" - which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" -fi - -# Check hvigor wrapper script -if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then - fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" -fi - -# start hvigor-wrapper script -exec "${EXECUTABLE_NODE}" \ - "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw.bat b/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw.bat deleted file mode 100644 index 015ad7171d03a3c644d8ca0202c6d72313ba2a34..0000000000000000000000000000000000000000 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/hvigorw.bat +++ /dev/null @@ -1,77 +0,0 @@ -:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Hvigor startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js -set NODE_EXE=node.exe - -goto start - -:start -@rem Find node.exe -if defined NODE_HOME goto findNodeFromNodeHome - -%NODE_EXE% --version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:findNodeFromNodeHome -set NODE_HOME=%NODE_HOME:"=% -set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% - -if exist "%NODE_EXE_PATH%" goto execute -echo. -echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. -echo. -echo Please set the NODE_HOME variable in your environment to match the -echo location of your NodeJs installation. - -goto fail - -:execute -@rem Execute hvigor -"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* - -if "%ERRORLEVEL%" == "0" goto hvigorwEnd - -:fail -exit /b 1 - -:hvigorwEnd -if "%OS%" == "Windows_NT" endlocal - -:end diff --git a/packages/webview_flutter/webview_flutter_ohos/example/ohos/oh-package.json5 b/packages/webview_flutter/webview_flutter_ohos/example/ohos/oh-package.json5 index 367f9abfea99951e2df2c97bf41280d5fc972878..ac46745e1c6ce124b6a2c2cfba299f9525beb089 100644 --- a/packages/webview_flutter/webview_flutter_ohos/example/ohos/oh-package.json5 +++ b/packages/webview_flutter/webview_flutter_ohos/example/ohos/oh-package.json5 @@ -1,4 +1,5 @@ { + "modelVersion": "5.0.0", "license": "", "devDependencies": { "@ohos/hypium": "1.0.6" diff --git a/packages/webview_flutter/webview_flutter_ohos/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_ohos/example/pubspec.yaml index 5bbd1b54fa6aeb7f6f5053d88b69d8ee388a362e..2e9c73ee27fc564f9a2a0a6393679d56960495bc 100644 --- a/packages/webview_flutter/webview_flutter_ohos/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_ohos/example/pubspec.yaml @@ -32,11 +32,12 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_platform_interface: ^2.4.0 dependency_overrides: path_provider_ohos: path: ../../../path_provider/path_provider_ohos + webview_flutter_platform_interface: + path: ../../webview_flutter_platform_interface dev_dependencies: espresso: ^0.2.0 diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart new file mode 100644 index 0000000000000000000000000000000000000000..5fcd18a67cf50b963017dfe08f93725419477248 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos.dart @@ -0,0 +1,83 @@ +// Copyright 2013 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. + +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart'; +import '../instance_manager.dart'; +import 'webview_ohos_widget.dart'; + +/// Builds an Ohos webview. +/// +/// This is used as the default implementation for [WebView.platform] on Ohos. It uses +/// an [OhosView] to embed the webview in the widget hierarchy, and uses a method channel to +/// communicate with the platform code. +class OhosWebView implements WebViewPlatform { + /// Constructs an [OhosWebView]. + OhosWebView({@visibleForTesting InstanceManager? instanceManager}) + : instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Maintains instances used to communicate with the native objects they + /// represent. + @protected + final InstanceManager instanceManager; + + @override + Widget build({ + required BuildContext context, + required CreationParams creationParams, + required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + required JavascriptChannelRegistry javascriptChannelRegistry, + WebViewPlatformCreatedCallback? onWebViewPlatformCreated, + Set>? gestureRecognizers, + }) { + return WebViewOhosWidget( + creationParams: creationParams, + callbacksHandler: webViewPlatformCallbacksHandler, + javascriptChannelRegistry: javascriptChannelRegistry, + onBuildWidget: (WebViewOhosPlatformController controller) { + return GestureDetector( + // We prevent text selection by intercepting the long press event. + // This is a temporary stop gap due to issues with text selection on Ohos: + // https://github.com/flutter/flutter/issues/24585 - the text selection + // dialog is not responding to touch events. + // https://github.com/flutter/flutter/issues/24584 - the text selection + // handles are not showing. + // TODO(amirh): remove this when the issues above are fixed. + onLongPress: () {}, + excludeFromSemantics: true, + child: OhosView( + viewType: 'plugins.flutter.io/webview', + onPlatformViewCreated: (int id) { + if (onWebViewPlatformCreated != null) { + onWebViewPlatformCreated(controller); + } + }, + gestureRecognizers: gestureRecognizers, + layoutDirection: + Directionality.maybeOf(context) ?? TextDirection.rtl, + creationParams: instanceManager.getIdentifier(controller.webView), + creationParamsCodec: const StandardMessageCodec(), + ), + ); + }, + ); + } + + @override + Future clearCookies() { + if (WebViewCookieManagerPlatform.instance == null) { + throw Exception( + 'Could not clear cookies as no implementation for WebViewCookieManagerPlatform has been registered.'); + } + return WebViewCookieManagerPlatform.instance!.clearCookies(); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart new file mode 100644 index 0000000000000000000000000000000000000000..2474255e5a596312b28ab7c6b58ba0744627a881 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_cookie_manager.dart @@ -0,0 +1,44 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart' as ohos_webview; + +/// Handles all cookie operations for the current platform. +class WebViewOhosCookieManager extends WebViewCookieManagerPlatform { + /// Constructs a [WebViewOhosCookieManager]. + WebViewOhosCookieManager({ + @visibleForTesting ohos_webview.CookieManager? cookieManager, + }) : _cookieManager = cookieManager ?? ohos_webview.CookieManager.instance; + + final ohos_webview.CookieManager _cookieManager; + + @override + Future clearCookies() => _cookieManager.removeAllCookies(); + + @override + Future setCookie(WebViewCookie cookie) { + if (!_isValidPath(cookie.path)) { + throw ArgumentError( + 'The path property for the provided cookie was not given a legal value.'); + } + return _cookieManager.setCookie( + cookie.domain, + '${Uri.encodeComponent(cookie.name)}=${Uri.encodeComponent(cookie.value)}; path=${cookie.path}', + ); + } + + bool _isValidPath(String path) { + // Permitted ranges based on RFC6265bis: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-02#section-4.1.1 + for (final int char in path.codeUnits) { + if ((char < 0x20 || char > 0x3A) && (char < 0x3C || char > 0x7E)) { + return false; + } + } + return true; + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..36d9ac9366dfcabbef3c62b74bc85c7bfeb94d19 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_ohos_widget.dart @@ -0,0 +1,668 @@ +// Copyright 2013 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. + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart' as ohos_webview; +import '../weak_reference_utils.dart'; +import 'webview_ohos_cookie_manager.dart'; + +/// Creates a [Widget] with a [ohos_webview.WebView]. +class WebViewOhosWidget extends StatefulWidget { + /// Constructs a [WebViewOhosWidget]. + const WebViewOhosWidget({ + super.key, + required this.creationParams, + required this.callbacksHandler, + required this.javascriptChannelRegistry, + required this.onBuildWidget, + @visibleForTesting this.webViewProxy = const WebViewProxy(), + @visibleForTesting + this.flutterAssetManager = const ohos_webview.FlutterAssetManager(), + @visibleForTesting this.webStorage, + }); + + /// Initial parameters used to setup the WebView. + final CreationParams creationParams; + + /// Handles callbacks that are made by [ohos_webview.WebViewClient], [ohos_webview.DownloadListener], and [ohos_webview.WebChromeClient]. + final WebViewPlatformCallbacksHandler callbacksHandler; + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; + + /// Handles constructing [ohos_webview.WebView]s and calling static methods. + /// + /// This should only be changed for testing purposes. + final WebViewProxy webViewProxy; + + /// Manages access to Flutter assets that are part of the Ohos App bundle. + /// + /// This should only be changed for testing purposes. + final ohos_webview.FlutterAssetManager flutterAssetManager; + + /// Callback to build a widget once [ohos_webview.WebView] has been initialized. + final Widget Function(WebViewOhosPlatformController controller) + onBuildWidget; + + /// Manages the JavaScript storage APIs. + final ohos_webview.WebStorage? webStorage; + + @override + State createState() => _WebViewOhosWidgetState(); +} + +class _WebViewOhosWidgetState extends State { + late final WebViewOhosPlatformController controller; + + @override + void initState() { + super.initState(); + controller = WebViewOhosPlatformController( + creationParams: widget.creationParams, + callbacksHandler: widget.callbacksHandler, + javascriptChannelRegistry: widget.javascriptChannelRegistry, + webViewProxy: widget.webViewProxy, + flutterAssetManager: widget.flutterAssetManager, + webStorage: widget.webStorage, + ); + } + + @override + Widget build(BuildContext context) { + return widget.onBuildWidget(controller); + } +} + +/// Implementation of [WebViewPlatformController] with the Ohos WebView api. +class WebViewOhosPlatformController extends WebViewPlatformController { + /// Construct a [WebViewOhosPlatformController]. + WebViewOhosPlatformController({ + required CreationParams creationParams, + required this.callbacksHandler, + required this.javascriptChannelRegistry, + @visibleForTesting this.webViewProxy = const WebViewProxy(), + @visibleForTesting + this.flutterAssetManager = const ohos_webview.FlutterAssetManager(), + @visibleForTesting ohos_webview.WebStorage? webStorage, + }) : webStorage = webStorage ?? ohos_webview.WebStorage.instance, + assert(creationParams.webSettings?.hasNavigationDelegate != null), + super(callbacksHandler) { + webView = webViewProxy.createWebView(); + + webView.settings.setDomStorageEnabled(true); + webView.settings.setJavaScriptCanOpenWindowsAutomatically(true); + webView.settings.setSupportMultipleWindows(true); + webView.settings.setLoadWithOverviewMode(true); + webView.settings.setUseWideViewPort(true); + webView.settings.setDisplayZoomControls(false); + webView.settings.setBuiltInZoomControls(true); + + _setCreationParams(creationParams); + webView.setDownloadListener(downloadListener); + webView.setWebChromeClient(webChromeClient); + webView.setWebViewClient(webViewClient); + + final String? initialUrl = creationParams.initialUrl; + if (initialUrl != null) { + loadUrl(initialUrl, {}); + } + } + + final Map _javaScriptChannels = + {}; + + late final ohos_webview.WebViewClient _webViewClient = + webViewProxy.createWebViewClient( + onPageStarted: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?.callbacksHandler.onPageStarted(url); + }; + }), + onPageFinished: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?.callbacksHandler.onPageFinished(url); + }; + }), + onReceivedError: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return ( + _, + int errorCode, + String description, + String failingUrl, + ) { + weakReference.target?.callbacksHandler + .onWebResourceError(WebResourceError( + errorCode: errorCode, + description: description, + failingUrl: failingUrl, + errorType: _errorCodeToErrorType(errorCode), + )); + }; + }), + onReceivedRequestError: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return ( + _, + ohos_webview.WebResourceRequest request, + ohos_webview.WebResourceError error, + ) { + if (request.isForMainFrame) { + weakReference.target?.callbacksHandler + .onWebResourceError(WebResourceError( + errorCode: error.errorCode, + description: error.description, + failingUrl: request.url, + errorType: _errorCodeToErrorType(error.errorCode), + )); + } + }; + }), + urlLoading: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, String url) { + weakReference.target?._handleNavigationRequest( + url: url, + isForMainFrame: true, + ); + }; + }), + requestLoading: withWeakReferenceTo(this, ( + WeakReference weakReference, + ) { + return (_, ohos_webview.WebResourceRequest request) { + weakReference.target?._handleNavigationRequest( + url: request.url, + isForMainFrame: request.isForMainFrame, + ); + }; + }), + ); + + bool _hasNavigationDelegate = false; + bool _hasProgressTracking = false; + + /// Represents the WebView maintained by platform code. + late final ohos_webview.WebView webView; + + /// Handles callbacks that are made by [ohos_webview.WebViewClient], [ohos_webview.DownloadListener], and [ohos_webview.WebChromeClient]. + final WebViewPlatformCallbacksHandler callbacksHandler; + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; + + /// Handles constructing [ohos_webview.WebView]s and calling static methods. + /// + /// This should only be changed for testing purposes. + final WebViewProxy webViewProxy; + + /// Manages access to Flutter assets that are part of the Ohos App bundle. + /// + /// This should only be changed for testing purposes. + final ohos_webview.FlutterAssetManager flutterAssetManager; + + /// Receives callbacks when content should be downloaded instead. + @visibleForTesting + late final ohos_webview.DownloadListener downloadListener = + ohos_webview.DownloadListener( + onDownloadStart: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return ( + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) { + weakReference.target?._handleNavigationRequest( + url: url, + isForMainFrame: true, + ); + }; + }, + ), + ); + + /// Handles JavaScript dialogs, favicons, titles, new windows, and the progress for [ohos_webview.WebView]. + @visibleForTesting + late final ohos_webview.WebChromeClient webChromeClient = + ohos_webview.WebChromeClient( + onProgressChanged: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return (_, int progress) { + final WebViewOhosPlatformController? controller = + weakReference.target; + if (controller != null && controller._hasProgressTracking) { + controller.callbacksHandler.onProgress(progress); + } + }; + }, + )); + + /// Manages the JavaScript storage APIs. + final ohos_webview.WebStorage webStorage; + + /// Receive various notifications and requests for [ohos_webview.WebView]. + @visibleForTesting + ohos_webview.WebViewClient get webViewClient => _webViewClient; + + @override + Future loadHtmlString(String html, {String? baseUrl}) { + return webView.loadDataWithBaseUrl( + baseUrl: baseUrl, + data: html, + mimeType: 'text/html', + ); + } + + @override + Future loadFile(String absoluteFilePath) { + final String url = absoluteFilePath.startsWith('file://') + ? absoluteFilePath + : 'file://$absoluteFilePath'; + + webView.settings.setAllowFileAccess(true); + return webView.loadUrl(url, {}); + } + + @override + Future loadFlutterAsset(String key) async { + final String assetFilePath = + await flutterAssetManager.getAssetFilePathByName(key); + final List pathElements = assetFilePath.split('/'); + final String fileName = pathElements.removeLast(); + final List paths = + await flutterAssetManager.list(pathElements.join('/')); + + if (!paths.contains(fileName)) { + throw ArgumentError( + 'Asset for key "$key" not found.', + 'key', + ); + } + +/* return webView.loadUrl( + 'file:///ohos_asset/$assetFilePath', + {}, + );*/ + + webView.settings.setAllowFileAccess(true); + final String url = "resources/rawfile/" + assetFilePath; + return webView.loadUrl(url, {}); + } + + @override + Future loadUrl( + String url, + Map? headers, + ) { + return webView.loadUrl(url, headers ?? {}); + } + + /// When making a POST request, headers are ignored. As a workaround, make + /// the request manually and load the response data using [loadHTMLString]. + @override + Future loadRequest( + WebViewRequest request, + ) async { + if (!request.uri.hasScheme) { + throw ArgumentError('WebViewRequest#uri is required to have a scheme.'); + } + switch (request.method) { + case WebViewRequestMethod.get: + return webView.loadUrl(request.uri.toString(), request.headers); + case WebViewRequestMethod.post: + return webView.postUrl( + request.uri.toString(), request.body ?? Uint8List(0)); + } + // The enum comes from a different package, which could get a new value at + // any time, so a fallback case is necessary. Since there is no reasonable + // default behavior, throw to alert the client that they need an updated + // version. This is deliberately outside the switch rather than a `default` + // so that the linter will flag the switch as needing an update. + // ignore: dead_code + throw UnimplementedError( + 'This version of webview_ohos_widget currently has no ' + 'implementation for HTTP method ${request.method.serialize()} in ' + 'loadRequest.'); + } + + @override + Future currentUrl() => webView.getUrl(); + + @override + Future canGoBack() => webView.canGoBack(); + + @override + Future canGoForward() => webView.canGoForward(); + + @override + Future goBack() => webView.goBack(); + + @override + Future goForward() => webView.goForward(); + + @override + Future reload() => webView.reload(); + + @override + Future clearCache() { + webView.clearCache(true); + return webStorage.deleteAllData(); + } + + @override + Future updateSettings(WebSettings setting) async { + _hasProgressTracking = setting.hasProgressTracking ?? _hasProgressTracking; + await Future.wait(>[ + _setUserAgent(setting.userAgent), + if (setting.hasNavigationDelegate != null) + _setHasNavigationDelegate(setting.hasNavigationDelegate!), + if (setting.javascriptMode != null) + _setJavaScriptMode(setting.javascriptMode!), + if (setting.debuggingEnabled != null) + _setDebuggingEnabled(setting.debuggingEnabled!), + if (setting.zoomEnabled != null) _setZoomEnabled(setting.zoomEnabled!), + ]); + } + + @override + Future evaluateJavascript(String javascript) async { + return runJavascriptReturningResult(javascript); + } + + @override + Future runJavascript(String javascript) async { + await webView.evaluateJavascript(javascript); + } + + @override + Future runJavascriptReturningResult(String javascript) async { + return await webView.evaluateJavascript(javascript) ?? ''; + } + + @override + Future addJavascriptChannels(Set javascriptChannelNames) { + return Future.wait( + javascriptChannelNames.where( + (String channelName) { + return !_javaScriptChannels.containsKey(channelName); + }, + ).map>( + (String channelName) { + final WebViewOhosJavaScriptChannel javaScriptChannel = + WebViewOhosJavaScriptChannel( + channelName, javascriptChannelRegistry); + _javaScriptChannels[channelName] = javaScriptChannel; + return webView.addJavaScriptChannel(javaScriptChannel); + }, + ), + ); + } + + @override + Future removeJavascriptChannels( + Set javascriptChannelNames, + ) { + return Future.wait( + javascriptChannelNames.where( + (String channelName) { + return _javaScriptChannels.containsKey(channelName); + }, + ).map>( + (String channelName) { + final WebViewOhosJavaScriptChannel javaScriptChannel = + _javaScriptChannels[channelName]!; + _javaScriptChannels.remove(channelName); + return webView.removeJavaScriptChannel(javaScriptChannel); + }, + ), + ); + } + + @override + Future getTitle() => webView.getTitle(); + + @override + Future scrollTo(int x, int y) => webView.scrollTo(x, y); + + @override + Future scrollBy(int x, int y) => webView.scrollBy(x, y); + + @override + Future getScrollX() => webView.getScrollX(); + + @override + Future getScrollY() => webView.getScrollY(); + + void _setCreationParams(CreationParams creationParams) { + final WebSettings? webSettings = creationParams.webSettings; + if (webSettings != null) { + updateSettings(webSettings); + } + + final String? userAgent = creationParams.userAgent; + if (userAgent != null) { + webView.settings.setUserAgentString(userAgent); + } + + webView.settings.setMediaPlaybackRequiresUserGesture( + creationParams.autoMediaPlaybackPolicy != + AutoMediaPlaybackPolicy.always_allow, + ); + + final Color? backgroundColor = creationParams.backgroundColor; + if (backgroundColor != null) { + //webView.setBackgroundColor(backgroundColor); + } + + addJavascriptChannels(creationParams.javascriptChannelNames); + + // TODO(BeMacized): Remove once platform implementations + // are able to register themselves (Flutter >=2.8), + // https://github.com/flutter/flutter/issues/94224 + WebViewCookieManagerPlatform.instance ??= WebViewOhosCookieManager(); + + creationParams.cookies + .forEach(WebViewCookieManagerPlatform.instance!.setCookie); + } + + Future _setHasNavigationDelegate(bool hasNavigationDelegate) { + _hasNavigationDelegate = hasNavigationDelegate; + return _webViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading( + hasNavigationDelegate, + ); + } + + Future _setJavaScriptMode(JavascriptMode mode) { + switch (mode) { + case JavascriptMode.disabled: + return webView.settings.setJavaScriptEnabled(false); + case JavascriptMode.unrestricted: + return webView.settings.setJavaScriptEnabled(true); + } + } + + Future _setDebuggingEnabled(bool debuggingEnabled) { + return webViewProxy.setWebContentsDebuggingEnabled(debuggingEnabled); + } + + Future _setUserAgent(WebSetting userAgent) { + if (userAgent.isPresent) { + // If the string is empty, the system default value will be used. + return webView.settings.setUserAgentString(userAgent.value ?? ''); + } + + return Future.value(); + } + + Future _setZoomEnabled(bool zoomEnabled) { + return webView.settings.setSupportZoom(zoomEnabled); + } + + static WebResourceErrorType _errorCodeToErrorType(int errorCode) { + switch (errorCode) { + case ohos_webview.WebViewClient.errorAuthentication: + return WebResourceErrorType.authentication; + case ohos_webview.WebViewClient.errorBadUrl: + return WebResourceErrorType.badUrl; + case ohos_webview.WebViewClient.errorConnect: + return WebResourceErrorType.connect; + case ohos_webview.WebViewClient.errorFailedSslHandshake: + return WebResourceErrorType.failedSslHandshake; + case ohos_webview.WebViewClient.errorFile: + return WebResourceErrorType.file; + case ohos_webview.WebViewClient.errorFileNotFound: + return WebResourceErrorType.fileNotFound; + case ohos_webview.WebViewClient.errorHostLookup: + return WebResourceErrorType.hostLookup; + case ohos_webview.WebViewClient.errorIO: + return WebResourceErrorType.io; + case ohos_webview.WebViewClient.errorProxyAuthentication: + return WebResourceErrorType.proxyAuthentication; + case ohos_webview.WebViewClient.errorRedirectLoop: + return WebResourceErrorType.redirectLoop; + case ohos_webview.WebViewClient.errorTimeout: + return WebResourceErrorType.timeout; + case ohos_webview.WebViewClient.errorTooManyRequests: + return WebResourceErrorType.tooManyRequests; + case ohos_webview.WebViewClient.errorUnknown: + return WebResourceErrorType.unknown; + case ohos_webview.WebViewClient.errorUnsafeResource: + return WebResourceErrorType.unsafeResource; + case ohos_webview.WebViewClient.errorUnsupportedAuthScheme: + return WebResourceErrorType.unsupportedAuthScheme; + case ohos_webview.WebViewClient.errorUnsupportedScheme: + return WebResourceErrorType.unsupportedScheme; + } + + if (errorCode < 0) { + return WebResourceErrorType.unknown; + } + + throw ArgumentError( + 'Could not find a WebResourceErrorType for errorCode: $errorCode', + ); + } + + void _handleNavigationRequest({ + required String url, + required bool isForMainFrame, + }) { + if (!_hasNavigationDelegate) { + return; + } + + final FutureOr returnValue = callbacksHandler.onNavigationRequest( + url: url, + isForMainFrame: isForMainFrame, + ); + + if (returnValue is bool && returnValue) { + loadUrl(url, {}); + } else if (returnValue is Future) { + returnValue.then((bool shouldLoadUrl) { + if (shouldLoadUrl) { + loadUrl(url, {}); + } + }); + } + } +} + +/// Exposes a channel to receive calls from javaScript. +class WebViewOhosJavaScriptChannel + extends ohos_webview.JavaScriptChannel { + /// Creates a [WebViewOhosJavaScriptChannel]. + WebViewOhosJavaScriptChannel( + super.channelName, + this.javascriptChannelRegistry, + ) : super( + postMessage: withWeakReferenceTo( + javascriptChannelRegistry, + (WeakReference weakReference) { + return (String message) { + weakReference.target?.onJavascriptChannelMessage( + channelName, + message, + ); + }; + }, + ), + ); + + /// Manages named JavaScript channels and forwarding incoming messages on the correct channel. + final JavascriptChannelRegistry javascriptChannelRegistry; +} + +/// Handles constructing [ohos_webview.WebView]s and calling static methods. +/// +/// This should only be used for testing purposes. +@visibleForTesting +class WebViewProxy { + /// Creates a [WebViewProxy]. + const WebViewProxy(); + + /// Constructs a [ohos_webview.WebView]. + ohos_webview.WebView createWebView() { + return ohos_webview.WebView(); + } + + /// Constructs a [ohos_webview.WebViewClient]. + ohos_webview.WebViewClient createWebViewClient({ + void Function(ohos_webview.WebView webView, String url)? onPageStarted, + void Function(ohos_webview.WebView webView, String url)? onPageFinished, + void Function( + ohos_webview.WebView webView, + ohos_webview.WebResourceRequest request, + ohos_webview.WebResourceError error, + )? onReceivedRequestError, + void Function( + ohos_webview.WebView webView, + int errorCode, + String description, + String failingUrl, + )? onReceivedError, + void Function(ohos_webview.WebView webView, + ohos_webview.WebResourceRequest request)? + requestLoading, + void Function(ohos_webview.WebView webView, String url)? urlLoading, + }) { + return ohos_webview.WebViewClient( + onPageStarted: onPageStarted, + onPageFinished: onPageFinished, + onReceivedRequestError: onReceivedRequestError, + onReceivedError: onReceivedError, + requestLoading: requestLoading, + urlLoading: urlLoading, + ); + } + + /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. + /// + /// This flag can be enabled in order to facilitate debugging of web layouts + /// and JavaScript code running inside WebViews. Please refer to + /// [ohos_webview.WebView] documentation for the debugging guide. The + /// default is false. + /// + /// See [ohos_webview.WebView].setWebContentsDebuggingEnabled. + Future setWebContentsDebuggingEnabled(bool enabled) { + return ohos_webview.WebView.setWebContentsDebuggingEnabled(enabled); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart new file mode 100644 index 0000000000000000000000000000000000000000..dca266fd27e9268b979b9bd3183e076a547db82e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/legacy/webview_surface_ohos.dart @@ -0,0 +1,119 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +// ignore: implementation_imports +import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart'; + +import '../ohos_webview.dart'; +import 'webview_ohos.dart'; +import 'webview_ohos_widget.dart'; + +/// Ohos [WebViewPlatform] that uses [OhosViewSurface] to build the +/// [WebView] widget. +/// +/// To use this, set [WebView.platform] to an instance of this class. +/// +/// This implementation uses [OhosViewSurface] to render the [WebView] on +/// Ohos. It solves multiple issues related to accessibility and interaction +/// with the [WebView] at the cost of some performance on Ohos versions below +/// 10. +/// +/// To support transparent backgrounds on all Ohos devices, this +/// implementation uses hybrid composition when the opacity of +/// `CreationParams.backgroundColor` is less than 1.0. See +/// https://github.com/flutter/flutter/wiki/Hybrid-Composition for more +/// information. +class SurfaceOhosWebView extends OhosWebView { + /// Constructs a [SurfaceOhosWebView]. + SurfaceOhosWebView({@visibleForTesting super.instanceManager}); + + @override + Widget build({ + required BuildContext context, + required CreationParams creationParams, + required JavascriptChannelRegistry javascriptChannelRegistry, + WebViewPlatformCreatedCallback? onWebViewPlatformCreated, + Set>? gestureRecognizers, + required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, + }) { + return WebViewOhosWidget( + creationParams: creationParams, + callbacksHandler: webViewPlatformCallbacksHandler, + javascriptChannelRegistry: javascriptChannelRegistry, + onBuildWidget: (WebViewOhosPlatformController controller) { + return PlatformViewLink( + viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return OhosViewSurface( + controller: controller as OhosViewController, + gestureRecognizers: gestureRecognizers ?? + const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + final Color? backgroundColor = creationParams.backgroundColor; + return _createViewController( + // On some Ohos devices, transparent backgrounds can cause + // rendering issues on the non hybrid composition + // OhosViewSurface. This switches the WebView to Hybrid + // Composition when the background color is not 100% opaque. + hybridComposition: + backgroundColor != null && backgroundColor.opacity < 1.0, + id: params.id, + viewType: 'plugins.flutter.io/webview', + // WebView content is not affected by the Ohos view's layout direction, + // we explicitly set it here so that the widget doesn't require an ambient + // directionality. + layoutDirection: + Directionality.maybeOf(context) ?? TextDirection.ltr, + webViewIdentifier: + instanceManager.getIdentifier(controller.webView)!, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..addOnPlatformViewCreatedListener((int id) { + if (onWebViewPlatformCreated != null) { + onWebViewPlatformCreated(controller); + } + }) + ..create(); + }, + ); + }, + ); + } + + OhosViewController _createViewController({ + required bool hybridComposition, + required int id, + required String viewType, + required TextDirection layoutDirection, + required int webViewIdentifier, + }) { + if (hybridComposition) { + return PlatformViewsService.initExpensiveOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: webViewIdentifier, + creationParamsCodec: const StandardMessageCodec(), + ); + } + return PlatformViewsService.initSurfaceOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: webViewIdentifier, + creationParamsCodec: const StandardMessageCodec(), + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_proxy.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_proxy.dart index a723db576f8e0567cfaddee222d055ae444eda23..e4d88f9ccf9de6a84a51f18651a5256ef1df2518 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_proxy.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_proxy.dart @@ -36,25 +36,41 @@ class OhosWebViewProxy { }); /// Constructs a [ohos_webview.WebView]. - final ohos_webview.WebView Function() createOhosWebView; + final ohos_webview.WebView Function({ + void Function(int left, int top, int oldLeft, int oldTop)? onScrollChanged, + }) createOhosWebView; /// Constructs a [ohos_webview.WebChromeClient]. - final ohos_webview.WebChromeClient Function( - {void Function(ohos_webview.WebView webView, int progress)? - onProgressChanged, - Future> Function( - ohos_webview.WebView webView, - ohos_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( - ohos_webview.WebChromeClient instance, - ohos_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function(String origin, - ohos_webview.GeolocationPermissionsCallback callback)? - onGeolocationPermissionsShowPrompt, - void Function(ohos_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt}) createOhosWebChromeClient; + final ohos_webview.WebChromeClient Function({ + void Function(ohos_webview.WebView webView, int progress)? + onProgressChanged, + Future> Function( + ohos_webview.WebView webView, + ohos_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + ohos_webview.WebChromeClient instance, + ohos_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function(String origin, + ohos_webview.GeolocationPermissionsCallback callback)? + onGeolocationPermissionsShowPrompt, + void Function(ohos_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function(ohos_webview.WebChromeClient instance, + ohos_webview.ConsoleMessage message)? + onConsoleMessage, + void Function( + ohos_webview.WebChromeClient instance, + ohos_webview.View view, + ohos_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(ohos_webview.WebChromeClient instance)? onHideCustomView, + Future Function(String url, String message)? onJsAlert, + Future Function(String url, String message)? onJsConfirm, + Future Function(String url, String message, String defaultValue)? + onJsPrompt, + }) createOhosWebChromeClient; /// Constructs a [ohos_webview.WebViewClient]. final ohos_webview.WebViewClient Function({ @@ -79,11 +95,16 @@ class OhosWebViewProxy { void Function(ohos_webview.WebView webView, String url)? urlLoading, void Function(ohos_webview.WebView webView, String url, bool isReload)? doUpdateVisitedHistory, + void Function( + ohos_webview.WebView webView, + ohos_webview.HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest, }) createOhosWebViewClient; /// Constructs a [ohos_webview.FlutterAssetManager]. - final ohos_webview.FlutterAssetManager Function() - createFlutterAssetManager; + final ohos_webview.FlutterAssetManager Function() createFlutterAssetManager; /// Constructs a [ohos_webview.JavaScriptChannel]. final ohos_webview.JavaScriptChannel Function( diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.dart index f208803406290052a552afd4620056890bcff82d..551b5b545d59a85455a1ce9484eb81434057a446 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.dart @@ -24,7 +24,8 @@ import 'ohos_webview.g.dart'; import 'ohos_webview_api_impls.dart'; import 'instance_manager.dart'; -export 'ohos_webview_api_impls.dart' show FileChooserMode; +export 'ohos_webview_api_impls.dart' + show ConsoleMessage, ConsoleMessageLevel, FileChooserMode; /// Root of the TS class hierarchy. class OhosObject with Copyable { @@ -140,6 +141,7 @@ class WebView extends OhosObject { /// any effect and should not be exposed publicly. More info here: /// https://github.com/flutter/flutter/issues/108106 WebView({ + this.onScrollChanged, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -152,6 +154,7 @@ class WebView extends OhosObject { /// create copies. @protected WebView.detached({ + this.onScrollChanged, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -163,6 +166,18 @@ class WebView extends OhosObject { /// The [WebSettings] object used to control the settings for this WebView. late final WebSettings settings = WebSettings(this); + /// Called in response to an internal scroll in this view + /// (i.e., the view scrolled its own contents). + /// + /// This is typically as a result of [scrollBy] or [scrollTo] + /// having been called. + final void Function( + int left, + int top, + int oldLeft, + int oldTop, + )? onScrollChanged; + /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. /// /// This flag can be enabled in order to facilitate debugging of web layouts @@ -446,6 +461,7 @@ class WebView extends OhosObject { @override WebView copy() { return WebView.detached( + onScrollChanged: onScrollChanged, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -696,6 +712,11 @@ class WebSettings extends OhosObject { return api.setSetTextZoomFromInstance(this, textZoom); } + /// Gets the WebView's user-agent string. + Future getUserAgentString() { + return api.getUserAgentStringFromInstance(this); + } + @override WebSettings copy() { return WebSettings.detached( @@ -765,6 +786,7 @@ class WebViewClient extends OhosObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -785,57 +807,61 @@ class WebViewClient extends OhosObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, super.binaryMessenger, super.instanceManager, }) : super.detached(); + /// @ohos.web.netErrorList (ArkWeb网络协议栈错误列表) + /// https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-neterrorlist-V5 + /// User authentication failed on server. - static const int errorAuthentication = 2300094; + static const int errorAuthentication = -100; /// Malformed URL. - static const int errorBadUrl = 2300003; + static const int errorBadUrl = -300; /// Failed to connect to the server. - static const int errorConnect = 2300007; + static const int errorConnect = -106; /// Failed to perform SSL handshake. - static const int errorFailedSslHandshake = -11; + static const int errorFailedSslHandshake = -148; /// Generic file error. - static const int errorFile = -13; + static const int errorFile = -16; /// File not found. - static const int errorFileNotFound = 2301002; + static const int errorFileNotFound = -808; /// Server or proxy hostname lookup failed. - static const int errorHostLookup = 2300005; + static const int errorHostLookup = -121; /// Failed to read or write to the server. - static const int errorIO = -7; + static const int errorIO = -1; /// User authentication failed on proxy. - static const int errorProxyAuthentication = -5; + static const int errorProxyAuthentication = -115; /// Too many redirects. - static const int errorRedirectLoop = 2300047; + static const int errorRedirectLoop = -303; /// Connection timed out. - static const int errorTimeout = 2300028; + static const int errorTimeout = -409; /// Too many requests during this load. - static const int errorTooManyRequests = 21900004; + static const int errorTooManyRequests = -114; /// Generic error. - static const int errorUnknown = 2300999; + static const int errorUnknown = -9; /// Resource load was canceled by Safe Browsing. - static const int errorUnsafeResource = -16; + static const int errorUnsafeResource = -311; /// Unsupported authentication scheme (not basic or digest). - static const int errorUnsupportedAuthScheme = -3; + static const int errorUnsupportedAuthScheme = -339; /// Unsupported URI scheme. - static const int errorUnsupportedScheme = -10; + static const int errorUnsupportedScheme = -301; /// Pigeon Host Api implementation for [WebViewClient]. @visibleForTesting @@ -901,6 +927,14 @@ class WebViewClient extends OhosObject { final void Function(WebView webView, String url, bool isReload)? doUpdateVisitedHistory; + /// This callback is only called for requests that require HTTP authentication. + final void Function( + WebView webView, + HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest; + /// Sets the required synchronous return value for the TS method, /// `WebViewClient.shouldOverrideUrlLoading(...)`. /// @@ -929,6 +963,7 @@ class WebViewClient extends OhosObject { requestLoading: requestLoading, urlLoading: urlLoading, doUpdateVisitedHistory: doUpdateVisitedHistory, + onReceivedHttpAuthRequest: onReceivedHttpAuthRequest, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -994,6 +1029,18 @@ typedef GeolocationPermissionsHidePrompt = void Function( WebChromeClient instance, ); +/// Signature for the callback that is responsible for showing a custom view. +typedef ShowCustomViewCallback = void Function( + WebChromeClient instance, + View view, + CustomViewCallback callback, +); + +/// Signature for the callback that is responsible for hiding a custom view. +typedef HideCustomViewCallback = void Function( + WebChromeClient instance, +); + /// Handles JavaScript dialogs, favicons, titles, and the progress for [WebView]. class WebChromeClient extends OhosObject { /// Constructs a [WebChromeClient]. @@ -1003,6 +1050,12 @@ class WebChromeClient extends OhosObject { this.onPermissionRequest, this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, + this.onShowCustomView, + this.onHideCustomView, + this.onConsoleMessage, + this.onJsAlert, + this.onJsConfirm, + this.onJsPrompt, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -1022,6 +1075,12 @@ class WebChromeClient extends OhosObject { this.onPermissionRequest, this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, + this.onShowCustomView, + this.onHideCustomView, + this.onConsoleMessage, + this.onJsAlert, + this.onJsConfirm, + this.onJsPrompt, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -1062,9 +1121,35 @@ class WebChromeClient extends OhosObject { /// Notify the host application that a request for Geolocation permissions, /// made with a previous call to [onGeolocationPermissionsShowPrompt] has been /// canceled. - final void Function( - WebChromeClient instance, - )? onGeolocationPermissionsHidePrompt; + final GeolocationPermissionsHidePrompt? onGeolocationPermissionsHidePrompt; + + /// Notify the host application that the current page has entered full screen + /// mode. + /// + /// After this call, web content will no longer be rendered in the WebView, + /// but will instead be rendered in `view`. + final ShowCustomViewCallback? onShowCustomView; + + /// Notify the host application that the current page has exited full screen + /// mode. + final HideCustomViewCallback? onHideCustomView; + + /// Report a JavaScript console message to the host application. + final void Function(WebChromeClient instance, ConsoleMessage message)? + onConsoleMessage; + + /// Notify the host application that the web page wants to display a + /// JavaScript alert() dialog. + final Future Function(String url, String message)? onJsAlert; + + /// Notify the host application that the web page wants to display a + /// JavaScript confirm() dialog. + final Future Function(String url, String message)? onJsConfirm; + + /// Notify the host application that the web page wants to display a + /// JavaScript prompt() dialog. + final Future Function( + String url, String message, String defaultValue)? onJsPrompt; /// Sets the required synchronous return value for the TS method, /// `WebChromeClient.onShowFileChooser(...)`. @@ -1095,13 +1180,119 @@ class WebChromeClient extends OhosObject { ); } + /// Sets the required synchronous return value for the Java method, + /// `WebChromeClient.onShowFileChooser(...)`. + /// + /// The Java method, `WebChromeClient.onConsoleMessage(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the Java method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onConsoleMessage] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnConsoleMessage( + bool value, + ) { + if (value && onConsoleMessage == null) { + throw StateError( + 'Setting this to true requires `onConsoleMessage` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnConsoleMessageFromInstance( + this, + value, + ); + } + + /// Sets the required synchronous return value for the ets method, + /// `WebChromeClient.onJsAlert(...)`. + /// + /// The ets method, `WebChromeClient.onJsAlert(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the ets method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsAlert] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsAlert( + bool value, + ) { + if (value && onJsAlert == null) { + throw StateError( + 'Setting this to true requires `onJsAlert` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsAlertFromInstance(this, value); + } + + /// Sets the required synchronous return value for the ets method, + /// `WebChromeClient.onJsConfirm(...)`. + /// + /// The ets method, `WebChromeClient.onJsConfirm(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the ets method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsConfirm] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsConfirm( + bool value, + ) { + if (value && onJsConfirm == null) { + throw StateError( + 'Setting this to true requires `onJsConfirm` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsConfirmFromInstance(this, value); + } + + /// Sets the required synchronous return value for the ets method, + /// `WebChromeClient.onJsPrompt(...)`. + /// + /// The ets method, `WebChromeClient.onJsPrompt(...)`, requires + /// a boolean to be returned and this method sets the returned value for all + /// calls to the ets method. + /// + /// Setting this to true indicates that the client is handling all console + /// messages. + /// + /// Requires [onJsPrompt] to be nonnull. + /// + /// Defaults to false. + Future setSynchronousReturnValueForOnJsPrompt( + bool value, + ) { + if (value && onJsPrompt == null) { + throw StateError( + 'Setting this to true requires `onJsPrompt` to be nonnull.', + ); + } + return api.setSynchronousReturnValueForOnJsPromptFromInstance(this, value); + } + @override WebChromeClient copy() { return WebChromeClient.detached( onProgressChanged: onProgressChanged, onShowFileChooser: onShowFileChooser, + onPermissionRequest: onPermissionRequest, onGeolocationPermissionsShowPrompt: onGeolocationPermissionsShowPrompt, onGeolocationPermissionsHidePrompt: onGeolocationPermissionsHidePrompt, + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, + onConsoleMessage: onConsoleMessage, + onJsAlert: onJsAlert, + onJsConfirm: onJsConfirm, + onJsPrompt: onJsPrompt, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -1130,14 +1321,14 @@ class PermissionRequest extends OhosObject { super.detached(); /// Resource belongs to audio capture device, like microphone. - static const String audioCapture = 'ohos.webkit.resource.AUDIO_CAPTURE'; + static const String audioCapture = 'TYPE_AUDIO_CAPTURE'; /// Resource will allow sysex messages to be sent to or received from MIDI /// devices. - static const String midiSysex = 'ohos.webkit.resource.MIDI_SYSEX'; + static const String midiSysex = 'TYPE_MIDI_SYSEX'; /// Resource belongs to video capture device, like camera. - static const String videoCapture = 'ohos.webkit.resource.VIDEO_CAPTURE'; + static const String videoCapture = 'TYPE_VIDEO_CAPTURE'; /// Resource belongs to protected media identifier. static const String protectedMediaId = @@ -1326,3 +1517,99 @@ class WebStorage extends OhosObject { ); } } + +/// The basic building block for user interface components. +/// +/// See https://developer.android.com/reference/android/view/View. +class View extends OhosObject { + /// Instantiates a [View] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + View.detached({super.binaryMessenger, super.instanceManager}) + : super.detached(); + + @override + View copy() { + return View.detached( + binaryMessenger: _api.binaryMessenger, + instanceManager: _api.instanceManager, + ); + } +} + +/// A callback interface used by the host application to notify the current page +/// that its custom view has been dismissed. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallback extends OhosObject { + /// Instantiates a [CustomViewCallback] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + CustomViewCallback.detached({ + super.binaryMessenger, + super.instanceManager, + }) : _customViewCallbackApi = CustomViewCallbackHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + + final CustomViewCallbackHostApiImpl _customViewCallbackApi; + + /// Invoked when the host application dismisses the custom view. + Future onCustomViewHidden() { + return _customViewCallbackApi.onCustomViewHiddenFromInstances(this); + } + + @override + CustomViewCallback copy() { + return CustomViewCallback.detached( + binaryMessenger: _customViewCallbackApi.binaryMessenger, + instanceManager: _customViewCallbackApi.instanceManager, + ); + } +} + +/// Represents a request for HTTP authentication. +/// +/// Instances of this class are created by the [WebView] and passed to +/// [WebViewClient.onReceivedHttpAuthRequest]. The host application must call +/// either [HttpAuthHandler.proceed] or [HttpAuthHandler.cancel] to set the +/// WebView's response to the request. +class HttpAuthHandler extends OhosObject { + /// Constructs a [HttpAuthHandler]. + HttpAuthHandler({ + super.binaryMessenger, + super.instanceManager, + }) : super.detached(); + + /// Pigeon Host Api implementation for [HttpAuthHandler]. + @visibleForTesting + static HttpAuthHandlerHostApiImpl api = HttpAuthHandlerHostApiImpl(); + + /// Instructs the WebView to cancel the authentication request. + Future cancel() { + return api.cancelFromInstance(this); + } + + /// Instructs the WebView to proceed with the authentication with the provided + /// credentials. + Future proceed(String username, String password) { + return api.proceedFromInstance(this, username, password); + } + + /// Gets whether the credentials stored for the current host are suitable for + /// use. + /// + /// Credentials are not suitable if they have previously been rejected by the + /// server for the current request. + Future useHttpAuthUsernamePassword() { + return api.useHttpAuthUsernamePasswordFromInstance(this); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.g.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.g.dart index f368663369701555396d120f780e465b95deab89..fbae7a0dc7c50a1bf5ba4babf7d1b22a569898b9 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview.g.dart @@ -32,6 +32,42 @@ enum FileChooserMode { save, } +/// Indicates the type of message logged to the console. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel. +enum ConsoleMessageLevel { + /// Indicates a message is logged for debugging. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. + debug, + + /// Indicates a message is provided as an error. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. + error, + + /// Indicates a message is provided as a basic log message. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. + log, + + /// Indicates a message is provided as a tip. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. + tip, + + /// Indicates a message is provided as a warning. + /// + /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. + warning, + + /// Indicates a message with an unknown level. + /// + /// This does not represent an actual value provided by the platform and only + /// indicates a value was provided that isn't currently supported. + unknown, +} + class WebResourceRequestData { WebResourceRequestData({ required this.url, @@ -131,6 +167,45 @@ class WebViewPoint { } } +/// Represents a JavaScript console message from WebCore. +/// +/// See https://developer.android.com/reference/android/webkit/ConsoleMessage +class ConsoleMessage { + ConsoleMessage({ + required this.lineNumber, + required this.message, + required this.level, + required this.sourceId, + }); + + int lineNumber; + + String message; + + ConsoleMessageLevel level; + + String sourceId; + + Object encode() { + return [ + lineNumber, + message, + level.index, + sourceId, + ]; + } + + static ConsoleMessage decode(Object result) { + result as List; + return ConsoleMessage( + lineNumber: result[0]! as int, + message: result[1]! as String, + level: ConsoleMessageLevel.values[result[2]! as int], + sourceId: result[3]! as String, + ); + } +} + /// Host API for managing the native `InstanceManager`. class InstanceManagerHostApi { /// Constructor for [InstanceManagerHostApi]. The [binaryMessenger] named argument is @@ -1026,6 +1101,9 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); + void onScrollChanged( + int webViewInstanceId, int left, int top, int oldLeft, int oldTop); + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1048,6 +1126,39 @@ abstract class WebViewFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null.'); + final List args = (message as List?)!; + final int? arg_webViewInstanceId = (args[0] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_left = (args[1] as int?); + assert(arg_left != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_top = (args[2] as int?); + assert(arg_top != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldLeft = (args[3] as int?); + assert(arg_oldLeft != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldTop = (args[4] as int?); + assert(arg_oldTop != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + api.onScrollChanged(arg_webViewInstanceId!, arg_left!, arg_top!, + arg_oldLeft!, arg_oldTop!); + return; + }); + } + } } } @@ -1413,6 +1524,34 @@ class WebSettingsHostApi { return; } } + + Future getUserAgentString(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebSettingsHostApi.getUserAgentString', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as String?)!; + } + } } class JavaScriptChannelHostApi { @@ -1590,6 +1729,9 @@ abstract class WebViewClientFlutterApi { void doUpdateVisitedHistory( int instanceId, int webViewInstanceId, String url, bool isReload); + void onReceivedHttpAuthRequest(int instanceId, int webViewInstanceId, + int httpAuthHandlerInstanceId, String host, String realm); + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1793,6 +1935,39 @@ abstract class WebViewClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_webViewInstanceId = (args[1] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_httpAuthHandlerInstanceId = (args[2] as int?); + assert(arg_httpAuthHandlerInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final String? arg_host = (args[3] as String?); + assert(arg_host != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + final String? arg_realm = (args[4] as String?); + assert(arg_realm != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + api.onReceivedHttpAuthRequest(arg_instanceId!, arg_webViewInstanceId!, + arg_httpAuthHandlerInstanceId!, arg_host!, arg_realm!); + return; + }); + } + } } } @@ -1933,6 +2108,102 @@ class WebChromeClientHostApi { return; } } + + Future setSynchronousReturnValueForOnConsoleMessage( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsAlert( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsConfirm( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + Future setSynchronousReturnValueForOnJsPrompt( + int arg_instanceId, bool arg_value) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } } class FlutterAssetManagerHostApi { @@ -2002,8 +2273,31 @@ class FlutterAssetManagerHostApi { } } +class _WebChromeClientFlutterApiCodec extends StandardMessageCodec { + const _WebChromeClientFlutterApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is ConsoleMessage) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return ConsoleMessage.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + abstract class WebChromeClientFlutterApi { - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec codec = _WebChromeClientFlutterApiCodec(); void onProgressChanged(int instanceId, int webViewInstanceId, int progress); @@ -2013,6 +2307,13 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView( + int instanceId, int viewIdentifier, int callbackIdentifier); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); + /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. void onGeolocationPermissionsShowPrompt( int instanceId, int paramsInstanceId, String origin); @@ -2020,6 +2321,16 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. void onGeolocationPermissionsHidePrompt(int identifier); + /// Callback to Dart function `WebChromeClient.onConsoleMessage`. + void onConsoleMessage(int instanceId, ConsoleMessage message); + + Future onJsAlert(int instanceId, String url, String message); + + Future onJsConfirm(int instanceId, String url, String message); + + Future onJsPrompt( + int instanceId, String url, String message, String defaultValue); + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -2099,6 +2410,53 @@ abstract class WebChromeClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_viewIdentifier = (args[1] as int?); + assert(arg_viewIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_callbackIdentifier = (args[2] as int?); + assert(arg_callbackIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + api.onShowCustomView( + arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onHideCustomView', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onHideCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onHideCustomView was null, expected non-null int.'); + api.onHideCustomView(arg_instanceId!); + return; + }); + } + } { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', @@ -2146,24 +2504,130 @@ abstract class WebChromeClientFlutterApi { }); } } - } -} - -class WebStorageHostApi { - /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - WebStorageHostApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future create(int arg_instanceId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_ohos.WebStorageHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onConsoleMessage', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onConsoleMessage was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onConsoleMessage was null, expected non-null int.'); + final ConsoleMessage? arg_message = (args[1] as ConsoleMessage?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onConsoleMessage was null, expected non-null ConsoleMessage.'); + api.onConsoleMessage(arg_instanceId!, arg_message!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert was null, expected non-null String.'); + await api.onJsAlert(arg_instanceId!, arg_url!, arg_message!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm was null, expected non-null String.'); + final bool output = + await api.onJsConfirm(arg_instanceId!, arg_url!, arg_message!); + return output; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null int.'); + final String? arg_url = (args[1] as String?); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String? arg_message = (args[2] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String? arg_defaultValue = (args[3] as String?); + assert(arg_defaultValue != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt was null, expected non-null String.'); + final String output = await api.onJsPrompt( + arg_instanceId!, arg_url!, arg_message!, arg_defaultValue!); + return output; + }); + } + } + } +} + +class WebStorageHostApi { + /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + WebStorageHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future create(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.WebStorageHostApi.create', + codec, + binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_instanceId]) as List?; if (replyList == null) { @@ -2355,6 +2819,123 @@ abstract class PermissionRequestFlutterApi { } } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallbackHostApi { + /// Constructor for [CustomViewCallbackHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + CustomViewCallbackHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + Future onCustomViewHidden(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackHostApi.onCustomViewHidden', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class CustomViewCallbackFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +abstract class ViewFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(ViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.ViewFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.ViewFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.ViewFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -2432,3 +3013,138 @@ abstract class GeolocationPermissionsCallbackFlutterApi { } } } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +class HttpAuthHandlerHostApi { + /// Constructor for [HttpAuthHandlerHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + HttpAuthHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + Future useHttpAuthUsernamePassword(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as bool?)!; + } + } + + /// Handles Dart method `HttpAuthHandler.cancel`. + Future cancel(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.cancel', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + /// Handles Dart method `HttpAuthHandler.proceed`. + Future proceed( + int arg_instanceId, String arg_username, String arg_password) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.proceed', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_username, arg_password]) + as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +abstract class HttpAuthHandlerFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int instanceId); + + static void setup(HttpAuthHandlerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerFlutterApi.create was null, expected non-null int.'); + api.create(arg_instanceId!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart index 1f5938711a106d97b86a51efee52962f845d53ff..93b896ab79fb293348b6f7e5091fc8a15685ff96 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_api_impls.dart @@ -13,16 +13,16 @@ * limitations under the License. */ -import 'dart:typed_data'; import 'dart:ui'; -import 'package:flutter/services.dart' show BinaryMessenger; +import 'package:flutter/services.dart' show BinaryMessenger, Uint8List; import 'ohos_webview.dart'; import 'ohos_webview.g.dart'; import 'instance_manager.dart'; -export 'ohos_webview.g.dart' show FileChooserMode; +export 'ohos_webview.g.dart' + show ConsoleMessage, ConsoleMessageLevel, FileChooserMode; /// Converts [WebResourceRequestData] to [WebResourceRequest] WebResourceRequest _toWebResourceRequest(WebResourceRequestData data) { @@ -58,6 +58,9 @@ class OhosWebViewFlutterApis { geolocationPermissionsCallbackFlutterApi, WebViewFlutterApiImpl? webViewFlutterApi, PermissionRequestFlutterApiImpl? permissionRequestFlutterApi, + CustomViewCallbackFlutterApiImpl? customViewCallbackFlutterApi, + ViewFlutterApiImpl? viewFlutterApi, + HttpAuthHandlerFlutterApiImpl? httpAuthHandlerFlutterApi, }) { this.ohosObjectFlutterApi = ohosObjectFlutterApi ?? OhosObjectFlutterApiImpl(); @@ -77,6 +80,11 @@ class OhosWebViewFlutterApis { this.webViewFlutterApi = webViewFlutterApi ?? WebViewFlutterApiImpl(); this.permissionRequestFlutterApi = permissionRequestFlutterApi ?? PermissionRequestFlutterApiImpl(); + this.customViewCallbackFlutterApi = + customViewCallbackFlutterApi ?? CustomViewCallbackFlutterApiImpl(); + this.viewFlutterApi = viewFlutterApi ?? ViewFlutterApiImpl(); + this.httpAuthHandlerFlutterApi = + httpAuthHandlerFlutterApi ?? HttpAuthHandlerFlutterApiImpl(); } static bool _haveBeenSetUp = false; @@ -114,6 +122,15 @@ class OhosWebViewFlutterApis { /// Flutter Api for [PermissionRequest]. late final PermissionRequestFlutterApiImpl permissionRequestFlutterApi; + /// Flutter Api for [CustomViewCallback]. + late final CustomViewCallbackFlutterApiImpl customViewCallbackFlutterApi; + + /// Flutter Api for [View]. + late final ViewFlutterApiImpl viewFlutterApi; + + /// Flutter Api for [HttpAuthHandler]. + late final HttpAuthHandlerFlutterApiImpl httpAuthHandlerFlutterApi; + /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { @@ -127,6 +144,9 @@ class OhosWebViewFlutterApis { geolocationPermissionsCallbackFlutterApi); WebViewFlutterApi.setup(webViewFlutterApi); PermissionRequestFlutterApi.setup(permissionRequestFlutterApi); + CustomViewCallbackFlutterApi.setup(customViewCallbackFlutterApi); + ViewFlutterApi.setup(viewFlutterApi); + HttpAuthHandlerFlutterApi.setup(httpAuthHandlerFlutterApi); _haveBeenSetUp = true; } } @@ -397,6 +417,18 @@ class WebViewFlutterApiImpl implements WebViewFlutterApi { void create(int identifier) { instanceManager.addHostCreatedInstance(WebView.detached(), identifier); } + + @override + void onScrollChanged( + int webViewInstanceId, int left, int top, int oldLeft, int oldTop) { + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + assert( + webViewInstance != null, + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', + ); + webViewInstance!.onScrollChanged?.call(left, top, oldLeft, oldTop); + } } /// Host api implementation for [WebSettings]. @@ -551,6 +583,11 @@ class WebSettingsHostApiImpl extends WebSettingsHostApi { enabled, ); } + + /// Helper method to convert instances ids to objects. + Future getUserAgentStringFromInstance(WebSettings instance) { + return getUserAgentString(instanceManager.getIdentifier(instance)!); + } } /// Host api implementation for [JavaScriptChannel]. @@ -796,16 +833,49 @@ class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { .getInstanceWithWeakReference(webViewInstanceId) as WebView?; assert( instance != null, - 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId', + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', ); assert( webViewInstance != null, - 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId', + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', ); if (instance!.doUpdateVisitedHistory != null) { instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); } } + + @override + void onReceivedHttpAuthRequest( + int instanceId, + int webViewInstanceId, + int httpAuthHandlerInstanceId, + String host, + String realm, + ) { + final WebViewClient? instance = instanceManager + .getInstanceWithWeakReference(instanceId) as WebViewClient?; + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + final HttpAuthHandler? httpAuthHandlerInstance = + instanceManager.getInstanceWithWeakReference(httpAuthHandlerInstanceId) + as HttpAuthHandler?; + assert( + instance != null, + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', + ); + assert( + webViewInstance != null, + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', + ); + assert( + httpAuthHandlerInstance != null, + 'InstanceManager does not contain a HttpAuthHandler with instanceId: $httpAuthHandlerInstanceId', + ); + if (instance!.onReceivedHttpAuthRequest != null) { + return instance.onReceivedHttpAuthRequest!( + webViewInstance!, httpAuthHandlerInstance!, host, realm); + } + } } /// Host api implementation for [DownloadListener]. @@ -891,6 +961,44 @@ class WebChromeClientHostApiImpl extends WebChromeClientHostApi { value, ); } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnConsoleMessageFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnConsoleMessage( + instanceManager.getIdentifier(instance)!, + value, + ); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsAlertFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsAlert( + instanceManager.getIdentifier(instance)!, value); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsConfirmFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsConfirm( + instanceManager.getIdentifier(instance)!, value); + } + + /// Helper method to convert instances ids to objects. + Future setSynchronousReturnValueForOnJsPromptFromInstance( + WebChromeClient instance, + bool value, + ) { + return setSynchronousReturnValueForOnJsPrompt( + instanceManager.getIdentifier(instance)!, value); + } } /// Flutter api implementation for [DownloadListener]. @@ -988,6 +1096,66 @@ class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { request.deny(); } } + + @override + void onShowCustomView( + int instanceId, + int viewIdentifier, + int callbackIdentifier, + ) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onShowCustomView != null) { + return instance.onShowCustomView!( + instance, + instanceManager.getInstanceWithWeakReference(viewIdentifier)!, + instanceManager.getInstanceWithWeakReference(callbackIdentifier)!, + ); + } + } + + @override + void onHideCustomView(int instanceId) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onHideCustomView != null) { + return instance.onHideCustomView!( + instance, + ); + } + } + + @override + void onConsoleMessage(int instanceId, ConsoleMessage message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + instance.onConsoleMessage?.call(instance, message); + } + + @override + Future onJsAlert(int instanceId, String url, String message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsAlert!(url, message); + } + + @override + Future onJsConfirm(int instanceId, String url, String message) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsConfirm!(url, message); + } + + @override + Future onJsPrompt( + int instanceId, String url, String message, String defaultValue) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + + return instance.onJsPrompt!(url, message, defaultValue); + } } /// Host api implementation for [WebStorage]. @@ -1192,6 +1360,96 @@ class PermissionRequestFlutterApiImpl implements PermissionRequestFlutterApi { } } +/// Host api implementation for [CustomViewCallback]. +class CustomViewCallbackHostApiImpl extends CustomViewCallbackHostApi { + /// Constructs a [CustomViewCallbackHostApiImpl]. + CustomViewCallbackHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? OhosObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + /// Helper method to convert instance ids to objects. + Future onCustomViewHiddenFromInstances(CustomViewCallback instance) { + return onCustomViewHidden(instanceManager.getIdentifier(instance)!); + } +} + +/// Flutter API implementation for [CustomViewCallback]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class CustomViewCallbackFlutterApiImpl implements CustomViewCallbackFlutterApi { + /// Constructs a [CustomViewCallbackFlutterApiImpl]. + CustomViewCallbackFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + CustomViewCallback.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + +/// Flutter API implementation for [View]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class ViewFlutterApiImpl implements ViewFlutterApi { + /// Constructs a [ViewFlutterApiImpl]. + ViewFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + View.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + /// Host api implementation for [CookieManager]. class CookieManagerHostApiImpl extends CookieManagerHostApi { /// Constructs a [CookieManagerHostApiImpl]. @@ -1247,3 +1505,68 @@ class CookieManagerHostApiImpl extends CookieManagerHostApi { ); } } + +/// Host api implementation for [HttpAuthHandler]. +class HttpAuthHandlerHostApiImpl extends HttpAuthHandlerHostApi { + /// Constructs a [HttpAuthHandlerHostApiImpl]. + HttpAuthHandlerHostApiImpl({ + super.binaryMessenger, + InstanceManager? instanceManager, + }) : _instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager _instanceManager; + + /// Helper method to convert instance ids to objects. + Future cancelFromInstance(HttpAuthHandler instance) { + return cancel(_instanceManager.getIdentifier(instance)!); + } + + /// Helper method to convert instance ids to objects. + Future proceedFromInstance( + HttpAuthHandler instance, + String username, + String password, + ) { + return proceed( + _instanceManager.getIdentifier(instance)!, + username, + password, + ); + } + + /// Helper method to convert instance ids to objects. + Future useHttpAuthUsernamePasswordFromInstance( + HttpAuthHandler instance, + ) { + return useHttpAuthUsernamePassword( + _instanceManager.getIdentifier(instance)!, + ); + } +} + +/// Flutter API implementation for [HttpAuthHandler]. +class HttpAuthHandlerFlutterApiImpl extends HttpAuthHandlerFlutterApi { + /// Constructs a [HttpAuthHandlerFlutterApiImpl]. + HttpAuthHandlerFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? OhosObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int instanceId) { + instanceManager.addHostCreatedInstance( + HttpAuthHandler(), + instanceId, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart index 2154c20b23c243afb9b19aeee4431c3f20fb0a36..e33a54b475aa4b6171bec1b4f38705471ead2bf3 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart @@ -15,6 +15,8 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -22,6 +24,7 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'ohos_proxy.dart'; import 'ohos_webview.dart' as ohos_webview; +import 'ohos_webview_api_impls.dart'; import 'instance_manager.dart'; import 'platform_views_service_proxy.dart'; import 'weak_reference_utils.dart'; @@ -85,7 +88,7 @@ class OhosWebViewPermissionResourceType /// Implementation of the [PlatformWebViewController] with the Ohos WebView API. class OhosWebViewController extends PlatformWebViewController { - /// Creates a new [OhosWebViewCookieManager]. + /// Creates a new [OhosWebViewController]. OhosWebViewController(PlatformWebViewControllerCreationParams params) : super.implementation(params is OhosWebViewControllerCreationParams ? params @@ -107,7 +110,15 @@ class OhosWebViewController extends PlatformWebViewController { /// The native [ohos_webview.WebView] being controlled. late final ohos_webview.WebView _webView = - _ohosWebViewParams.ohosWebViewProxy.createOhosWebView(); + _ohosWebViewParams.ohosWebViewProxy.createOhosWebView( + onScrollChanged: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (int left, int top, int oldLeft, int oldTop) async { + final void Function(ScrollPositionChange)? callback = + weakReference.target?._onScrollPositionChangedCallback; + callback?.call(ScrollPositionChange(left.toDouble(), top.toDouble())); + }; + })); late final ohos_webview.WebChromeClient _webChromeClient = _ohosWebViewParams.ohosWebViewProxy.createOhosWebChromeClient( @@ -148,6 +159,41 @@ class OhosWebViewController extends PlatformWebViewController { } }; }), + onShowCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (_, ohos_webview.View view, + ohos_webview.CustomViewCallback callback) { + final OhosWebViewController? webViewController = + weakReference.target; + if (webViewController == null) { + callback.onCustomViewHidden(); + return; + } + final OnShowCustomWidgetCallback? onShowCallback = + webViewController._onShowCustomWidgetCallback; + if (onShowCallback == null) { + callback.onCustomViewHidden(); + return; + } + onShowCallback( + OhosCustomViewWidget.private( + controller: webViewController, + customView: view, + ), + () => callback.onCustomViewHidden(), + ); + }; + }), + onHideCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (ohos_webview.WebChromeClient instance) { + final OnHideCustomWidgetCallback? onHideCustomViewCallback = + weakReference.target?._onHideCustomWidgetCallback; + if (onHideCustomViewCallback != null) { + onHideCustomViewCallback(); + } + }; + }), onShowFileChooser: withWeakReferenceTo( this, (WeakReference weakReference) { @@ -162,6 +208,42 @@ class OhosWebViewController extends PlatformWebViewController { }; }, ), + onConsoleMessage: withWeakReferenceTo( + this, + (WeakReference weakReference) { + return (ohos_webview.WebChromeClient webChromeClient, + ohos_webview.ConsoleMessage consoleMessage) async { + final void Function(JavaScriptConsoleMessage)? callback = + weakReference.target?._onConsoleLogCallback; + if (callback != null) { + JavaScriptLogLevel logLevel; + switch (consoleMessage.level) { + // Android maps `console.debug` to `MessageLevel.TIP`, it seems + // `MessageLevel.DEBUG` if not being used. + case ConsoleMessageLevel.debug: + case ConsoleMessageLevel.tip: + logLevel = JavaScriptLogLevel.debug; + break; + case ConsoleMessageLevel.error: + logLevel = JavaScriptLogLevel.error; + break; + case ConsoleMessageLevel.warning: + logLevel = JavaScriptLogLevel.warning; + break; + case ConsoleMessageLevel.unknown: + case ConsoleMessageLevel.log: + logLevel = JavaScriptLogLevel.log; + break; + } + + callback(JavaScriptConsoleMessage( + level: logLevel, + message: consoleMessage.message, + )); + } + }; + }, + ), onPermissionRequest: withWeakReferenceTo( this, (WeakReference weakReference) { @@ -205,6 +287,49 @@ class OhosWebViewController extends PlatformWebViewController { }; }, ), + onJsAlert: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message) async { + final Future Function(JavaScriptAlertDialogRequest)? callback = + weakReference.target?._onJavaScriptAlert; + if (callback != null) { + final JavaScriptAlertDialogRequest request = + JavaScriptAlertDialogRequest(message: message, url: url); + + await callback.call(request); + } + return; + }; + }), + onJsConfirm: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message) async { + final Future Function(JavaScriptConfirmDialogRequest)? callback = + weakReference.target?._onJavaScriptConfirm; + if (callback != null) { + final JavaScriptConfirmDialogRequest request = + JavaScriptConfirmDialogRequest(message: message, url: url); + final bool result = await callback.call(request); + return result; + } + return false; + }; + }), + onJsPrompt: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (String url, String message, String defaultValue) async { + final Future Function(JavaScriptTextInputDialogRequest)? + callback = weakReference.target?._onJavaScriptPrompt; + if (callback != null) { + final JavaScriptTextInputDialogRequest request = + JavaScriptTextInputDialogRequest( + message: message, url: url, defaultText: defaultValue); + final String result = await callback.call(request); + return result; + } + return ''; + }; + }), ); /// The native [ohos_webview.FlutterAssetManager] allows managing assets. @@ -223,8 +348,24 @@ class OhosWebViewController extends PlatformWebViewController { OnGeolocationPermissionsHidePrompt? _onGeolocationPermissionsHidePrompt; + OnShowCustomWidgetCallback? _onShowCustomWidgetCallback; + + OnHideCustomWidgetCallback? _onHideCustomWidgetCallback; + void Function(PlatformWebViewPermissionRequest)? _onPermissionRequestCallback; + void Function(JavaScriptConsoleMessage consoleMessage)? _onConsoleLogCallback; + + Future Function(JavaScriptAlertDialogRequest request)? + _onJavaScriptAlert; + Future Function(JavaScriptConfirmDialogRequest request)? + _onJavaScriptConfirm; + Future Function(JavaScriptTextInputDialogRequest request)? + _onJavaScriptPrompt; + + void Function(ScrollPositionChange scrollPositionChange)? + _onScrollPositionChangedCallback; + /// Whether to enable the platform's webview content debugging tools. /// /// Defaults to false. @@ -276,7 +417,7 @@ class OhosWebViewController extends PlatformWebViewController { ); } _webView.settings.setAllowFileAccess(true); - final String url = "resources/rawfile/" + assetFilePath; + final String url = "resources/rawfile/" + assetFilePath; return _webView.loadUrl(url, {}); } @@ -286,11 +427,7 @@ class OhosWebViewController extends PlatformWebViewController { String? baseUrl, }) { return _webView.loadDataWithBaseUrl( - baseUrl: baseUrl, - data: html, - mimeType: 'text/html', - encoding: 'UTF-8' - ); + baseUrl: baseUrl, data: html, mimeType: 'text/html', encoding: 'UTF-8'); } @override @@ -388,12 +525,10 @@ class OhosWebViewController extends PlatformWebViewController { // When JavaScript channel with the same name exists make sure to remove it // before registering the new channel. if (_javaScriptChannelParams.containsKey(ohosJavaScriptParams.name)) { - _webView - .removeJavaScriptChannel(ohosJavaScriptParams._javaScriptChannel); + _webView.removeJavaScriptChannel(ohosJavaScriptParams._javaScriptChannel); } - _javaScriptChannelParams[ohosJavaScriptParams.name] = - ohosJavaScriptParams; + _javaScriptChannelParams[ohosJavaScriptParams.name] = ohosJavaScriptParams; return _webView .addJavaScriptChannel(ohosJavaScriptParams._javaScriptChannel); @@ -443,6 +578,13 @@ class OhosWebViewController extends PlatformWebViewController { Future setUserAgent(String? userAgent) => _webView.settings.setUserAgentString(userAgent); + @override + Future setOnScrollPositionChange( + void Function(ScrollPositionChange scrollPositionChange)? + onScrollPositionChange) async { + _onScrollPositionChangedCallback = onScrollPositionChange; + } + /// Sets the restrictions that apply on automatic media playback. Future setMediaPlaybackRequiresUserGesture(bool require) { return _webView.settings.setMediaPlaybackRequiresUserGesture(require); @@ -501,6 +643,75 @@ class OhosWebViewController extends PlatformWebViewController { _onGeolocationPermissionsShowPrompt = onShowPrompt; _onGeolocationPermissionsHidePrompt = onHidePrompt; } + + /// Sets the callbacks that are invoked when the host application wants to + /// show or hide a custom widget. + /// + /// The most common use case these methods are invoked a video element wants + /// to be displayed in fullscreen. + /// + /// The [onShowCustomWidget] notifies the host application that web content + /// from the specified origin wants to be displayed in a custom widget. After + /// this call, web content will no longer be rendered in the `WebViewWidget`, + /// but will instead be rendered in the custom widget. The application may + /// explicitly exit fullscreen mode by invoking `onCustomWidgetHidden` in the + /// [onShowCustomWidget] callback (ex. when the user presses the back + /// button). However, this is generally not necessary as the web page will + /// often show its own UI to close out of fullscreen. Regardless of how the + /// WebView exits fullscreen mode, WebView will invoke [onHideCustomWidget], + /// signaling for the application to remove the custom widget. If this value + /// is `null` when passed to an `AndroidWebViewWidget`, a default handler + /// will be set. + /// + /// The [onHideCustomWidget] notifies the host application that the custom + /// widget must be hidden. After this call, web content will render in the + /// original `WebViewWidget` again. + Future setCustomWidgetCallbacks({ + required OnShowCustomWidgetCallback? onShowCustomWidget, + required OnHideCustomWidgetCallback? onHideCustomWidget, + }) async { + _onShowCustomWidgetCallback = onShowCustomWidget; + _onHideCustomWidgetCallback = onHideCustomWidget; + } + + /// Sets a callback that notifies the host application of any log messages + /// written to the JavaScript console. + @override + Future setOnConsoleMessage( + void Function(JavaScriptConsoleMessage consoleMessage) + onConsoleMessage) async { + _onConsoleLogCallback = onConsoleMessage; + + return _webChromeClient.setSynchronousReturnValueForOnConsoleMessage( + _onConsoleLogCallback != null); + } + + @override + Future getUserAgent() => _webView.settings.getUserAgentString(); + + @override + Future setOnJavaScriptAlertDialog( + Future Function(JavaScriptAlertDialogRequest request) + onJavaScriptAlertDialog) async { + _onJavaScriptAlert = onJavaScriptAlertDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsAlert(true); + } + + @override + Future setOnJavaScriptConfirmDialog( + Future Function(JavaScriptConfirmDialogRequest request) + onJavaScriptConfirmDialog) async { + _onJavaScriptConfirm = onJavaScriptConfirmDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsConfirm(true); + } + + @override + Future setOnJavaScriptTextInputDialog( + Future Function(JavaScriptTextInputDialogRequest request) + onJavaScriptTextInputDialog) async { + _onJavaScriptPrompt = onJavaScriptTextInputDialog; + return _webChromeClient.setSynchronousReturnValueForOnJsPrompt(true); + } } /// Ohos implementation of [PlatformWebViewPermissionRequest]. @@ -547,6 +758,13 @@ typedef OnGeolocationPermissionsShowPrompt /// Signature for the `setGeolocationPermissionsPromptCallbacks` callback responsible for request the Geolocation API is cancel. typedef OnGeolocationPermissionsHidePrompt = void Function(); +/// Signature for the `setCustomWidgetCallbacks` callback responsible for showing the custom view. +typedef OnShowCustomWidgetCallback = void Function( + Widget widget, void Function() onCustomWidgetHidden); + +/// Signature for the `setCustomWidgetCallbacks` callback responsible for hiding the custom view. +typedef OnHideCustomWidgetCallback = void Function(); + /// A request params used by the host application to set the Geolocation permission state for an origin. @immutable class GeolocationPermissionsRequestParams { @@ -649,8 +867,7 @@ class OhosJavaScriptChannelParams extends JavaScriptChannelParams { OhosJavaScriptChannelParams({ required super.name, required super.onMessageReceived, - @visibleForTesting - OhosWebViewProxy webViewProxy = const OhosWebViewProxy(), + @visibleForTesting OhosWebViewProxy webViewProxy = const OhosWebViewProxy(), }) : assert(name.isNotEmpty), _javaScriptChannel = webViewProxy.createJavaScriptChannel( name, @@ -674,8 +891,7 @@ class OhosJavaScriptChannelParams extends JavaScriptChannelParams { /// [JavaScriptChannelParams]. OhosJavaScriptChannelParams.fromJavaScriptChannelParams( JavaScriptChannelParams params, { - @visibleForTesting - OhosWebViewProxy webViewProxy = const OhosWebViewProxy(), + @visibleForTesting OhosWebViewProxy webViewProxy = const OhosWebViewProxy(), }) : this( name: params.name, onMessageReceived: params.onMessageReceived, @@ -787,18 +1003,152 @@ class OhosWebViewWidget extends PlatformWebViewWidget { @override Widget build(BuildContext context) { - return OhosView( + _trySetDefaultOnShowCustomWidgetCallbacks(context); + return PlatformViewLink( + // Setting a default key using `params` ensures the `PlatformViewLink` + // recreates the PlatformView when changes are made. key: _ohosParams.key ?? ValueKey( params as OhosWebViewWidgetCreationParams), viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return OhosViewSurface( + controller: controller as OhosViewController, + gestureRecognizers: _ohosParams.gestureRecognizers, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initOhosView( + params, + displayWithHybridComposition: + _ohosParams.displayWithHybridComposition, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + + OhosViewController _initOhosView( + PlatformViewCreationParams params, { + required bool displayWithHybridComposition, + }) { + if (displayWithHybridComposition) { + return _ohosParams.platformViewsServiceProxy.initExpensiveOhosView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: _ohosParams.layoutDirection, + creationParams: _ohosParams.instanceManager.getIdentifier( + (_ohosParams.controller as OhosWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } else { + return _ohosParams.platformViewsServiceProxy.initSurfaceOhosView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: _ohosParams.layoutDirection, + creationParams: _ohosParams.instanceManager.getIdentifier( + (_ohosParams.controller as OhosWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } + } + + + // Attempt to handle custom views with a default implementation if it has not + // been set. + void _trySetDefaultOnShowCustomWidgetCallbacks(BuildContext context) { + final OhosWebViewController controller = + _ohosParams.controller as OhosWebViewController; + + if (controller._onShowCustomWidgetCallback == null) { + controller.setCustomWidgetCallbacks( + onShowCustomWidget: + (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, + ); + } + } +} + +/// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) +/// that is created by the host platform when web content needs to be displayed +/// in fullscreen mode. +/// +/// The [OhosCustomViewWidget] cannot be manually instantiated and is +/// provided to the host application through the callbacks specified using the +/// [OhosWebViewController.setCustomWidgetCallbacks] method. +/// +/// The [OhosCustomViewWidget] is initialized internally and should only be +/// exposed as a [Widget] externally. The type [OhosCustomViewWidget] is +/// visible for testing purposes only and should never be called externally. +@visibleForTesting +class OhosCustomViewWidget extends StatelessWidget { + /// Creates a [OhosCustomViewWidget]. + /// + /// The [OhosCustomViewWidget] should only be instantiated internally. + /// This constructor is visible for testing purposes only and should + /// never be called externally. + @visibleForTesting + OhosCustomViewWidget.private({ + super.key, + required this.controller, + required this.customView, + @visibleForTesting InstanceManager? instanceManager, + @visibleForTesting + this.platformViewsServiceProxy = const PlatformViewsServiceProxy(), + }) : instanceManager = + instanceManager ?? ohos_webview.OhosObject.globalInstanceManager; + + /// The reference to the Android native view that should be shown. + final ohos_webview.View customView; + + /// The [PlatformWebViewController] that allows controlling the native web + /// view. + final PlatformWebViewController controller; + + /// Maintains instances used to communicate with the native objects they + /// represent. + /// + /// This field is exposed for testing purposes only and should not be used + /// outside of tests. + @visibleForTesting + final InstanceManager instanceManager; + + /// Proxy that provides access to the platform views service. + /// + /// This service allows creating and controlling platform-specific views. + @visibleForTesting + final PlatformViewsServiceProxy platformViewsServiceProxy; + + OhosWebViewWidgetCreationParams get _ohosParams => + controller.params as OhosWebViewWidgetCreationParams; + + @override + Widget build(BuildContext context) { + return OhosView( + key: _ohosParams.key ?? + ValueKey(_ohosParams), + viewType: 'plugins.flutter.io/webview', layoutDirection: _ohosParams.layoutDirection, creationParams: _ohosParams.instanceManager.getIdentifier( - (_ohosParams.controller as OhosWebViewController)._webView), + (_ohosParams.controller as OhosWebViewController)._webView), creationParamsCodec: const StandardMessageCodec(), gestureRecognizers: _ohosParams.gestureRecognizers, ); } + } /// Signature for the `loadRequest` callback responsible for loading the [url] @@ -859,6 +1209,10 @@ class OhosWebResourceError extends WebResourceError { return WebResourceErrorType.unsupportedScheme; } + if (errorCode < 0) { + return WebResourceErrorType.unknown; + } + throw ArgumentError( 'Could not find a WebResourceErrorType for errorCode: $errorCode', ); @@ -989,6 +1343,31 @@ class OhosNavigationDelegate extends PlatformNavigationDelegate { callback(OhosUrlChange(url: url, isReload: isReload)); } }, + onReceivedHttpAuthRequest: ( + ohos_webview.WebView webView, + ohos_webview.HttpAuthHandler httpAuthHandler, + String host, + String realm, + ) { + final void Function(HttpAuthRequest)? callback = + weakThis.target?._onHttpAuthRequest; + if (callback != null) { + callback( + HttpAuthRequest( + onProceed: (WebViewCredential credential) { + httpAuthHandler.proceed(credential.user, credential.password); + }, + onCancel: () { + httpAuthHandler.cancel(); + }, + host: host, + realm: realm, + ), + ); + } else { + httpAuthHandler.cancel(); + } + }, ); _downloadListener = (this.params as OhosNavigationDelegateCreationParams) @@ -1020,8 +1399,7 @@ class OhosNavigationDelegate extends PlatformNavigationDelegate { @Deprecated( 'This value is not used by `OhosWebViewController` and has no effect on the `WebView`.', ) - ohos_webview.WebChromeClient get ohosWebChromeClient => - _webChromeClient; + ohos_webview.WebChromeClient get ohosWebChromeClient => _webChromeClient; late final ohos_webview.WebViewClient _webViewClient; @@ -1035,8 +1413,7 @@ class OhosNavigationDelegate extends PlatformNavigationDelegate { /// Gets the native [ohos_webview.DownloadListener] that is bridged by this [OhosNavigationDelegate]. /// /// Used by the [OhosWebViewController] to set the `ohos_webview.WebView.setDownloadListener`. - ohos_webview.DownloadListener get ohosDownloadListener => - _downloadListener; + ohos_webview.DownloadListener get ohosDownloadListener => _downloadListener; PageEventCallback? _onPageFinished; PageEventCallback? _onPageStarted; @@ -1045,6 +1422,7 @@ class OhosNavigationDelegate extends PlatformNavigationDelegate { NavigationRequestCallback? _onNavigationRequest; LoadRequestCallback? _onLoadRequest; UrlChangeCallback? _onUrlChange; + HttpAuthRequestCallback? _onHttpAuthRequest; void _handleNavigation( String url, { @@ -1131,4 +1509,11 @@ class OhosNavigationDelegate extends PlatformNavigationDelegate { Future setOnUrlChange(UrlChangeCallback onUrlChange) async { _onUrlChange = onUrlChange; } + + @override + Future setOnHttpAuthRequest( + HttpAuthRequestCallback onHttpAuthRequest, + ) async { + _onHttpAuthRequest = onHttpAuthRequest; + } } diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart index c1f36763a243ebe78b39622b05fb8d5cd5aa4567..8afb6920dc0c63ecfc504f81d75d823979af585f 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart @@ -24,8 +24,8 @@ class PlatformViewsServiceProxy { /// Constructs a [PlatformViewsServiceProxy]. const PlatformViewsServiceProxy(); - /// Proxy method for [PlatformViewsService.initOhosView]. - OhosViewController initOhosView({ + /// Proxy method for [PlatformViewsService.initExpensiveAndroidView]. + ExpensiveOhosViewController initExpensiveOhosView({ required int id, required String viewType, required TextDirection layoutDirection, @@ -33,13 +33,32 @@ class PlatformViewsServiceProxy { MessageCodec? creationParamsCodec, VoidCallback? onFocus, }) { - return PlatformViewsService.initOhosView( - id: id, - viewType: viewType, - layoutDirection: layoutDirection, - creationParams: creationParams, - creationParamsCodec: creationParamsCodec, - onFocus: onFocus, - ); + return PlatformViewsService.initExpensiveOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); + } + + /// Proxy method for [PlatformViewsService.initSurfaceAndroidView]. + SurfaceOhosViewController initSurfaceOhosView({ + required int id, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + VoidCallback? onFocus, + }) { + return PlatformViewsService.initSurfaceOhosView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); } } diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart b/packages/webview_flutter/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart new file mode 100644 index 0000000000000000000000000000000000000000..8a24d7039607573abe0f4007ab6f4b13769b6a0f --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/lib/src/webview_flutter_ohos_legacy.dart @@ -0,0 +1,7 @@ +// Copyright 2013 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. + +export 'legacy/webview_ohos.dart'; +export 'legacy/webview_ohos_cookie_manager.dart'; +export 'legacy/webview_surface_ohos.dart'; diff --git a/packages/webview_flutter/webview_flutter_ohos/lib/webview_flutter_ohos.dart b/packages/webview_flutter/webview_flutter_ohos/lib/webview_flutter_ohos.dart index bcee3e3210ca7251d823c829476dcf95038ee17f..2c91bfde3457af0f8bf6c8a7d8a37d4e68fe00f7 100644 --- a/packages/webview_flutter/webview_flutter_ohos/lib/webview_flutter_ohos.dart +++ b/packages/webview_flutter/webview_flutter_ohos/lib/webview_flutter_ohos.dart @@ -13,8 +13,6 @@ * limitations under the License. */ -library webview_flutter_ohos; - export 'src/ohos_webview_controller.dart'; export 'src/ohos_webview_cookie_manager.dart'; export 'src/ohos_webview_platform.dart'; diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets index e7f746ce2c1dc9153261791d5d0d219f4250a07f..b7130258041111c85a92bb33c68eacc740879088 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CookieManagerHostApiImpl.ets @@ -50,7 +50,7 @@ export class CookieManagerHostApiImpl extends CookieManagerHostApi { } removeAllCookies(identifier: number, result: Result ) { - web_webview.WebCookieManager.deleteEntireCookie() + web_webview.WebCookieManager.clearAllCookiesSync() result.success(true) } diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackFlutterApiImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..e02187624e6d0ab32f32b2b7980d948fb5c709b2 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackFlutterApiImpl.ets @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { CustomViewCallback, CustomViewCallbackFlutterApi, Reply } from './GeneratedOhosWebView'; +import { InstanceManager } from './InstanceManager' + +export class CustomViewCallbackFlutterApiImpl { + binaryMessenger: BinaryMessenger; + instanceManager: InstanceManager; + api: CustomViewCallbackFlutterApi; + + constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.api = new CustomViewCallbackFlutterApi(binaryMessenger); + } + + create(instance: CustomViewCallback, callback: Reply) { + if (!this.instanceManager.containsInstance(instance)) { + this.api.create(this.instanceManager.addHostCreatedInstance(instance), callback); + } + } + + setApi(api: CustomViewCallbackFlutterApi) { + this.api = api; + } +} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackHostApiImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..61c519fa3c304e8700a1e7246e0b1d4cebc68937 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackHostApiImpl.ets @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { CustomViewCallback, CustomViewCallbackHostApi } from './GeneratedOhosWebView'; +import { InstanceManager } from './InstanceManager' + +export class CustomViewCallbackHostApiImpl extends CustomViewCallbackHostApi { + // To ease adding additional methods, this value is added prematurely. + + binaryMessenger: BinaryMessenger; + + instanceManager: InstanceManager; + + /** + * Constructs a {@link CustomViewCallbackHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { + super() + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + } + + onCustomViewHidden(identifier: number) { + this.getCustomViewCallbackInstance(identifier).onCustomViewHidden(); + } + + getCustomViewCallbackInstance(identifier: number) : CustomViewCallback { + return this.instanceManager.getInstance(identifier); + } +} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets index 8c2047cdef4b83f52948911cdeb253b764ed6077..afe1c6843046862df31cc504e3159fcad75102fd 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets @@ -1097,6 +1097,24 @@ export class WebViewFlutterApi { (channelReply: ESObject) => callback.reply(null) ); } + + onScrollChanged( + webViewInstanceIdArg: number, + leftArg: number, + topArg: number, + oldLeftArg: number, + oldTopArg: number, + callback: Reply, + ) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewFlutterApi.onScrollChanged", + WebViewFlutterApi.getCodec()); + channel.send( + [webViewInstanceIdArg, leftArg, topArg, oldLeftArg, oldTopArg], + (channelReply: ESObject) => callback.reply(null) + ); + } } export enum ConsoleMessageLevel { @@ -1260,7 +1278,7 @@ class WebChromeClientFlutterApiCodec extends StandardMessageCodec { } export abstract class WebChromeClientFlutterApi { - private binaryMessenger: BinaryMessenger; + protected binaryMessenger: BinaryMessenger; constructor(binaryMessenger: BinaryMessenger) { this.binaryMessenger = binaryMessenger; @@ -1323,6 +1341,38 @@ export abstract class WebChromeClientFlutterApi { ); } + onShowCustomView( + instanceIdArg: number, + viewIdentifierArg: number, + callbackIdentifierArg: number, + callback: Reply + ) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onShowCustomView", + WebChromeClientFlutterApi.getCodec() + ) + channel.send( + [instanceIdArg, viewIdentifierArg, callbackIdentifierArg], + (channelReply: ESObject) => callback.reply(null) + ); + } + + onHideCustomView( + instanceIdArg: number, + callback: Reply + ) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onHideCustomView", + WebChromeClientFlutterApi.getCodec() + ) + channel.send( + [instanceIdArg], + (channelReply: ESObject) => callback.reply(null) + ); + } + onGeolocationPermissionsShowPrompt( instanceIdArg: number, paramsInstanceIdArg: number, @@ -1369,6 +1419,66 @@ export abstract class WebChromeClientFlutterApi { (channelReply: ESObject) => callback.reply(null) ); } + + onJsAlert( + instanceIdArg: number, + urlArg: string, + messageArg: string, + callback: Reply + ): void { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsAlert", + WebChromeClientFlutterApi.getCodec() + ) + channel.send( + [instanceIdArg, urlArg, messageArg], + (channelReply: ESObject) => { + callback.reply(null); + } + ); + } + + onJsConfirm( + instanceIdArg: number, + urlArg: string, + messageArg: string, + callback: Reply + ): void { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsConfirm", + WebChromeClientFlutterApi.getCodec() + ) + channel.send( + [instanceIdArg, urlArg, messageArg], + (channelReply: ESObject) => { + let output: boolean = channelReply as boolean; + callback.reply(output); + } + ); + } + + onJsPrompt( + instanceIdArg: number, + urlArg: string, + messageArg: string, + defaultValueArg: string, + callback: Reply + ): void { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientFlutterApi.onJsPrompt", + WebChromeClientFlutterApi.getCodec() + ) + channel.send( + [instanceIdArg, urlArg, messageArg, defaultValueArg], + (channelReply: ESObject) => { + let output: string = channelReply as string; + callback.reply(output); + } + ); + } } export abstract class WebChromeClientHostApi { @@ -1376,6 +1486,14 @@ export abstract class WebChromeClientHostApi { abstract setSynchronousReturnValueForOnShowFileChooser(instanceId: number, value: boolean): void; + abstract setSynchronousReturnValueForOnConsoleMessage(instanceId: number, value: boolean): void; + + abstract setSynchronousReturnValueForOnJsAlert(instanceId: number, value: boolean): void; + + abstract setSynchronousReturnValueForOnJsConfirm(instanceId: number, value: boolean): void; + + abstract setSynchronousReturnValueForOnJsPrompt(instanceId: number, value: boolean): void; + static getCodec(): MessageCodec { return new StandardMessageCodec(); } @@ -1441,6 +1559,125 @@ export abstract class WebChromeClientHostApi { channel.setMessageHandler(null); } } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage", + WebChromeClientHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + { + onMessage: (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const valueArg: boolean = args[1]; + try { + api.setSynchronousReturnValueForOnConsoleMessage( + instanceIdArg, valueArg + ); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + } + ); + } else { + channel.setMessageHandler(null); + } + } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsAlert", + WebChromeClientHostApi.getCodec()); + if (api != null) { + channel.setMessageHandler({ + onMessage: (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const valueArg: boolean = args[1]; + try { + api.setSynchronousReturnValueForOnJsAlert( + instanceIdArg, valueArg + ); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + }); + } else { + channel.setMessageHandler(null); + } + } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsConfirm", + WebChromeClientHostApi.getCodec()); + if (api != null) { + channel.setMessageHandler({ + onMessage: (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const valueArg: boolean = args[1]; + try { + api.setSynchronousReturnValueForOnJsConfirm( + instanceIdArg, valueArg + ); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + }); + } else { + channel.setMessageHandler(null); + } + } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebChromeClientHostApi.setSynchronousReturnValueForOnJsPrompt", + WebChromeClientHostApi.getCodec()); + if (api != null) { + channel.setMessageHandler({ + onMessage: (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const valueArg: boolean = args[1]; + try { + api.setSynchronousReturnValueForOnJsPrompt( + instanceIdArg, valueArg + ); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + }); + } else { + channel.setMessageHandler(null); + } + } } } @@ -1801,7 +2038,7 @@ class WebViewClientFlutterApiCodec extends StandardMessageCodec { } export abstract class WebViewClientFlutterApi { - private binaryMessenger: BinaryMessenger; + protected binaryMessenger: BinaryMessenger; constructor(argBinaryMessenger: BinaryMessenger) { this.binaryMessenger = argBinaryMessenger; @@ -1897,6 +2134,25 @@ export abstract class WebViewClientFlutterApi { (channelReply: ESObject) => callback.reply(null) ); } + + onReceivedHttpAuthRequest( + instanceIdArg: number, + webViewInstanceIdArg: number, + httpAuthHandlerInstanceIdArg: number, + hostArg: string, + realmArg: string, + callback: Reply + ) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebViewClientFlutterApi.onReceivedHttpAuthRequest", + WebViewClientFlutterApi.getCodec() + ); + channel.send( + [instanceIdArg, webViewInstanceIdArg, httpAuthHandlerInstanceIdArg, hostArg, realmArg], + (channelReply: ESObject) => callback.reply(null) + ); + } } export abstract class WebSettingsHostApi { @@ -1930,6 +2186,8 @@ export abstract class WebSettingsHostApi { abstract setTextZoom(instanceId: number, textZoom: number): void; + abstract getUserAgentString(instanceId: number): Promise; + static getCodec(): MessageCodec { return new StandardMessageCodec(); } @@ -2412,6 +2670,35 @@ export abstract class WebSettingsHostApi { channel.setMessageHandler(null); } } + { + const channel: BasicMessageChannel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.WebSettingsHostApi.getUserAgentString", + WebSettingsHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + { + onMessage: async (message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + try { + let output = await api.getUserAgentString(instanceIdArg); + wrapped.insert(output, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + } + } + ); + } else { + channel.setMessageHandler(null); + } + } } } @@ -2552,6 +2839,126 @@ export class GeolocationPermissionsCallbackFlutterApi { } } +export abstract class HttpAuthHandlerHostApi { + abstract useHttpAuthUsernamePassword(instanceId: number): boolean; + + abstract cancel(instanceId: number): void; + + abstract proceed(instanceId: number, username: string, password: string): void; + + static getCodec(): MessageCodec { + return new StandardMessageCodec(); + } + + static setup(binaryMessenger: BinaryMessenger, api: HttpAuthHandlerHostApi) { + { + const channel: BasicMessageChannel = new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword", + HttpAuthHandlerHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + new MessageHandlerBuilder((message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdentifierArg: number = args[0]; + try { + let output: boolean = api.useHttpAuthUsernamePassword(instanceIdentifierArg); + wrapped.insert(output, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + }) + ) + } else { + channel.setMessageHandler(null); + } + } + { + const channel: BasicMessageChannel = new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.cancel", + HttpAuthHandlerHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + new MessageHandlerBuilder((message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdentifierArg: number = args[0]; + try { + api.cancel(instanceIdentifierArg); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + }) + ) + } else { + channel.setMessageHandler(null); + } + } + { + const channel: BasicMessageChannel = new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerHostApi.proceed", + HttpAuthHandlerHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + new MessageHandlerBuilder((message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdentifierArg: number = args[0] as number; + const usernameArg: string = args[1] as string; + const passwordArg: string = args[2] as string; + try { + api.proceed(instanceIdentifierArg, usernameArg, passwordArg); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + }) + ) + } else { + channel.setMessageHandler(null); + } + } + } +} + +export class HttpAuthHandlerFlutterApi { + private binaryMessenger: BinaryMessenger; + + constructor(binaryMessenger: BinaryMessenger) { + this.binaryMessenger = binaryMessenger; + } + + static getCodec(): MessageCodec { + return new StandardMessageCodec(); + } + + create(instanceIdArg: number, callback: Reply): void { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.HttpAuthHandlerFlutterApi.create", + HttpAuthHandlerHostApi.getCodec() + ); + channel.send( + [instanceIdArg], + (channelReply: ESObject) => callback.reply(null) + ); + } + +} + export abstract class CookieManagerHostApi { static getCodec(): MessageCodec { return new StandardMessageCodec(); @@ -2636,8 +3043,8 @@ export abstract class CookieManagerHostApi { const identifierArg: number = args[0]; const resultCallback: Result = new ResultBuilder( (result: Boolean) => { - wrapped.insert(null, 0); - reply.reply(wrapped); + wrapped.insert(result, 0); + reply.reply(wrapped.convertToArray()); }, (err) => { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); reply.reply(wrappedError.convertToArray()); @@ -2717,6 +3124,105 @@ export class PermissionRequestFlutterApi { } } +export abstract class CustomViewCallbackHostApi { + abstract onCustomViewHidden(identifier: number): void; + + static getCodec(): MessageCodec { + return new StandardMessageCodec(); + } + + static setup(binaryMessenger: BinaryMessenger, api: CustomViewCallbackHostApi) { + { + const channel: BasicMessageChannel = new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackHostApi.onCustomViewHidden", + CustomViewCallbackHostApi.getCodec() + ); + if (api != null) { + channel.setMessageHandler( + new MessageHandlerBuilder((message: ESObject, reply: Reply) => { + let wrapped: ArrayList = new ArrayList(); + const args: Array = message; + const instanceIdArg: number = args[0]; + const resourcesArg: string[] = args[1]; + try { + api.onCustomViewHidden(instanceIdArg); + wrapped.insert(null, 0); + } catch (err) { + const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); + wrapped = wrappedError; + } + reply.reply(wrapped.convertToArray()); + }) + ) + } + else { + channel.setMessageHandler(null); + } + } + } +} + +export interface HttpAuthHandler { + cancel(): void; + + proceed(username: string, password: string): void; + + useHttpAuthUsernamePassword(): boolean; +} + +export interface CustomViewCallback { + onCustomViewHidden(): void; +} + +export class CustomViewCallbackFlutterApi { + binaryMessenger: BinaryMessenger; + + constructor(binaryMessenger: BinaryMessenger) { + this.binaryMessenger = binaryMessenger; + } + + static getCodec(): MessageCodec { + return new StandardMessageCodec(); + } + + create(identifierArg: number, callback: Reply) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.CustomViewCallbackFlutterApi.create", + CustomViewCallbackFlutterApi.getCodec() + ); + channel.send( + [identifierArg], + (channelReply: ESObject) => callback.reply(null) + ); + } +} + +export class ViewFlutterApi { + binaryMessenger: BinaryMessenger; + + constructor(binaryMessenger: BinaryMessenger) { + this.binaryMessenger = binaryMessenger; + } + + static getCodec(): MessageCodec { + return new StandardMessageCodec(); + } + + create(identifierArg: number, callback: Reply) { + const channel: BasicMessageChannel = new BasicMessageChannel( + this.binaryMessenger, + "dev.flutter.pigeon.webview_flutter_ohos.ViewFlutterApi.create", + ViewFlutterApi.getCodec() + ); + channel.send( + [identifierArg], + (channelReply: ESObject) => callback.reply(null) + ); + } +} + export abstract class PermissionRequestHostApi { abstract grant(instanceId: number, resources: string[]); @@ -2984,7 +3490,7 @@ export abstract class JavaScriptChannelHostApi { abstract create(instanceId: number, channelName: string); static getCodec(): MessageCodec { - return new StandardMessageCodec(); + return WebChromeClientFlutterApiCodec.INSTANCE; } static setup(binaryMessenger: BinaryMessenger, api: JavaScriptChannelHostApi) { @@ -3004,7 +3510,7 @@ export abstract class JavaScriptChannelHostApi { const channelNameArg: string = args[1]; try { api.create(instanceIdArg, channelNameArg); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; @@ -3046,7 +3552,7 @@ export abstract class OhosObjectHostApi { const identifierArg: number = args[0]; try { api.dispose(identifierArg); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; @@ -3112,7 +3618,7 @@ export abstract class InstanceManagerHostApi { const channel: BasicMessageChannel = new BasicMessageChannel( - binaryMessenger, "dev.flutter.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec() + binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec() ); if (api != null) { @@ -3124,7 +3630,7 @@ export abstract class InstanceManagerHostApi { try { api.clear(); - wrapped.insert(0, null); + wrapped.insert(null, 0); } catch (err) { const wrappedError: ArrayList = GeneratedOhosWebView.wrapError(err); wrapped = wrappedError; diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerFlutterApiImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..13b7200157745d6938180211cce25998e8ebb887 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerFlutterApiImpl.ets @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { HttpAuthHandlerFlutterApi, Reply } from './GeneratedOhosWebView'; +import { InstanceManager } from './InstanceManager' + +/** + * Flutter API implementation for {@link HttpAuthHandler}. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +export class HttpAuthHandlerFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + binaryMessenger: BinaryMessenger; + + instanceManager: InstanceManager; + + api: HttpAuthHandlerFlutterApi; + + /** + * Constructs a {@link HttpAuthHandlerFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.api = new HttpAuthHandlerFlutterApi(binaryMessenger); + } + + /** + * Stores the `HttpAuthHandler` instance and notifies Dart to create and store a new + * `HttpAuthHandler` instance that is attached to this one. If `instance` has already been added, + * this method does nothing. + */ + create(instance: ESObject, callback: Reply) { + if (!this.instanceManager.containsInstance(instance)) { + this.api.create(this.instanceManager.addHostCreatedInstance(instance), callback); + } + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerHostApiImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..7435db6cf24d52302a661cbd5ef6a33788ae8f2b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerHostApiImpl.ets @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { HttpAuthHandlerHostApi, HttpAuthHandler } from './GeneratedOhosWebView'; +import { InstanceManager } from './InstanceManager' + +/** + * Host api implementation for {@link HttpAuthHandler}. + * + *

Handles creating {@link HttpAuthHandler}s that intercommunicate with a paired Dart object. + */ +export class HttpAuthHandlerHostApiImpl extends HttpAuthHandlerHostApi { + // To ease adding additional methods, this value is added prematurely. + binaryMessenger: BinaryMessenger; + + instanceManager: InstanceManager; + + /** + * Constructs a {@link HttpAuthHandlerHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { + super(); + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + } + + useHttpAuthUsernamePassword(instanceId: number): boolean { + return this.getHttpAuthHandlerInstance(instanceId).useHttpAuthUsernamePassword(); + } + + cancel(instanceId: number) { + this.getHttpAuthHandlerInstance(instanceId).cancel(); + } + + proceed(instanceId: number, username: string, password: string) { + this.getHttpAuthHandlerInstance(instanceId).proceed(username, password); + } + + getHttpAuthHandlerInstance(instanceId: number): HttpAuthHandler { + return this.instanceManager.getInstance(instanceId); + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets index bbffe2e34ac483ff06c17c0a05c65168a9385bf3..32e6c16b7e32d0510b821911f720570112c2ef82 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/InstanceManager.ets @@ -104,7 +104,7 @@ export class InstanceManager { getIdentifier(instance: Object): number { this.logWarningIfFinalizationListenerHasStopped(); - const identifier: number = this.identifiers.get(instance) || -1; + const identifier: number = this.identifiers.get(instance) ?? -1; return identifier; } diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets index 9fc0821650bf0a7c548d9abb8dc32e1bde639efa..7c1b68e4e81fbb964003c4ea56a2d4f184947186 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets @@ -21,7 +21,7 @@ export class OhosObjectHostApiImpl extends OhosObjectHostApi { private instanceManager: InstanceManager; /** - * Constructs a {@link JavaObjectHostApiImpl}. + * Constructs a {@link OhosObjectHostApiImpl}. * * @param instanceManager maintains instances stored to communicate with Dart objects */ @@ -31,10 +31,6 @@ export class OhosObjectHostApiImpl extends OhosObjectHostApi { } dispose(identifier: number) { - const instance: ESObject = this.instanceManager.getInstance(identifier); - if (instance instanceof WebViewPlatformView) { - (instance as ESObject).destroy(); - } this.instanceManager.remove(identifier); } } diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets index 2581df140704942d846bfd107b3a889accaf6a28..3f6f322119b069de27e196c549e0b2e45a8c4829 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosWebView.ets @@ -14,62 +14,99 @@ */ import web_webview from '@ohos.web.webview' -import { DynamicUtils } from "./DynamicUtils" - -import { BuilderParams, DVModelParameters } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' +import { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView'; +import { WebViewPlatformView } from './WebViewHostApiImpl'; +import { Any } from '@ohos/flutter_ohos'; @Component export struct OhosWebView { - @Prop params: DVModelParameters = new DVModelParameters(); - controller: web_webview.WebviewController = new web_webview.WebviewController() + @Prop params: Params; + webView: WebViewPlatformView = this.params.platformView as WebViewPlatformView; + controller: web_webview.WebviewController = this.webView.getController(); + + @State textZoomRatio: number = this.webView.getWebSettings().getTextZoom(); + @State disposed: boolean = false; + + aboutToAppear() { + this.webView.getWebSettings().onTextZoomChanged((ratio: number) => { + this.textZoomRatio = ratio; + }); + this.webView.setOnDisposeCallback(() => { + this.disposed = true; + }); + } build() { Column() { - Web( - { - src: DynamicUtils.getParams(this.params, "src"), - controller: this.controller - }) - .backgroundColor(DynamicUtils.getParams(this.params, "backgroundColor")) - .onDownloadStart(DynamicUtils.getParams(this.params, "onDownloadStart")) - .onPageBegin(DynamicUtils.getParams(this.params, "onPageBegin")) - .onPageEnd(DynamicUtils.getParams(this.params, "onPageEnd")) - .onErrorReceive(DynamicUtils.getParams(this.params, "onErrorReceive")) - .onLoadIntercept(DynamicUtils.getParams(this.params, "onLoadIntercept")) - .onRefreshAccessedHistory(DynamicUtils.getParams(this.params, "onRefreshAccessedHistory")) - .onProgressChange(DynamicUtils.getParams(this.params, "onProgressChange")) - .onGeolocationShow(DynamicUtils.getParams(this.params, "onGeolocationShow")) - .onGeolocationHide(DynamicUtils.getParams(this.params, "onGeolocationHide")) - .onShowFileSelector(DynamicUtils.getParams(this.params, "onShowFileSelector")) - .onPermissionRequest(DynamicUtils.getParams(this.params, "onPermissionRequest")) - // .onWindowNew(DynamicUtils.getParams(this.params, "onWindowNew")) - .onWindowExit(DynamicUtils.getParams(this.params, "onWindowExit")) - .domStorageAccess(DynamicUtils.getParams(this.params, "domStorageAccess")) - .allowWindowOpenMethod(DynamicUtils.getParams(this.params, "allowWindowOpenMethod")) - .multiWindowAccess(DynamicUtils.getParams(this.params, "multiWindowAccess")) - .javaScriptAccess(DynamicUtils.getParams(this.params, "javaScriptAccess")) - .mediaPlayGestureAccess(DynamicUtils.getParams(this.params, "mediaPlayGestureAccess")) - .zoomAccess(DynamicUtils.getParams(this.params, "zoomAccess")) - .overviewModeAccess(DynamicUtils.getParams(this.params, "overviewModeAccess")) - .wideViewModeAccess(DynamicUtils.getParams(this.params, "wideViewModeAccess")) - .fileAccess(DynamicUtils.getParams(this.params, "fileAccess")) - .textZoomRatio(DynamicUtils.getParams(this.params, "textZoomRatio")) - .onScroll(DynamicUtils.getParams(this.params, "onScroll")) - .onWindowNew((event) => { - let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); - let dialogController: CustomDialogController = new CustomDialogController({ - builder: NewWebView({ webViewController: newWebViewController }) + if (!this.disposed) { + Web( + { + src: this.webView.getUrl(), + controller: this.controller, + renderMode: RenderMode.SYNC_RENDER + }) + .keyboardAvoidMode(WebKeyboardAvoidMode.RESIZE_VISUAL) + .backgroundColor(this.webView.getWebSettings().getBackgroundColor()) + .onDownloadStart(this.webView.onDownloadStart) + .onPageBegin(this.webView.onPageBegin) + .onPageEnd(this.webView.onPageEnd) + .onErrorReceive(this.webView.onErrorReceive) + .onRefreshAccessedHistory(this.webView.onRefreshAccessedHistory) + .onProgressChange(this.webView.onProgressChange) + .onGeolocationShow(this.webView.onGeolocationShow) + .onGeolocationHide(this.webView.onGeolocationHide) + .onShowFileSelector(this.webView.onShowFileSelector) + .onPermissionRequest(this.webView.onPermissionRequest) + .onConsole(this.webView.onConsoleMessage) + .onWindowExit(this.webView.onWindowExit) + .domStorageAccess(this.webView.getWebSettings().getDomStorageEnabled()) + .allowWindowOpenMethod(this.webView.getWebSettings().getJavaScriptCanOpenWindowsAutomatically()) + .multiWindowAccess(false) + .javaScriptAccess(this.webView.getWebSettings().getJavaScriptEnabled()) + .mediaPlayGestureAccess(this.webView.getWebSettings().getMediaPlaybackRequiresUserGesture()) + .zoomAccess(this.webView.getWebSettings().getSupportZoom()) + .overviewModeAccess(this.webView.getWebSettings().getLoadWithOverviewMode()) + .wideViewModeAccess(this.webView.getWebSettings().getUseWideViewPort()) + .fileAccess(this.webView.getWebSettings().getAllowFileAccess()) + .textZoomRatio(this.textZoomRatio) + .onScroll(this.webView.onScroll) + .onControllerAttached(this.webView.onControllerAttached) + .onWindowNew((event: Any) => { + let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); + let dialogController: CustomDialogController = new CustomDialogController({ + builder: NewWebView({ webViewController: newWebViewController }) + }) + dialogController.open(); + event.handler.setWebController(newWebViewController); + }) + .onSslErrorEventReceive((event) => { + event.handler.handleConfirm(); }) - dialogController.open(); - event.handler.setWebController(newWebViewController); - }) + .onAlert(this.webView.onJsAlert) + .onConfirm(this.webView.onJsConfirm) + .onPrompt(this.webView.onJsPrompt) + .mixedMode(MixedMode.All) + .onOverrideUrlLoading(this.webView.onOverrideUrlLoading) + .gesture( + PinchGesture({ fingers: 2 }) + .onActionUpdate((event: GestureEvent) => { + if (event && this.webView.getWebSettings().getSupportZoom()) { + this.controller.zoom(event.scale); + } + }) + ) + } } } } @Builder -export function buildOhosWebView(param: BuilderParams) { - OhosWebView({ params: param.params, controller: DynamicUtils.getParams(param.params, "controller") }) +export function WebBuilder(params: Params) { + OhosWebView({ + params: params, + webView: params.platformView as WebViewPlatformView, + controller: (params.platformView as WebViewPlatformView).getController() + }) } @CustomDialog diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/ViewFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/ViewFlutterApiImpl.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6ef91a0c48c1f0f0df36703a71bc2f89a3bcc78 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/ViewFlutterApiImpl.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { ViewFlutterApi, Reply } from './GeneratedOhosWebView'; +import { InstanceManager } from './InstanceManager' + +/** + * Flutter API implementation for `View`. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +export class ViewFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + binaryMessenger: BinaryMessenger; + + instanceManager: InstanceManager; + api: ViewFlutterApi; + + /** + * Constructs a {@link ViewFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.api = new ViewFlutterApi(binaryMessenger); + } + + /** + * Stores the `View` instance and notifies Dart to create and store a new `View` instance that is + * attached to this one. If `instance` has already been added, this method does nothing. + */ + create(instance: ESObject, callback: Reply) { + if (!this.instanceManager.containsInstance(instance)) { + this.api.create(this.instanceManager.addHostCreatedInstance(instance), callback); + } + } + + /** + * Sets the Flutter API used to send messages to Dart. + * + *

This is only visible for testing. + */ + setApi(api: ViewFlutterApi) { + this.api = api; + } +} diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets index 8451115ddd541c2196c555fcccf5013d741877d4..081b561db69b44c1fcfb0246be4390443d5b3fb3 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets @@ -14,16 +14,20 @@ */ import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import { CustomViewCallbackFlutterApiImpl } from './CustomViewCallbackFlutterApiImpl'; +import { DVModel } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView'; import { FileChooserParamsFlutterApiImpl } from './FileChooserParamsFlutterApiImpl'; import GeneratedOhosWebView, { ConsoleMessageLevel, ConsoleMessage as FlutterConsoleMessage, + CustomViewCallback, Reply, WebChromeClientFlutterApi } from './GeneratedOhosWebView'; import { GeolocationPermissionsCallbackFlutterApiImpl } from './GeolocationPermissionsCallbackFlutterApiImpl'; import { InstanceManager } from './InstanceManager'; import { PermissionRequestFlutterApiImpl } from './PermissionRequestFlutterApiImpl'; +import { ViewFlutterApiImpl } from './ViewFlutterApiImpl'; import { WebChromeClient } from './WebChromeClientHostApiImpl'; import { WebViewFlutterApiImpl } from './WebViewFlutterApiImpl'; import { WebViewPlatformView } from './WebViewHostApiImpl'; @@ -31,12 +35,8 @@ import { WebViewPlatformView } from './WebViewHostApiImpl'; const TAG: string = "WebChromeClientFlutterApiImpl"; export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { - private binaryMessengerImpl: BinaryMessenger; - private instanceManager: InstanceManager; - private webViewFlutterApi: WebViewFlutterApiImpl; - private emptyReply: Reply = { reply: (reply) => { } @@ -61,7 +61,6 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { super(binaryMessenger); - this.binaryMessengerImpl = binaryMessenger; this.instanceManager = instanceManager; this.webViewFlutterApi = new WebViewFlutterApiImpl(binaryMessenger, instanceManager); } @@ -87,7 +86,7 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { this.webViewFlutterApi.create(webView, this.emptyReply); new FileChooserParamsFlutterApiImpl( - this.binaryMessengerImpl, + this.binaryMessenger, this.instanceManager ).create( fileChooserParams, @@ -108,7 +107,7 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { callback: JsGeolocation, replyCallback: Reply ) { - new GeolocationPermissionsCallbackFlutterApiImpl(this.binaryMessengerImpl, this.instanceManager) + new GeolocationPermissionsCallbackFlutterApiImpl(this.binaryMessenger, this.instanceManager) .create(callback, this.emptyReply); this.onGeolocationPermissionsShowPrompt( this.instanceManager.getIdentifier(webChromeClient), @@ -132,7 +131,7 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { request: PermissionRequest, callback: Reply ) { - new PermissionRequestFlutterApiImpl(this.binaryMessengerImpl, this.instanceManager) + new PermissionRequestFlutterApiImpl(this.binaryMessenger, this.instanceManager) .create(request, request.getAccessibleResource(), this.emptyReply); this.onPermissionRequest( @@ -142,6 +141,31 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { ); } + onShowCustomViewImpl( + instance: WebChromeClient, + view: DVModel, + customViewCallback: CustomViewCallback, + callback: Reply + ) { + new ViewFlutterApiImpl(this.binaryMessenger, this.instanceManager).create(view, this.emptyReply); + new CustomViewCallbackFlutterApiImpl(this.binaryMessenger, this.instanceManager) + .create(customViewCallback, this.emptyReply); + + this.onShowCustomView( + this.instanceManager.getIdentifier(instance), + this.instanceManager.getIdentifier(view), + this.instanceManager.getIdentifier(customViewCallback), + callback + ); + } + + onHideCustomViewImpl(instance: WebChromeClient, callback: Reply) { + this.onHideCustomView( + this.instanceManager.getIdentifier(instance), + callback + ); + } + onConsoleMessageImpl( instance: WebChromeClient, message: ConsoleMessage, @@ -159,6 +183,31 @@ export class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { ); } + onJsAlertImpl( + instance: WebChromeClient, + url: string, + message: string, + callback: Reply) { + this.onJsAlert(this.getIdentifierForClient(instance), url, message, callback); + } + + onJsConfirmImpl( + instance: WebChromeClient, + url: string, + message: string, + callback: Reply) { + this.onJsConfirm(this.getIdentifierForClient(instance), url, message, callback); + } + + onJsPromptImpl( + instance: WebChromeClient, + url: string, + message: string, + defaultValue: string, + callback: Reply) { + this.onJsPrompt(this.getIdentifierForClient(instance), url, message, defaultValue, callback); + } + getIdentifierForClient(webChromeClient: WebChromeClient): number { const identifier: number = this.instanceManager.getIdentifier(webChromeClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientHostApiImpl.ets index 18328c81e935b277ed6e71547d876b42175f505c..71188770ba7c8c4887356b8bad53cbf77c95592d 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebChromeClientHostApiImpl.ets @@ -14,13 +14,13 @@ */ import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; -import { Reply, WebChromeClientHostApi } from './GeneratedOhosWebView'; +import { Reply, WebChromeClientHostApi, CustomViewCallback, HttpAuthHandler } from './GeneratedOhosWebView'; import { InstanceManager } from './InstanceManager'; import { OhosWebView } from './OhosWebView'; import { WebChromeClientFlutterApiImpl } from './WebChromeClientFlutterApiImpl'; import { WebViewPlatformView } from './WebViewHostApiImpl' import { WebViewClient } from './WebViewClientHostApiImpl'; -import { BuilderParams, DVModelParameters } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' +import { BuilderParams, DVModelParameters, DVModel } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' import web_webview from '@ohos.web.webview' const TAG: string = "WebChromeClientHostApiImpl"; @@ -41,6 +41,12 @@ export interface WebChromeClient { onConsoleMessage(message: ConsoleMessage): void; onCreateWindow(webView: WebViewPlatformView, isDialog: boolean, isUserGesture: boolean, handler: ControllerHandler): void; + + onJsAlert(webView: WebViewPlatformView, url: string, message: string, result: JsResult): boolean; + + onJsConfirm(webView: WebViewPlatformView, url: string, message: string, result: JsResult): boolean; + + onJsPrompt(webView: WebViewPlatformView, url: string, message: string, defaultValue: string, result: JsResult): boolean; } export class WebChromeClientHostApiImpl extends WebChromeClientHostApi { @@ -70,54 +76,35 @@ export class WebChromeClientHostApiImpl extends WebChromeClientHostApi { const webChromeClient: WebChromeClientImpl = this.instanceManager.getInstance(instanceId); webChromeClient.setReturnValueForOnShowFileChooser(value); } -} - -export class WebChromeClientCreator { - createWebChromeClient(flutterApi: WebChromeClientFlutterApiImpl): WebChromeClientImpl { - return new WebChromeClientImpl(flutterApi); - } -} - -class SecureWebChromeClient implements WebChromeClient { - onProgressChanged(view: WebViewPlatformView, progress: number) { - Log.i(TAG, "onProgressChanged"); - } - - onGeolocationPermissionsShowPrompt(origin: string, callback: JsGeolocation) { - Log.i(TAG, "onGeolocationPermissionsShowPrompt"); - } - onGeolocationPermissionsHidePrompt() { - Log.i(TAG, "onGeolocationPermissionsHidePrompt"); + setSynchronousReturnValueForOnConsoleMessage(instanceId: number, value: boolean) { + const webChromeClient: WebChromeClientImpl = this.instanceManager.getInstance(instanceId); + webChromeClient.setReturnValueForOnConsoleMessage(value); } - onShowFileChooser( - webView: WebViewPlatformView, filePathCallback: FileSelectorResult, fileChooserParams: FileSelectorParam - ) { - return true; + setSynchronousReturnValueForOnJsAlert(instanceId: number, value: boolean) { + const webChromeClient: WebChromeClientImpl = this.instanceManager.getInstance(instanceId); + webChromeClient.setReturnValueForOnJsAlert(value); } - onPermissionRequest(request: PermissionRequest) { - Log.i(TAG, "onPermissionRequest"); + setSynchronousReturnValueForOnJsConfirm(instanceId: number, value: boolean) { + const webChromeClient: WebChromeClientImpl = this.instanceManager.getInstance(instanceId); + webChromeClient.setReturnValueForOnJsConfirm(value); } - onConsoleMessage(message: ConsoleMessage) { - Log.i(TAG, "onConsoleMessage"); + setSynchronousReturnValueForOnJsPrompt(instanceId: number, value: boolean) { + const webChromeClient: WebChromeClientImpl = this.instanceManager.getInstance(instanceId); + webChromeClient.setReturnValueForOnJsPrompt(value); } +} - onCreateWindow(webView: WebViewPlatformView, isDialog: boolean, isUserGesture: boolean, handler: ControllerHandler) { - if (webView.getDialogController() != null) { - webView.getDialogController()?.close(); - } - let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); - let dialogController: CustomDialogController = new CustomDialogController({ - builder: NewWebView({ webViewController: newWebViewController }) - }) - dialogController.open(); - handler.setWebController(newWebViewController); +export class WebChromeClientCreator { + createWebChromeClient(flutterApi: WebChromeClientFlutterApiImpl): WebChromeClientImpl { + return new WebChromeClientImpl(flutterApi); } } + @CustomDialog struct NewWebView { controller?: CustomDialogController @@ -137,12 +124,16 @@ struct NewWebView { } } -class WebChromeClientImpl extends SecureWebChromeClient { +class WebChromeClientImpl implements WebChromeClient { private flutterApi: WebChromeClientFlutterApiImpl; private returnValueForOnShowFileChooser: boolean = false; + private returnValueForOnConsoleMessage: boolean = false; + + private returnValueForOnJsAlert : boolean = false; + private returnValueForOnJsConfirm : boolean = false; + private returnValueForOnJsPrompt : boolean = false; constructor(flutterApi: WebChromeClientFlutterApiImpl) { - super(); this.flutterApi = flutterApi; } @@ -151,12 +142,32 @@ class WebChromeClientImpl extends SecureWebChromeClient { } } + onCreateWindow(webView: WebViewPlatformView, isDialog: boolean, isUserGesture: boolean, handler: ControllerHandler) { + if (webView.getDialogController() != null) { + webView.getDialogController()?.close(); + } + let newWebViewController: web_webview.WebviewController = new web_webview.WebviewController(); + let dialogController: CustomDialogController = new CustomDialogController({ + builder: NewWebView({ webViewController: newWebViewController }) + }) + dialogController.open(); + handler.setWebController(newWebViewController); + } + onProgressChanged(view: WebViewPlatformView, progress: number) { this.flutterApi.onProgressChangedImpl( this, view, progress, this.emptyReply ) } + onShowCustomView(view: DVModel, callback: CustomViewCallback) { + this.flutterApi.onShowCustomViewImpl(this, view, callback, this.emptyReply); + } + + onHideCustomView() { + this.flutterApi.onHideCustomViewImpl(this, this.emptyReply); + } + onGeolocationPermissionsShowPrompt(origin: string, callback: JsGeolocation) { this.flutterApi.onGeolocationPermissionsShowPromptImpl(this, origin, callback, this.emptyReply); } @@ -185,9 +196,77 @@ class WebChromeClientImpl extends SecureWebChromeClient { this.flutterApi.onPermissionRequestImpl(this, request, this.emptyReply); } + onConsoleMessage(consoleMessage: ConsoleMessage): boolean { + this.flutterApi.onConsoleMessageImpl(this, consoleMessage, this.emptyReply); + return this.returnValueForOnConsoleMessage; + } + setReturnValueForOnShowFileChooser(value: boolean) { this.returnValueForOnShowFileChooser = value; } + + setReturnValueForOnConsoleMessage(value: boolean) { + this.returnValueForOnConsoleMessage = value; + } + + setReturnValueForOnJsAlert(value: boolean) { + this.returnValueForOnJsAlert = value; + } + + setReturnValueForOnJsConfirm(value: boolean) { + this.returnValueForOnJsConfirm = value; + } + + setReturnValueForOnJsPrompt(value: boolean) { + this.returnValueForOnJsPrompt = value; + } + + onJsAlert(webView: WebViewPlatformView, url: string, message: string, result: JsResult) { + if (this.returnValueForOnJsAlert) { + this.flutterApi.onJsAlertImpl(this, url, message, { + reply: () => { + result.handleConfirm(); + } + }); + return true; + } else { + return false; + } + } + + onJsConfirm(webView: WebViewPlatformView, url: string, message: string, result: JsResult) { + if (this.returnValueForOnJsConfirm) { + this.flutterApi.onJsConfirmImpl(this, url, message, { + reply: (data: boolean | null) => { + if (data) { + result.handleConfirm(); + } else { + result.handleCancel(); + } + } + }) + return true; + } else { + return false; + } + } + + onJsPrompt(webView: WebViewPlatformView, url: string, message: string, defaultValue: string, result: JsResult) { + if (this.returnValueForOnJsPrompt) { + this.flutterApi.onJsPromptImpl(this, url, message, defaultValue, { + reply: (data: string | null) => { + if (data != null) { + result.handlePromptConfirm(data); + } else { + result.handleCancel(); + } + } + }) + return true; + } else { + return false; + } + } } class newWindowWebViewClient implements WebViewClient { @@ -211,4 +290,14 @@ class newWindowWebViewClient implements WebViewClient { view.getController().loadUrl(request.getRequestUrl()); return true; } + + onReceivedHttpAuthRequest( + view: WebViewPlatformView, + handler: HttpAuthHandler, + host: string, + realm: string + ): void { + // todo + Log.i(TAG, "onReceivedHttpAuthRequest"); + } } \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets index 1813e54f7a5a3794e631aaadc31aff8080521146..cc6f5912e1cfc79912eeea789c78e39ee2820d35 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebSettingsHostApiImpl.ets @@ -20,31 +20,58 @@ import { WebViewPlatformView } from './WebViewHostApiImpl'; export interface WebSettings { setDomStorageEnabled(flag: boolean): void; + getDomStorageEnabled(): boolean; + setJavaScriptCanOpenWindowsAutomatically(flag: boolean): void; + getJavaScriptCanOpenWindowsAutomatically(): boolean; + setSupportMultipleWindows(support: boolean): void; + getSupportMultipleWindows(): boolean; + setBackgroundColor(color: number): void; + getBackgroundColor(): string; + setJavaScriptEnabled(flag: boolean): void; + getJavaScriptEnabled(): boolean; + setUserAgentString(userAgentString: string): void; setMediaPlaybackRequiresUserGesture(require: boolean): void; + getMediaPlaybackRequiresUserGesture(): boolean; + setSupportZoom(support: boolean): void; + getSupportZoom(): boolean; + setLoadWithOverviewMode(overview: boolean): void; + getLoadWithOverviewMode(): boolean; + setUseWideViewPort(use: boolean): void; + getUseWideViewPort(): boolean; + setDisplayZoomControls(enabled: boolean): void; setBuiltInZoomControls(enabled: boolean): void; setAllowFileAccess(enabled: boolean): void; + getAllowFileAccess(): boolean; + setTextZoom(textZoom: number): void; + + getTextZoom(): number; + + + getUserAgentString(): Promise; + + onTextZoomChanged(callback: (ratio: number) => void): void; } export class WebSettingsCreator { @@ -138,4 +165,9 @@ export class WebSettingsHostApiImpl extends WebSettingsHostApi { const webSettings:WebSettings = this.instanceManager.getInstance(instanceId); webSettings.setTextZoom(textZoom); } + + getUserAgentString(instanceId: number): Promise { + const webSettings:WebSettings = this.instanceManager.getInstance(instanceId); + return webSettings.getUserAgentString(); + } } \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientFlutterApiImpl.ets index 4525f15383836715338e7d239d74cf57ed745727..ddd83a4b9e179799c47606aadf7951dd76bf90d3 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientFlutterApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientFlutterApiImpl.ets @@ -19,15 +19,16 @@ import { WebResourceErrorData, WebResourceRequestData, WebViewClientFlutterApi, - WebViewFlutterApi + WebViewFlutterApi, + HttpAuthHandler, } from './GeneratedOhosWebView'; +import { HttpAuthHandlerFlutterApiImpl } from './HttpAuthHandlerFlutterApiImpl'; import { InstanceManager } from './InstanceManager'; import { WebViewClient } from './WebViewClientHostApiImpl'; import { WebViewFlutterApiImpl } from './WebViewFlutterApiImpl'; import { WebViewHostApiImpl, WebViewPlatformView } from './WebViewHostApiImpl'; export class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { - private binaryMessengerImpl: BinaryMessenger; private instanceManager: InstanceManager; private webViewFlutterApi: WebViewFlutterApiImpl; private emptyReply: Reply = { @@ -66,7 +67,6 @@ export class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) { super(binaryMessenger); - this.binaryMessengerImpl = binaryMessenger; this.instanceManager = instanceManager; this.webViewFlutterApi = new WebViewFlutterApiImpl(binaryMessenger, instanceManager); } @@ -148,6 +148,26 @@ export class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { ) } + onReceivedHttpAuthRequestImpl( + webViewClient: WebViewClient, + webview: WebViewPlatformView, + httpAuthHandler: HttpAuthHandler, + host: string, + realm: string, + callback: Reply + ) { + new HttpAuthHandlerFlutterApiImpl(this.binaryMessenger, this.instanceManager) + .create(httpAuthHandler, this.emptyReply); + + this.onReceivedHttpAuthRequest( + this.instanceManager.getIdentifier(webViewClient), + this.instanceManager.getIdentifier(webview), + this.instanceManager.getIdentifier(httpAuthHandler), + host, + realm, + callback); + } + getIdentifierForClient(webViewClient: WebViewClient): number { let identifier: number = this.instanceManager.getIdentifier(webViewClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets index f8da0a1f314f8dce47a9b9b59864a3216a46f6d5..5f7d14082ab42829e75139cb7146c160fd20ba97 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewClientHostApiImpl.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { Reply, WebViewClientHostApi } from './GeneratedOhosWebView'; +import { Reply, WebViewClientHostApi, HttpAuthHandler } from './GeneratedOhosWebView'; import { InstanceManager } from './InstanceManager'; import { WebViewClientFlutterApiImpl } from './WebViewClientFlutterApiImpl'; import { WebViewPlatformView } from './WebViewHostApiImpl'; @@ -28,6 +28,13 @@ export interface WebViewClient { shouldOverrideUrlLoading(view: WebViewPlatformView, request: WebResourceRequest): boolean; doUpdateVisitedHistory(view: WebViewPlatformView, url: string, isReload: boolean): void; + + onReceivedHttpAuthRequest( + view: WebViewPlatformView, + handler: HttpAuthHandler, + host: string, + realm: string + ): void; } export class WebViewClientImpl implements WebViewClient { @@ -55,7 +62,7 @@ export class WebViewClientImpl implements WebViewClient { } shouldOverrideUrlLoading(view: WebViewPlatformView, request: WebResourceRequest): boolean { - view.setReturnValueForShouldOverrideUrlLoading(this.returnValueForShouldOverrideUrlLoading); + this.flutterApi.requestLoadingImpl(this, view, request, this.emptyReply); return this.returnValueForShouldOverrideUrlLoading; } @@ -63,6 +70,14 @@ export class WebViewClientImpl implements WebViewClient { this.flutterApi.doUpdateVisitedHistoryImpl(this, view, url, isReload, this.emptyReply); } + onReceivedHttpAuthRequest( + view: WebViewPlatformView, + handler: HttpAuthHandler, + host: string, + realm: string) { + this.flutterApi.onReceivedHttpAuthRequestImpl(this, view, handler, host, realm, this.emptyReply); +} + setReturnValueForShouldOverrideUrlLoading(value: boolean) { this.returnValueForShouldOverrideUrlLoading = value; } diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterApiImpl.ets index e06df613225b854750304444f555bdf88dab3e12..a6de573c03facf8c0667efe4b64dfbc9140bad57 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterApiImpl.ets @@ -14,7 +14,7 @@ */ import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; -import { Reply, WebViewFlutterApi } from './GeneratedOhosWebView'; +import { Reply, WebViewFlutterApi, WebViewHostApi } from './GeneratedOhosWebView'; import { InstanceManager } from './InstanceManager'; import { WebViewPlatformView } from './WebViewHostApiImpl'; @@ -38,4 +38,20 @@ export class WebViewFlutterApiImpl { setApi(api: WebViewFlutterApi): void { this.api = api; } + + onScrollChanged( + instance: WebViewHostApi, + left: number, + top: number, + oldLeft: number, + oldTop: number, + callback: Reply): void { + this.api.onScrollChanged( + this.instanceManager.getIdentifier(instance), + left, + top, + oldLeft, + oldTop, + callback); + } } \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterPlugin.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterPlugin.ets index 42a2dd6111c874f0ec9b4981c81bd18494ceef6c..644d20cf0e0aa73c665d45b57951daf988cb1002 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterPlugin.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewFlutterPlugin.ets @@ -19,15 +19,18 @@ import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/B import PlatformViewRegistry from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformViewRegistry'; import { OhosObjectHostApiImpl } from './OhosObjectHostApiImpl'; import { CookieManagerHostApiImpl } from './CookieManagerHostApiImpl'; +import { CustomViewCallbackHostApiImpl } from './CustomViewCallbackHostApiImpl'; import { DownloadListenerFlutterApiImpl } from './DownloadListenerFlutterApiImpl'; import { DownloadListenerCreator, DownloadListenerHostApiImpl } from './DownloadListenerHostApiImpl'; import { FlutterAssetManager, PluginBindingFlutterAssetManager } from './FlutterAssetManager'; import { FlutterAssetManagerHostApiImpl } from './FlutterAssetManagerHostApiImpl'; import GeneratedOhosWebView, { CookieManagerHostApi, + CustomViewCallbackHostApi, DownloadListenerHostApi, FlutterAssetManagerHostApi, GeolocationPermissionsCallbackHostApi, + HttpAuthHandlerHostApi, InstanceManagerHostApi, JavaScriptChannelHostApi, PermissionRequestHostApi, @@ -41,6 +44,7 @@ import GeneratedOhosWebView, { WebStorageHostApi } from './GeneratedOhosWebView'; import { GeolocationPermissionsCallbackHostApiImpl } from './GeolocationPermissionsCallbackHostApiImpl'; +import { HttpAuthHandlerHostApiImpl } from './HttpAuthHandlerHostApiImpl'; import { InstanceManager } from './InstanceManager'; import { JavaScriptChannelCreator, JavaScriptChannelHostApiImpl } from './JavaScriptChannelHostApiImpl'; import { PermissionRequestHostApiImpl } from './PermissionRequestHostApiImpl'; @@ -155,6 +159,10 @@ export class WebViewFlutterPlugin implements FlutterPlugin { binaryMessenger, new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, this.instanceManager) ); + CustomViewCallbackHostApi.setup( + binaryMessenger, new CustomViewCallbackHostApiImpl(binaryMessenger, this.instanceManager)); + HttpAuthHandlerHostApi.setup( + binaryMessenger, new HttpAuthHandlerHostApiImpl(binaryMessenger, this.instanceManager)); } onAttachedToEngine(binding: FlutterPluginBinding) { diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets index 68681a1f47c7180846208ad759e5fb4b7c83bd40..63147881d1bcda30ba950e6e1f86a6cdf2172a9f 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets @@ -13,11 +13,11 @@ * limitations under the License. */ -import PlatformView from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView' +import PlatformView, { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView' import { DVModel, DVModelParameters } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView' import { Result, WebViewHostApi, WebViewPoint } from './GeneratedOhosWebView' import web_webview from '@ohos.web.webview' -import { buildOhosWebView, OhosWebView } from './OhosWebView' +import { WebBuilder, OhosWebView } from './OhosWebView' import { createDVModelFromJson } from '@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicViewJson' import { DVModelJson } from "./DynamicUtils" import { InstanceManager } from './InstanceManager' @@ -31,6 +31,7 @@ import { DownloadListener } from './DownloadListenerFlutterApiImpl' import { DisplayListenerProxy } from './DisplayListenerProxy' import { JavaScriptChannel } from './JavaScriptChannel' import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; +import { WebViewFlutterApiImpl } from './WebViewFlutterApiImpl.ets' const TAG: string = "WebViewHostApiImpl"; @@ -42,6 +43,7 @@ export class WebViewHostApiImpl extends WebViewHostApi { private binaryMessenger: BinaryMessenger; private context: common.Context; + private api?: WebViewFlutterApiImpl; constructor( instanceManager: InstanceManager, @@ -70,40 +72,34 @@ export class WebViewHostApiImpl extends WebViewHostApi { loadData(instanceId: number, data: string, mimeType: string, encoding: string): void { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); - webView.getController().loadData(data, mimeType, encoding); + webView.getController().loadData(data, mimeType, encoding, " ", " "); } - loadDataWithBaseUrl( + async loadDataWithBaseUrl( instanceId: number, baseUrl: string, data: string, mimeType: string, encoding: string, historyUrl: string - ): void { + ): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); + await webView.waitControllerAttached(); try { - webView.getController().loadData(data, mimeType, encoding, baseUrl == null ? "" : baseUrl , historyUrl == null ? "" : historyUrl); + // 当baseUrl为空时,其值默认为resource://rawfile/。这样设置是为了解决标签锚点无效问题。 + webView.getController().loadData(data, mimeType, encoding, baseUrl == null || baseUrl.trim().length === 0 ? "resource://rawfile/" : baseUrl , historyUrl == null ? " " : historyUrl); } catch (err) { Log.e(TAG, "loadDataWithBaseUrl err = " + err); - setTimeout( - () => { - this.loadDataWithBaseUrl(instanceId, baseUrl, data, mimeType, encoding, historyUrl); - }, 500 - ) } } - loadUrl(instanceId: number, url: string, headers: Map): void { + async loadUrl(instanceId: number, url: string, headers: Map): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); + await webView.waitControllerAttached(); try { if (url.startsWith("resources/rawfile/")) { webView.getController().loadUrl($rawfile(url.replace("resources/rawfile/","")), this.toWebHeaders(headers)); }else { webView.getController().loadUrl(url, this.toWebHeaders(headers)); } + webView.setUrl(webView.getController().getUrl()); } catch (err) { Log.e(TAG, "loadUrl err = " + err); - setTimeout( - () => { - this.loadUrl(instanceId, url, headers); - }, 500 - ) } } @@ -121,9 +117,14 @@ export class WebViewHostApiImpl extends WebViewHostApi { return result; } - postUrl(instanceId: number, url: string, data: Uint8Array): void { - // TODO:确认实现方式 + async postUrl(instanceId: number, url: string, data: Uint8Array): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); + await webView.waitControllerAttached(); + try { + webView.getController().postUrl(url,data.buffer); + } catch (err) { + Log.e(TAG, "postUrl err = " + err); + } } getUrl(instanceId: number): string { @@ -218,9 +219,10 @@ export class WebViewHostApiImpl extends WebViewHostApi { webView.setWebViewClient(this.instanceManager.getInstance(webViewClientInstanceId)); } - addJavaScriptChannel(instanceId: number, javaScriptChannelInstanceId: number): void { + async addJavaScriptChannel(instanceId: number, javaScriptChannelInstanceId: number): Promise { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); const javaScriptChannel: JavaScriptChannel = this.instanceManager.getInstance(javaScriptChannelInstanceId); + await webView.waitControllerAttached(); try { webView.getController().registerJavaScriptProxy( { @@ -234,11 +236,6 @@ export class WebViewHostApiImpl extends WebViewHostApi { webView.getController().refresh() } catch (err) { Log.e(TAG, "addJavaScriptChannel err = " + err); - setTimeout( - () => { - this.addJavaScriptChannel(instanceId, javaScriptChannelInstanceId) - }, 500 - ) } } @@ -261,13 +258,27 @@ export class WebViewHostApiImpl extends WebViewHostApi { getInstanceManager(): InstanceManager { return this.instanceManager; } + + + onScrollChangedImpl(left: number, top: number, oldLeft: number, oldTop: number) { + this.onScrollChangedImpl(left, top, oldLeft, oldTop); + this.api?.onScrollChanged( + this, left, top, oldLeft, oldTop, {reply: () => {} }); + } + + setApi(api: WebViewFlutterApiImpl) { + this.api = api; + } } export class WebViewPlatformView extends PlatformView { + private WebCookieManager: web_webview.WebCookieManager = new web_webview.WebCookieManager(); private controller: web_webview.WebviewController = new web_webview.WebviewController(); + private tempUrl: string = ""; + private downloadListener: DownloadListener = {} as ESObject; private webChromeClient: WebChromeClient | null = null; @@ -284,8 +295,12 @@ export class WebViewPlatformView extends PlatformView { private returnValueForShouldOverrideUrlLoading: boolean = false; - private onDownloadStart = (event: ESObject) => { - if (this.downloadListener) { + private controllerAttached: boolean = false; + + private onDisposeCallback?: () => void; + + onDownloadStart = (event: ESObject) => { + if (this.downloadListener && this.downloadListener.onDownloadStart) { this.downloadListener.onDownloadStart( event.url, event.userAgent, @@ -296,125 +311,156 @@ export class WebViewPlatformView extends PlatformView { } } - private onPageBegin = (event: ESObject) => { + onPageBegin = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onPageStarted(this, event.url); } } - private onPageEnd = (event: ESObject) => { + onPageEnd = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onPageFinished(this, event.url); } } - private onErrorReceive = (event: ESObject) => { + onErrorReceive = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.onReceivedError(this, event.request, event.error); } } - private onLoadIntercept = (event: ESObject) => { - Log.i(TAG, "onLoadIntercept event = " + JSON.stringify(event)) + onOverrideUrlLoading = (request: WebResourceRequest) => { + Log.i(TAG, "onOverrideUrlLoading request = " + JSON.stringify(request)) + if(request.getRequestUrl() == 'loaded:///'){ + return true; + } if (this.webViewClint) { - // this.webViewClint.shouldOverrideUrlLoading(this, event.data); - return this.returnValueForShouldOverrideUrlLoading; + return this.webViewClint.shouldOverrideUrlLoading(this, request); } return false; } - private onRefreshAccessedHistory = (event: ESObject) => { + onRefreshAccessedHistory = (event: ESObject) => { if (this.webViewClint) { this.webViewClint.doUpdateVisitedHistory(this, event.url, event.isRefreshed); } } - private onProgressChange = (event: ESObject) => { + onProgressChange = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onProgressChanged(this, event.newProgress) } } - private onGeolocationShow = (event: ESObject) => { + onGeolocationShow = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onGeolocationPermissionsShowPrompt(event.origin, event.geolocation) } } - private onGeolocationHide = () => { + onGeolocationHide = () => { if (this.webChromeClient) { this.webChromeClient.onGeolocationPermissionsHidePrompt(); } } - private onShowFileSelector = (event: ESObject) => { + onShowFileSelector = (event: ESObject) => { if (this.webChromeClient) { return this.webChromeClient.onShowFileChooser(this, event.result, event.fileSelector) } return false; } - private onPermissionRequest = (event: ESObject) => { + onPermissionRequest = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onPermissionRequest(event.request); } } - private onWindowNew = (event: ESObject) => { + onConsoleMessage = (event: ESObject) => { + let message:ConsoleMessage = event.message; + if (message.getMessageLevel() == MessageLevel.Error || message.getMessageLevel() == MessageLevel.Warn) { + if (this.webChromeClient) { + this.webChromeClient.onConsoleMessage(event.message); + } + } else { + Log.d(TAG, "logLevel: " + message.getMessageLevel() + " "+ message.getMessage()); + } + return true; + } + + onWindowNew = (event: ESObject) => { if (this.webChromeClient) { this.webChromeClient.onCreateWindow(this, event.isAlert, event.isUserTrigger, event.handler) } } - private onWindowExit = () => { + onWindowExit = () => { if (this.dialogController) { this.dialogController.close(); } } - private onScroll = (event: ESObject) => { + onScroll = (event: ESObject) => { this.scrollX = event.xOffset; this.scrollY = event.yOffset; } - ohosWebView: DVModelJson = new DVModelJson( - "other", - [], - { - src: "", - controller: this.controller, - onDownloadStart: this.onDownloadStart, - onPageBegin: this.onPageBegin, - onPageEnd: this.onPageEnd, - onErrorReceive: this.onErrorReceive, - onLoadIntercept: this.onLoadIntercept, - onRefreshAccessedHistory: this.onRefreshAccessedHistory, - onProgressChange: this.onProgressChange, - onGeolocationShow: this.onGeolocationShow, - onGeolocationHide: this.onGeolocationHide, - onShowFileSelector: this.onShowFileSelector, - onPermissionRequest: this.onPermissionRequest, - onWindowNew: this.onWindowNew, - onWindowExit: this.onWindowExit, - onScroll: this.onScroll - }, - {}, - buildOhosWebView - ) - - private ohosWebViewModel = createDVModelFromJson(this.ohosWebView); - - getView(): DVModel { - return this.ohosWebViewModel; + onControllerAttached = () => { + Log.d(TAG, "onControllerAttached"); + this.controllerAttached = true + } + + setOnDisposeCallback(callback: () => void) { + this.onDisposeCallback = callback; + } + + onJsAlert = (event: ESObject): boolean => { + if (this.webChromeClient && event) { + return this.webChromeClient.onJsAlert(this, event.url, event.message, event.result); + } + return true; + } + + onJsConfirm = (event: ESObject): boolean => { + if (this.webChromeClient && event) { + return this.webChromeClient.onJsConfirm(this, event.url, event.message, event.result); + } + return true; + } + + onJsPrompt = (event: ESObject): boolean => { + if (this.webChromeClient && event) { + return this.webChromeClient.onJsPrompt(this, event.url, event.message, event.value, event.result); + } + return true; + } + + getType(): string { + return 'web'; + } + + getView(): WrappedBuilder<[Params]> { + return new WrappedBuilder(WebBuilder); } dispose(): void { + this.controller.stopAllMedia(); + this.onDisposeCallback && this.onDisposeCallback(); } getController(): web_webview.WebviewController { return this.controller; } + setUrl(url: string): void { + this.tempUrl = url; + } + + getUrl(): string { + return this.tempUrl; + } + getWebCookieManager(): web_webview.WebCookieManager { return this.WebCookieManager } @@ -443,7 +489,7 @@ export class WebViewPlatformView extends PlatformView { if (this.webSettings == null) { this.webSettings = new WebSettingsImpl(this); } - return this.webSettings; + return this.webSettings!; } getScrollX(): number { @@ -457,6 +503,28 @@ export class WebViewPlatformView extends PlatformView { setReturnValueForShouldOverrideUrlLoading(value: boolean) { this.returnValueForShouldOverrideUrlLoading = value; } + + async waitControllerAttached() { + if (!this.controllerAttached) { + await this.checkControllerAttached() + } + } + + checkControllerAttached(): Promise { + return new Promise((resolve, reject) => { + try { + let intervalId = setInterval(() => { + if (this.controllerAttached) { + clearInterval(intervalId) + resolve() + } + }, 20) + } catch (err) { + reject() + } + }) + } + } export class WebViewProxy { @@ -471,53 +539,102 @@ export class WebViewProxy { class WebSettingsImpl implements WebSettings { private webView: WebViewPlatformView; - private params: DVModelParameters; + params: DVModelParameters = new DVModelParameters; + domStorageAccess: boolean = false; + allowWindowOpenMethod : boolean = false; + multiWindowAccess : boolean = false; + backgroundColor : string = ""; + javaScriptAccess : boolean = false; + mediaPlayGestureAccess : boolean = false; + zoomAccess : boolean = true; + overviewModeAccess : boolean = false; + wideViewModeAccess: boolean = false; + fileAccess : boolean = true; + textZoomRatio : number = 0; + textZoomRatioCallback?: (ratio: number) => void; constructor(webView: WebViewPlatformView) { this.webView = webView; - this.params = webView.getView().params; + //this.params = webView.getView().params; } setDomStorageEnabled(flag: boolean) { - DynamicUtils.setParams(this.params, "domStorageAccess", flag); + this.domStorageAccess = flag; + } + + getDomStorageEnabled() : boolean{ + return this.domStorageAccess; } setJavaScriptCanOpenWindowsAutomatically(flag: boolean) { - DynamicUtils.setParams(this.params, "allowWindowOpenMethod", flag); + this.allowWindowOpenMethod = flag; + } + + getJavaScriptCanOpenWindowsAutomatically() : boolean{ + return this.allowWindowOpenMethod; } setSupportMultipleWindows(support: boolean) { - DynamicUtils.setParams(this.params, "multiWindowAccess", support); + this.multiWindowAccess = support; + } + + getSupportMultipleWindows() : boolean{ + return this.multiWindowAccess; } setBackgroundColor(color: number) { // number 无法实现透明度,所以转成 string let colorStr = `#${color.toString(16).padStart(8, '0')}`; - DynamicUtils.setParams(this.params, "backgroundColor", colorStr); + this.backgroundColor = colorStr; + } + + getBackgroundColor() : string{ + return this.backgroundColor; } setJavaScriptEnabled(flag: boolean) { - DynamicUtils.setParams(this.params, "javaScriptAccess", flag); + this.javaScriptAccess = flag; } - setUserAgentString(userAgentString: string) { + getJavaScriptEnabled() : boolean { + return this.javaScriptAccess; + } + + async setUserAgentString(userAgentString: string) { + await this.webView.waitControllerAttached(); this.webView.getController().setCustomUserAgent(userAgentString); } setMediaPlaybackRequiresUserGesture(require: boolean) { - DynamicUtils.setParams(this.params, "mediaPlayGestureAccess", require); + this.mediaPlayGestureAccess = require; + } + + getMediaPlaybackRequiresUserGesture() : boolean{ + return this.mediaPlayGestureAccess; } setSupportZoom(support: boolean) { - DynamicUtils.setParams(this.params, "zoomAccess", support); + this.zoomAccess = support; + } + + getSupportZoom() : boolean{ + return this.zoomAccess; } setLoadWithOverviewMode(overview: boolean) { - DynamicUtils.setParams(this.params, "overviewModeAccess", overview); + this.overviewModeAccess = overview; + } + + getLoadWithOverviewMode() : boolean { + return this.overviewModeAccess; } setUseWideViewPort(use: boolean) { - DynamicUtils.setParams(this.params, "wideViewModeAccess", use); + this.wideViewModeAccess = use; + } + + getUseWideViewPort() : boolean { + return this.wideViewModeAccess; } setDisplayZoomControls(enabled: boolean) { @@ -529,10 +646,29 @@ class WebSettingsImpl implements WebSettings { } setAllowFileAccess(enabled: boolean) { - DynamicUtils.setParams(this.params, "fileAccess", enabled); + this.fileAccess = enabled; + } + + getAllowFileAccess() : boolean { + return this.fileAccess; } setTextZoom(textZoom: number) { - DynamicUtils.setParams(this.params, "textZoomRatio", textZoom); + this.textZoomRatio = textZoom; + this.textZoomRatioCallback && this.textZoomRatioCallback(textZoom); + } + + async getUserAgentString(): Promise { + await this.webView.waitControllerAttached(); + return this.webView.getController().getCustomUserAgent(); + } + + getTextZoom() : number{ + return this.textZoomRatio; + } + + onTextZoomChanged(callback: (ratio: number) => void): void { + this.textZoomRatioCallback = callback; } + } \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_ohos/pubspec.yaml b/packages/webview_flutter/webview_flutter_ohos/pubspec.yaml index a7070b2835d1c68428de928ec1c2469683a4b396..ab08f03c4eeedc516f0353fd344cba5d1735061d 100644 --- a/packages/webview_flutter/webview_flutter_ohos/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_ohos/pubspec.yaml @@ -15,7 +15,7 @@ name: webview_flutter_ohos description: A Flutter plugin that provides a WebView widget on Ohos. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.9.3 +version: 3.15.0 environment: sdk: ">=2.19.0 <4.0.0" @@ -33,7 +33,10 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_platform_interface: ^2.4.0 + webview_flutter_platform_interface: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_platform_interface dev_dependencies: build_runner: ^2.1.4 diff --git a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md index 34fb7f60e77f2ca7e893e93f68dd2010f125c242..4c41f54060f8abb0f2b43c02037bbfa38fbe5a91 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md @@ -1,3 +1,21 @@ +## 2.9.0 + +* Adds support to show JavaScript dialog. See `PlatformWebViewController.setOnJavaScriptAlertDialog`, `PlatformWebViewController.setOnJavaScriptConfirmDialog` and `PlatformWebViewController.setOnJavaScriptTextInputDialog`. + +## 2.8.0 + +* Adds support to track scroll position changes. See `PlatformWebViewController.setOnScrollPositionChange`. + +## 2.7.0 + +* Adds support for handling HTTP basic authentication requests. See `PlatformNavigationDelegate.setOnHttpAuthRequest`. +* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. + +## 2.6.0 + +* Adds support to register a callback to intercept messages that are written to + the JavaScript console. See `PlatformWebViewController.setOnConsoleMessage`. + ## 2.5.1 * Adds pub topics to package metadata. diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index dc3fefbb51356066f8621ba5649f64e2bd578f58..38cf7c19a2d5c982aa267210cd43f00a1cd45440 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -30,6 +30,10 @@ typedef WebResourceErrorCallback = void Function(WebResourceError error); /// url of the web view. typedef UrlChangeCallback = void Function(UrlChange change); +/// Signature for callbacks that notify the host application of an +/// authentication request. +typedef HttpAuthRequestCallback = void Function(HttpAuthRequest request); + /// An interface defining navigation events that occur on the native platform. /// /// The [PlatformWebViewController] is notifying this delegate on events that @@ -132,4 +136,11 @@ abstract class PlatformNavigationDelegate extends PlatformInterface { 'setOnUrlChange is not implemented on the current platform.', ); } + + /// Invoked when the web view is requesting authentication. + Future setOnHttpAuthRequest(HttpAuthRequestCallback onHttpAuthRequest) { + throw UnimplementedError( + 'setOnHttpAuthRequest is not implemented on the current platform.', + ); + } } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart index a2ae88771f9e2e183ead701a9a391569f2be823c..2aaabb519ccc2eb55a96e990245131d99d68e0fd 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart @@ -17,7 +17,7 @@ import 'webview_platform.dart' show WebViewPlatform; /// changes. Extending this class (using `extends`) ensures that the subclass /// will get the default implementation, while platform implementations that /// `implements` this interface will be broken by newly added -/// [PlatformWebViewCookieManager] methods. +/// [PlatformWebViewController] methods. abstract class PlatformWebViewController extends PlatformInterface { /// Creates a new [PlatformWebViewController] factory PlatformWebViewController( @@ -267,7 +267,7 @@ abstract class PlatformWebViewController extends PlatformInterface { void Function(PlatformWebViewPermissionRequest request) onPermissionRequest, ) { throw UnimplementedError( - 'setOnPermissionRequest is not implemented on the current platform', + 'setOnPlatformPermissionRequest is not implemented on the current platform', ); } @@ -277,6 +277,53 @@ abstract class PlatformWebViewController extends PlatformInterface { 'getUserAgent is not implemented on the current platform', ); } + + /// Sets a callback that notifies the host application of any console messages + /// written to the JavaScript console. + Future setOnConsoleMessage( + void Function(JavaScriptConsoleMessage consoleMessage) onConsoleMessage) { + throw UnimplementedError( + 'setOnConsoleMessage is not implemented on the current platform', + ); + } + + /// Sets the listener for content offset changes. + Future setOnScrollPositionChange( + void Function(ScrollPositionChange scrollPositionChange)? + onScrollPositionChange) { + throw UnimplementedError( + 'setOnScrollPositionChange is not implemented on the current platform'); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript alert() dialog. + Future setOnJavaScriptAlertDialog( + Future Function(JavaScriptAlertDialogRequest request) + onJavaScriptAlertDialog) async { + throw UnimplementedError( + 'setOnJavaScriptAlertDialog is not implemented on the current platform', + ); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript confirm() dialog. + Future setOnJavaScriptConfirmDialog( + Future Function(JavaScriptConfirmDialogRequest request) + onJavaScriptConfirmDialog) async { + throw UnimplementedError( + 'setOnJavaScriptConfirmDialog is not implemented on the current platform', + ); + } + + /// Sets a callback that notifies the host application that the web page + /// wants to display a JavaScript prompt() dialog. + Future setOnJavaScriptTextInputDialog( + Future Function(JavaScriptTextInputDialogRequest request) + onJavaScriptTextInputDialog) async { + throw UnimplementedError( + 'setOnJavaScriptTextInputDialog is not implemented on the current platform', + ); + } } /// Describes the parameters necessary for registering a JavaScript channel. diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_auth_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_auth_request.dart new file mode 100644 index 0000000000000000000000000000000000000000..a4a2f1fdd592761d28c51f739c2f54c02819b41b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_auth_request.dart @@ -0,0 +1,68 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; +import 'webview_credential.dart'; + +/// Defines the parameters of a pending HTTP authentication request received by +/// the webview through a [HttpAuthRequestCallback]. +/// +/// Platform specific implementations can add additional fields by extending +/// this class and providing a factory method that takes the [HttpAuthRequest] +/// as a parameter. +/// +/// This example demonstrates how to extend the [HttpAuthRequest] to provide +/// additional platform specific parameters. +/// +/// When extending [HttpAuthRequest], additional parameters should always accept +/// `null` or have a default value to prevent breaking changes. +/// +/// ```dart +/// @immutable +/// class WKWebViewHttpAuthRequest extends HttpAuthRequest { +/// WKWebViewHttpAuthRequest._( +/// HttpAuthRequest authRequest, +/// this.extraData, +/// ) : super( +/// onProceed: authRequest.onProceed, +/// onCancel: authRequest.onCancel, +/// host: authRequest.host, +/// realm: authRequest.realm, +/// ); +/// +/// factory WKWebViewHttpAuthRequest.fromHttpAuthRequest( +/// HttpAuthRequest authRequest, { +/// String? extraData, +/// }) { +/// return WKWebViewHttpAuthRequest._( +/// authRequest, +/// extraData: extraData, +/// ); +/// } +/// +/// final String? extraData; +/// } +/// ``` +@immutable +class HttpAuthRequest { + /// Creates a [HttpAuthRequest]. + const HttpAuthRequest({ + required this.onProceed, + required this.onCancel, + required this.host, + this.realm, + }); + + /// The callback to authenticate. + final void Function(WebViewCredential credential) onProceed; + + /// The callback to cancel authentication. + final void Function() onCancel; + + /// The host requiring authentication. + final String host; + + /// The realm requiring authentication. + final String? realm; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_response_error.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_response_error.dart index e51b8cf7e2c57558a4cc53e5ad0168e7f3c6ffa1..beca1f680dffe25ea5f8fcf980d5dd7c191eed22 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_response_error.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_response_error.dart @@ -4,6 +4,9 @@ import 'package:flutter/foundation.dart'; +import 'web_resource_request.dart'; +import 'web_resource_response.dart'; + /// Error returned in `PlatformNavigationDelegate.setOnHttpError` when an HTTP /// response error has been received. /// @@ -37,9 +40,13 @@ import 'package:flutter/foundation.dart'; class HttpResponseError { /// Used by the platform implementation to create a new [HttpResponseError]. const HttpResponseError({ - required this.statusCode, + this.request, + this.response, }); - /// The HTTP status code. - final int statusCode; + /// The associated request. + final WebResourceRequest? request; + + /// The associated response. + final WebResourceResponse? response; } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_console_message.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_console_message.dart new file mode 100644 index 0000000000000000000000000000000000000000..3509e685f4f658d44012c8cf5e3e946ae0f46144 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_console_message.dart @@ -0,0 +1,23 @@ +// Copyright 2013 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. + +import 'package:meta/meta.dart'; + +import 'javascript_log_level.dart'; + +/// Represents a console message written to the JavaScript console. +@immutable +class JavaScriptConsoleMessage { + /// Creates a [JavaScriptConsoleMessage]. + const JavaScriptConsoleMessage({ + required this.level, + required this.message, + }); + + /// The severity of a JavaScript log message. + final JavaScriptLogLevel level; + + /// The message written to the console. + final String message; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_dialog_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_dialog_request.dart new file mode 100644 index 0000000000000000000000000000000000000000..db367bd7e62a5139328b2a09cca79723ef5005e0 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_dialog_request.dart @@ -0,0 +1,57 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; + +/// Defines the parameters that support `PlatformWebViewController.setOnJavaScriptAlertDialog`. +@immutable +class JavaScriptAlertDialogRequest { + /// Creates a [JavaScriptAlertDialogRequest]. + const JavaScriptAlertDialogRequest({ + required this.message, + required this.url, + }); + + /// The message to be displayed in the window. + final String message; + + /// The URL of the page requesting the dialog. + final String url; +} + +/// Defines the parameters that support `PlatformWebViewController.setOnJavaScriptConfirmDialog`. +@immutable +class JavaScriptConfirmDialogRequest { + /// Creates a [JavaScriptConfirmDialogRequest]. + const JavaScriptConfirmDialogRequest({ + required this.message, + required this.url, + }); + + /// The message to be displayed in the window. + final String message; + + /// The URL of the page requesting the dialog. + final String url; +} + +/// Defines the parameters that support `PlatformWebViewController.setOnJavaScriptTextInputDialog`. +@immutable +class JavaScriptTextInputDialogRequest { + /// Creates a [JavaScriptAlertDialogRequest]. + const JavaScriptTextInputDialogRequest({ + required this.message, + required this.url, + required this.defaultText, + }); + + /// The message to be displayed in the window. + final String message; + + /// The URL of the page requesting the dialog. + final String url; + + /// The initial text to display in the text entry field. + final String? defaultText; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_log_level.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_log_level.dart new file mode 100644 index 0000000000000000000000000000000000000000..b7319c9082f0636913836691689dd842bc10a4e3 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_log_level.dart @@ -0,0 +1,24 @@ +// Copyright 2013 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. + +/// Represents the severity of a JavaScript log message. +enum JavaScriptLogLevel { + /// Indicates an error message was logged via an "error" event of the + /// `console.error` method. + error, + + /// Indicates a warning message was logged using the `console.warning` + /// method. + warning, + + /// Indicates a debug message was logged using the `console.debug` method. + debug, + + /// Indicates an informational message was logged using the `console.info` + /// method. + info, + + /// Indicates a log message was logged using the `console.log` method. + log, +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/scroll_position_change.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/scroll_position_change.dart new file mode 100644 index 0000000000000000000000000000000000000000..dab68d49188992565c0ce51e6729adbbd670102b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/scroll_position_change.dart @@ -0,0 +1,17 @@ +// Copyright 2013 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. + +/// Defines the parameters of the scroll position change callback. +class ScrollPositionChange { + /// Creates a [ScrollPositionChange]. + const ScrollPositionChange(this.x, this.y); + + /// The value of the horizontal offset with the origin being at the leftmost + /// of the `WebView`. + final double x; + + /// The value of the vertical offset with the origin being at the topmost of + /// the `WebView`. + final double y; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart index e980aece3afa7990b5cec153bbd80d16bcae6481..ec6c0bc2c471d4f3d5af3f62f6fdb6eab0c29f9d 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart @@ -2,7 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +export 'http_auth_request.dart'; export 'http_response_error.dart'; +export 'javascript_console_message.dart'; +export 'javascript_dialog_request.dart'; +export 'javascript_log_level.dart'; export 'javascript_message.dart'; export 'javascript_mode.dart'; export 'load_request_params.dart'; @@ -13,6 +17,10 @@ export 'platform_webview_controller_creation_params.dart'; export 'platform_webview_cookie_manager_creation_params.dart'; export 'platform_webview_permission_request.dart'; export 'platform_webview_widget_creation_params.dart'; +export 'scroll_position_change.dart'; export 'url_change.dart'; export 'web_resource_error.dart'; +export 'web_resource_request.dart'; +export 'web_resource_response.dart'; export 'webview_cookie.dart'; +export 'webview_credential.dart'; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_request.dart new file mode 100644 index 0000000000000000000000000000000000000000..18ba83badbe142a91e1ef215edc874b0096729df --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_request.dart @@ -0,0 +1,43 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; + +/// Defines the parameters of the web resource request from the associated request. +/// +/// Platform specific implementations can add additional fields by extending +/// this class. +/// +/// This example demonstrates how to extend the [WebResourceRequest] to +/// provide additional platform specific parameters. +/// +/// When extending [WebResourceRequest] additional parameters should always +/// accept `null` or have a default value to prevent breaking changes. +/// +/// ```dart +/// class AndroidWebResourceRequest extends WebResourceRequest { +/// WebResourceRequest._({ +/// required WebResourceRequest request, +/// }) : super( +/// uri: request.uri, +/// ); +/// +/// factory AndroidWebResourceRequest.fromWebResourceRequest( +/// WebResourceRequest request, { +/// Map headers, +/// }) { +/// return AndroidWebResourceRequest._(request, headers: headers); +/// } +/// +/// final Map headers; +/// } +/// ``` +@immutable +class WebResourceRequest { + /// Used by the platform implementation to create a new [WebResourceRequest]. + const WebResourceRequest({required this.uri}); + + /// URI for the request. + final Uri uri; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_response.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_response.dart new file mode 100644 index 0000000000000000000000000000000000000000..f4269ee6a5b5446262c7b602a5e1b7296ecbd397 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_response.dart @@ -0,0 +1,55 @@ +// Copyright 2013 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. + +import 'package:flutter/foundation.dart'; + +/// Contains information about the response for a request. +/// +/// Platform specific implementations can add additional fields by extending +/// this class. +/// +/// This example demonstrates how to extend the [WebResourceResponse] to +/// provide additional platform specific parameters. +/// +/// When extending [WebResourceResponse] additional parameters should always +/// accept `null` or have a default value to prevent breaking changes. +/// +/// ```dart +/// class AndroidWebResourceResponse extends WebResourceResponse { +/// WebResourceResponse._({ +/// required WebResourceResponse response, +/// }) : super( +/// uri: response.uri, +/// statusCode: response.statusCode, +/// headers: response.headers, +/// ); +/// +/// factory AndroidWebResourceResponse.fromWebResourceResponse( +/// WebResourceResponse response, { +/// Uri? historyUrl, +/// }) { +/// return AndroidWebResourceResponse._(response, historyUrl: historyUrl); +/// } +/// +/// final Uri? historyUrl; +/// } +/// ``` +@immutable +class WebResourceResponse { + /// Used by the platform implementation to create a new [WebResourceResponse]. + const WebResourceResponse({ + required this.uri, + required this.statusCode, + this.headers = const {}, + }); + + /// The URI that this response is associated with. + final Uri? uri; + + /// The HTTP status code. + final int statusCode; + + /// Headers for the request. + final Map headers; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/webview_credential.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/webview_credential.dart new file mode 100644 index 0000000000000000000000000000000000000000..8c109e94847a5e213a2bcec379520308b58a69c1 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/webview_credential.dart @@ -0,0 +1,24 @@ +// Copyright 2013 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. + +import 'package:meta/meta.dart'; + +import '../types/http_auth_request.dart'; + +/// Defines the response parameters of a pending [HttpAuthRequest] received by +/// the webview. +@immutable +class WebViewCredential { + /// Creates a [WebViewCredential]. + const WebViewCredential({ + required this.user, + required this.password, + }); + + /// The user name. + final String user; + + /// The password. + final String password; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index afdd78d31fc0e6f0f728b9df4a98bf7a032c0326..e769f33233d4e8b936b15e1f56e8fd56f987d39f 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.5.1 +version: 2.10.0 environment: sdk: ">=2.19.0 <4.0.0" @@ -20,7 +20,7 @@ dev_dependencies: build_runner: ^2.1.8 flutter_test: sdk: flutter - mockito: 5.4.1 + mockito: 5.4.4 topics: - html diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart index ac9f065e2be2d5a1865e4555167133e4b5ecb632..2d6d40e70a1de2f5e435545eb9c683f30561340d 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart @@ -142,6 +142,19 @@ void main() { throwsUnimplementedError, ); }); + + test( + 'Default implementation of setOnHttpAuthRequest should throw unimplemented error', + () { + final PlatformNavigationDelegate callbackDelegate = + ExtendsPlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams()); + + expect( + () => callbackDelegate.setOnHttpAuthRequest((HttpAuthRequest request) {}), + throwsUnimplementedError, + ); + }); } class MockWebViewPlatformWithMixin extends MockWebViewPlatform diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart index 64725a7fa1a68691c00dc23ef813f8a57c3a8372..db3cf1dd5d6f276e3703c2916ca1b3d987f69eb7 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart @@ -400,6 +400,63 @@ void main() { throwsUnimplementedError, ); }); + + test( + 'Default implementation of setOnConsoleMessage should throw unimplemented error', + () { + final PlatformWebViewController controller = + ExtendsPlatformWebViewController( + const PlatformWebViewControllerCreationParams()); + + expect( + () => + controller.setOnConsoleMessage((JavaScriptConsoleMessage message) {}), + throwsUnimplementedError, + ); + }); + + test( + 'Default implementation of setOnJavaScriptAlertDialog should throw unimplemented error', + () { + final PlatformWebViewController controller = + ExtendsPlatformWebViewController( + const PlatformWebViewControllerCreationParams()); + + expect( + () => controller.setOnJavaScriptAlertDialog((_) async {}), + throwsUnimplementedError, + ); + }); + + test( + 'Default implementation of setOnJavaScriptConfirmDialog should throw unimplemented error', + () { + final PlatformWebViewController controller = + ExtendsPlatformWebViewController( + const PlatformWebViewControllerCreationParams()); + + expect( + () => controller.setOnJavaScriptConfirmDialog((_) async { + return false; + }), + throwsUnimplementedError, + ); + }); + + test( + 'Default implementation of setOnJavaScriptTextInputDialog should throw unimplemented error', + () { + final PlatformWebViewController controller = + ExtendsPlatformWebViewController( + const PlatformWebViewControllerCreationParams()); + + expect( + () => controller.setOnJavaScriptTextInputDialog((_) async { + return ''; + }), + throwsUnimplementedError, + ); + }); } class MockWebViewPlatformWithMixin extends MockWebViewPlatform diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart index 1268858978c8fd08bb9e7eba5d684fd3f6676879..e6839d00a31e297df2218497c7a444ff98935c70 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_platform_interface/test/platform_webview_controller_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -50,6 +52,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock Invocation.getter(#params), ), ) as _i2.PlatformNavigationDelegateCreationParams); + @override _i4.Future setOnNavigationRequest( _i3.NavigationRequestCallback? onNavigationRequest) => @@ -61,6 +64,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( @@ -71,6 +75,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( @@ -81,6 +86,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( @@ -91,6 +97,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( @@ -101,6 +108,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnWebResourceError( _i3.WebResourceErrorCallback? onWebResourceError) => @@ -112,6 +120,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( @@ -122,4 +131,16 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + + @override + _i4.Future setOnHttpAuthRequest( + _i3.HttpAuthRequestCallback? onHttpAuthRequest) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/types_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/types_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b364500d6fbb710dc3ea91730db773fff8af2451 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/types_test.dart @@ -0,0 +1,32 @@ +// Copyright 2013 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. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:webview_flutter_platform_interface/src/types/types.dart'; + +void main() { + group('types', () { + test('WebResourceRequest', () { + final Uri uri = Uri.parse('https://www.google.com'); + final WebResourceRequest request = WebResourceRequest(uri: uri); + expect(request.uri, uri); + }); + + test('WebResourceResponse', () { + final Uri uri = Uri.parse('https://www.google.com'); + const int statusCode = 404; + const Map headers = {'a': 'header'}; + + final WebResourceResponse response = WebResourceResponse( + uri: uri, + statusCode: statusCode, + headers: headers, + ); + + expect(response.uri, uri); + expect(response.statusCode, statusCode); + expect(response.headers, headers); + }); + }); +} diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_flutter_platform_interface_test.dart similarity index 51% rename from packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart rename to packages/webview_flutter/webview_flutter_platform_interface/test/webview_flutter_platform_interface_test.dart index eb92ab7ca2317deeb2da1acd4f376af37db5f754..f8c6ee9ce657d13fab6fad95d05fce98db15e6a5 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_flutter_platform_interface_test.dart @@ -2,51 +2,39 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: unnecessary_statements + import 'package:flutter_test/flutter_test.dart'; -import 'package:webview_flutter/webview_flutter.dart' as main_file; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' + as main_file; void main() { - group('webview_flutter', () { - test('ensure webview_flutter.dart exports classes from platform interface', - () { - // ignore: unnecessary_statements + test( + 'ensures webview_flutter_platform_interface.dart exports classes in types directory', + () { + main_file.JavaScriptConsoleMessage; + main_file.JavaScriptLogLevel; main_file.JavaScriptMessage; - // ignore: unnecessary_statements main_file.JavaScriptMode; - // ignore: unnecessary_statements main_file.LoadRequestMethod; - // ignore: unnecessary_statements main_file.NavigationDecision; - // ignore: unnecessary_statements main_file.NavigationRequest; - // ignore: unnecessary_statements main_file.NavigationRequestCallback; - // ignore: unnecessary_statements main_file.PageEventCallback; - // ignore: unnecessary_statements main_file.PlatformNavigationDelegateCreationParams; - // ignore: unnecessary_statements main_file.PlatformWebViewControllerCreationParams; - // ignore: unnecessary_statements main_file.PlatformWebViewCookieManagerCreationParams; - // ignore: unnecessary_statements main_file.PlatformWebViewPermissionRequest; - // ignore: unnecessary_statements main_file.PlatformWebViewWidgetCreationParams; - // ignore: unnecessary_statements main_file.ProgressCallback; - // ignore: unnecessary_statements main_file.WebViewPermissionResourceType; - // ignore: unnecessary_statements + main_file.WebResourceRequest; + main_file.WebResourceResponse; main_file.WebResourceError; - // ignore: unnecessary_statements main_file.WebResourceErrorCallback; - // ignore: unnecessary_statements main_file.WebViewCookie; - // ignore: unnecessary_statements main_file.WebResourceErrorType; - // ignore: unnecessary_statements main_file.UrlChange; - }); - }); + }, + ); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.mocks.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.mocks.dart index e9ff0bd9f282a0c45345c9004441d9494fb56aa3..9ae24623c0c1c2984187de624ba9fc57af56cde9 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_platform_interface/test/webview_platform_test.dart. // Do not manually edit this file. @@ -20,6 +20,8 @@ import 'package:webview_flutter_platform_interface/src/webview_platform.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -95,6 +97,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i6.WebViewPlatform { ), ), ) as _i2.PlatformWebViewCookieManager); + @override _i3.PlatformNavigationDelegate createPlatformNavigationDelegate( _i7.PlatformNavigationDelegateCreationParams? params) => @@ -111,6 +114,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i6.WebViewPlatform { ), ), ) as _i3.PlatformNavigationDelegate); + @override _i4.PlatformWebViewController createPlatformWebViewController( _i7.PlatformWebViewControllerCreationParams? params) => @@ -127,6 +131,7 @@ class MockWebViewPlatform extends _i1.Mock implements _i6.WebViewPlatform { ), ), ) as _i4.PlatformWebViewController); + @override _i5.PlatformWebViewWidget createPlatformWebViewWidget( _i7.PlatformWebViewWidgetCreationParams? params) => diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index 384b16b065367c942ce59b073aeab06385863228..72a5109a9191b9f474cefd950f3edea8be024239 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,55 @@ +## 3.12.0 + +* Adds support for `setOnScrollPositionChange` method to the `WebKitWebViewController`. + +## 3.11.0 + +* Adds support to show JavaScript dialog. See `PlatformWebViewController.setOnJavaScriptAlertDialog`, `PlatformWebViewController.setOnJavaScriptConfirmDialog` and `PlatformWebViewController.setOnJavaScriptTextInputDialog`. + +## 3.10.3 + +* Adds a check that throws an `ArgumentError` when `WebKitWebViewController.addJavaScriptChannel` + receives a `JavaScriptChannelParams` with a name that is not unique. + + +## 3.10.2 + +* Adds privacy manifest. + +## 3.10.1 + +* Fixes new lint warnings. + +## 3.10.0 + +* Adds support for `PlatformNavigationDelegate.setOnHttpAuthRequest`. + + +## 3.9.4 + +* Updates to Pigeon 13. + +## 3.9.3 + +* Fixes `use_build_context_synchronously` lint violations in the example app. + +## 3.9.2 + +* Fixes error caused by calling `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` on + versions below 14. + +## 3.9.1 + +* Fixes bug where `WebkitWebViewController.getUserAgent` was incorrectly returning an empty String. + +## 3.9.0 + +* Adds support for `PlatformWebViewController.getUserAgent`. + +## 3.8.0 + +* Adds support to register a callback to receive JavaScript console messages. See `WebKitWebViewController.setOnConsoleMessage`. + ## 3.7.4 * Adds pub topics to package metadata. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart index 96260842048964a88582df8ae40c249a5c11085c..d2d3ea8f6b2e9394e71c027de0b63c583208ec14 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart @@ -170,11 +170,9 @@ Future main() async { 'test_header': 'flutter_test_header' }; await controller.loadUrl(headersUrl, headers: headers); - final String? currentUrl = await controller.currentUrl(); - expect(currentUrl, headersUrl); - await pageStarts.stream.firstWhere((String url) => url == currentUrl); - await pageLoads.stream.firstWhere((String url) => url == currentUrl); + await pageStarts.stream.firstWhere((String url) => url == headersUrl); + await pageLoads.stream.firstWhere((String url) => url == headersUrl); final String content = await controller .runJavascriptReturningResult('document.documentElement.innerText'); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart index 66567accda36420786681217b74d9de06f86eb0b..91d9075cd471905fbf8488691ae0d166c09f3c11 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart @@ -34,6 +34,15 @@ Future main() async { request.response.writeln('${request.headers}'); } else if (request.uri.path == '/favicon.ico') { request.response.statusCode = HttpStatus.notFound; + } else if (request.uri.path == '/http-basic-authentication') { + final bool isAuthenticating = request.headers['Authorization'] != null; + if (isAuthenticating) { + request.response.writeln('Authorized'); + } else { + request.response.headers + .add('WWW-Authenticate', 'Basic realm="Test realm"'); + request.response.statusCode = HttpStatus.unauthorized; + } } else { fail('unexpected request: ${request.method} ${request.uri}'); } @@ -43,6 +52,7 @@ Future main() async { final String primaryUrl = '$prefixUrl/hello.txt'; final String secondaryUrl = '$prefixUrl/secondary.txt'; final String headersUrl = '$prefixUrl/headers'; + final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets( 'withWeakReferenceTo allows encapsulating class to be garbage collected', @@ -292,8 +302,28 @@ Future main() async { }, )); - final String customUserAgent2 = await _getUserAgent(controller); - expect(customUserAgent2, 'Custom_User_Agent1'); + final String? customUserAgent = await controller.getUserAgent(); + expect(customUserAgent, 'Custom_User_Agent1'); + }); + + testWidgets( + 'getUserAgent returns a default value when custom value is not set', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + final String? userAgent = await controller.getUserAgent(); + expect(userAgent, isNotNull); + expect(userAgent, isNotEmpty); }); group('Video playback policy', () { @@ -678,7 +708,8 @@ Future main() async { }); group('Programmatic Scroll', () { - testWidgets('setAndGetScrollPosition', (WidgetTester tester) async { + testWidgets('setAndGetAndListenScrollPosition', + (WidgetTester tester) async { const String scrollTestPage = ''' @@ -704,6 +735,7 @@ Future main() async { base64Encode(const Utf8Encoder().convert(scrollTestPage)); final Completer pageLoaded = Completer(); + ScrollPositionChange? recordedPosition; final PlatformWebViewController controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); @@ -713,6 +745,10 @@ Future main() async { ); unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); unawaited(controller.setPlatformNavigationDelegate(delegate)); + unawaited(controller.setOnScrollPositionChange( + (ScrollPositionChange scrollPositionChange) { + recordedPosition = scrollPositionChange; + })); await controller.loadRequest( LoadRequestParams( @@ -744,17 +780,23 @@ Future main() async { // time to settle. expect(scrollPos.dx, isNot(X_SCROLL)); expect(scrollPos.dy, isNot(Y_SCROLL)); + expect(recordedPosition?.x, isNot(X_SCROLL)); + expect(recordedPosition?.y, isNot(Y_SCROLL)); await controller.scrollTo(X_SCROLL, Y_SCROLL); scrollPos = await controller.getScrollPosition(); expect(scrollPos.dx, X_SCROLL); expect(scrollPos.dy, Y_SCROLL); + expect(recordedPosition?.x, X_SCROLL); + expect(recordedPosition?.y, Y_SCROLL); // Check scrollBy() (on top of scrollTo()) await controller.scrollBy(X_SCROLL, Y_SCROLL); scrollPos = await controller.getScrollPosition(); expect(scrollPos.dx, X_SCROLL * 2); expect(scrollPos.dy, Y_SCROLL * 2); + expect(recordedPosition?.x, X_SCROLL * 2); + expect(recordedPosition?.y, Y_SCROLL * 2); }); }); @@ -1107,6 +1149,82 @@ Future main() async { }); }); + testWidgets('can receive HTTP basic auth requests', + (WidgetTester tester) async { + final Completer authRequested = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => authRequested.complete()); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we don't get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + WebKitWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(authRequested.future, completes); + }); + + testWidgets('can reply to HTTP basic auth requests', + (WidgetTester tester) async { + final Completer pageFinished = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnPageFinished((_) => pageFinished.complete()); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => request.onProceed( + const WebViewCredential(user: 'user', password: 'password'), + ), + ); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we don't get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + WebKitWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(pageFinished.future, completes); + }); + testWidgets('launches with gestureNavigationEnabled on iOS', (WidgetTester tester) async { final WebKitWebViewController controller = WebKitWebViewController( @@ -1196,12 +1314,140 @@ Future main() async { await expectLater(controller.currentUrl(), completion(primaryUrl)); }, ); -} -/// Returns the value used for the HTTP User-Agent: request header in subsequent HTTP requests. -Future _getUserAgent(PlatformWebViewController controller) async { - return await controller.runJavaScriptReturningResult('navigator.userAgent;') - as String; + testWidgets('can receive JavaScript alert dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final Completer alertMessage = Completer(); + unawaited(controller.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + alertMessage.complete(request.message); + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await controller.runJavaScript('alert("alert message")'); + await expectLater(alertMessage.future, completion('alert message')); + }); + + testWidgets('can receive JavaScript confirm dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final Completer confirmMessage = Completer(); + unawaited(controller.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + confirmMessage.complete(request.message); + return true; + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await controller.runJavaScript('confirm("confirm message")'); + await expectLater(confirmMessage.future, completion('confirm message')); + }); + + testWidgets('can receive JavaScript prompt dialogs', + (WidgetTester tester) async { + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + unawaited(controller.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + return 'return message'; + }, + )); + + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited( + controller.loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + final Object promptResponse = await controller.runJavaScriptReturningResult( + 'prompt("input message", "default text")', + ); + expect(promptResponse, 'return message'); + }); + + group('Logging', () { + testWidgets('can receive console log messages', + (WidgetTester tester) async { + const String testPage = ''' + + + + WebResourceError test + + +

Test page

+ + + '''; + + final Completer debugMessageReceived = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + + await controller + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + debugMessageReceived + .complete('${consoleMessage.level.name}:${consoleMessage.message}'); + }); + + await controller.loadHtmlString(testPage); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await expectLater( + debugMessageReceived.future, completion('debug:Debug message')); + }); + }); } class ResizableWebView extends StatefulWidget { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 32c0bf9872cdd09c5c77d0e5fe37811b1c4ee39f..513d2feb9f2d3b522d61fba9eda1db02f838eed4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -283,6 +283,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 2EB228BFD0F451B933E4C2C5 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -386,6 +387,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 2EB228BFD0F451B933E4C2C5 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/webview_flutter_wkwebview/webview_flutter_wkwebview_privacy.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/webview_flutter_wkwebview_privacy.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m index 1a64148b48681941665ae78f9de66fa0c7e118eb..7613bf02f75c8e3fc8ae4f0787c1bc41f58e65c9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m @@ -49,7 +49,7 @@ makeWithSource:@"mySource" injectionTime:[FWFWKUserScriptInjectionTimeEnumData makeWithValue:FWFWKUserScriptInjectionTimeEnumAtDocumentStart] - isMainFrameOnly:@NO]); + isMainFrameOnly:NO]); XCTAssertEqualObjects(userScript.source, @"mySource"); XCTAssertEqual(userScript.injectionTime, WKUserScriptInjectionTimeAtDocumentStart); @@ -94,7 +94,7 @@ OCMStub([mockFrameInfo isMainFrame]).andReturn(YES); FWFWKFrameInfoData *targetFrameData = FWFWKFrameInfoDataFromNativeWKFrameInfo(mockFrameInfo); - XCTAssertEqualObjects(targetFrameData.isMainFrame, @YES); + XCTAssertEqual(targetFrameData.isMainFrame, YES); } - (void)testFWFNSErrorDataFromNSError { @@ -104,7 +104,7 @@ userInfo:@{@"a" : @"b", @"c" : unsupportedType}]; FWFNSErrorData *data = FWFNSErrorDataFromNativeNSError(error); - XCTAssertEqualObjects(data.code, @23); + XCTAssertEqual(data.code, 23); XCTAssertEqualObjects(data.domain, @"domain"); NSDictionary *userInfo = @{ @@ -133,7 +133,7 @@ FWFWKSecurityOriginData *data = FWFWKSecurityOriginDataFromNativeWKSecurityOrigin(mockSecurityOrigin); XCTAssertEqualObjects(data.host, @"host"); - XCTAssertEqualObjects(data.port, @(2)); + XCTAssertEqual(data.port, 2); XCTAssertEqualObjects(data.protocol, @"protocol"); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 185b4804371e2968d91deab3400d42c4ce7d996f..478e4fedef014a0ef3bd4a0d003d5a3548092144 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -22,7 +22,7 @@ [instanceManager addDartCreatedInstance:mockDataStore withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebsiteDataStoreWithIdentifier:@1 dataStoreIdentifier:@0 error:&error]; + [hostAPI createFromWebsiteDataStoreWithIdentifier:1 dataStoreIdentifier:0 error:&error]; WKHTTPCookieStore *cookieStore = (WKHTTPCookieStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([cookieStore isKindOfClass:[WKHTTPCookieStore class]]); XCTAssertNil(error); @@ -42,7 +42,7 @@ makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] ] propertyValues:@[ @"hello" ]]; FlutterError *__block blockError; - [hostAPI setCookieForStoreWithIdentifier:@0 + [hostAPI setCookieForStoreWithIdentifier:0 cookie:cookieData completion:^(FlutterError *error) { blockError = error; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m index 570a1f73ad9bb80ec769e0a29c52a069c60d43e5..dc4cb3cf8abef35765b6a1bcb21247a0060f803a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m @@ -51,7 +51,7 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFNavigationDelegate *navigationDelegate = (FWFNavigationDelegate *)[instanceManager instanceForIdentifier:0]; @@ -74,8 +74,8 @@ [instanceManager addDartCreatedInstance:mockWebView withIdentifier:1]; [mockDelegate webView:mockWebView didFinishNavigation:OCMClassMock([WKNavigation class])]; - OCMVerify([mockFlutterAPI didFinishNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + OCMVerify([mockFlutterAPI didFinishNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 URL:@"https://flutter.dev/" completion:OCMOCK_ANY]); } @@ -97,8 +97,8 @@ [mockDelegate webView:mockWebView didStartProvisionalNavigation:OCMClassMock([WKNavigation class])]; OCMVerify([mockFlutterAPI - didStartProvisionalNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didStartProvisionalNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 URL:@"https://flutter.dev/" completion:OCMOCK_ANY]); } @@ -125,8 +125,8 @@ OCMStub([mockNavigationAction targetFrame]).andReturn(mockFrameInfo); OCMStub([mockFlutterAPI - decidePolicyForNavigationActionForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + decidePolicyForNavigationActionForDelegateWithIdentifier:0 + webViewIdentifier:1 navigationAction: [OCMArg isKindOfClass:[FWFWKNavigationActionData class]] @@ -164,8 +164,8 @@ didFailNavigation:OCMClassMock([WKNavigation class]) withError:[NSError errorWithDomain:@"domain" code:0 userInfo:nil]]; OCMVerify([mockFlutterAPI - didFailNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didFailNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 error:[OCMArg isKindOfClass:[FWFNSErrorData class]] completion:OCMOCK_ANY]); } @@ -187,8 +187,8 @@ didFailProvisionalNavigation:OCMClassMock([WKNavigation class]) withError:[NSError errorWithDomain:@"domain" code:0 userInfo:nil]]; OCMVerify([mockFlutterAPI - didFailProvisionalNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didFailProvisionalNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 error:[OCMArg isKindOfClass:[FWFNSErrorData class]] completion:OCMOCK_ANY]); @@ -209,8 +209,62 @@ [mockDelegate webViewWebContentProcessDidTerminate:mockWebView]; OCMVerify([mockFlutterAPI - webViewWebContentProcessDidTerminateForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + webViewWebContentProcessDidTerminateForDelegateWithIdentifier:0 + webViewIdentifier:1 completion:OCMOCK_ANY]); } + +- (void)testDidReceiveAuthenticationChallenge { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + + FWFNavigationDelegate *mockDelegate = [self mockNavigationDelegateWithManager:instanceManager + identifier:0]; + FWFNavigationDelegateFlutterApiImpl *mockFlutterAPI = + [self mockFlutterApiWithManager:instanceManager]; + + OCMStub([mockDelegate navigationDelegateAPI]).andReturn(mockFlutterAPI); + + WKWebView *mockWebView = OCMClassMock([WKWebView class]); + [instanceManager addDartCreatedInstance:mockWebView withIdentifier:1]; + + NSURLAuthenticationChallenge *mockChallenge = OCMClassMock([NSURLAuthenticationChallenge class]); + NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"host" + port:0 + protocol:nil + realm:@"realm" + authenticationMethod:nil]; + OCMStub([mockChallenge protectionSpace]).andReturn(protectionSpace); + [instanceManager addDartCreatedInstance:mockChallenge withIdentifier:2]; + + NSURLCredential *credential = [NSURLCredential credentialWithUser:@"user" + password:@"password" + persistence:NSURLCredentialPersistenceNone]; + [instanceManager addDartCreatedInstance:credential withIdentifier:5]; + + OCMStub([mockFlutterAPI + didReceiveAuthenticationChallengeForDelegateWithIdentifier:0 + webViewIdentifier:1 + challengeIdentifier:2 + completion: + ([OCMArg + invokeBlockWithArgs: + [FWFAuthenticationChallengeResponse + makeWithDisposition: + FWFNSUrlSessionAuthChallengeDispositionCancelAuthenticationChallenge + credentialIdentifier:@(5)], + [NSNull null], nil])]); + + NSURLSessionAuthChallengeDisposition __block callbackDisposition = -1; + NSURLCredential *__block callbackCredential; + [mockDelegate webView:mockWebView + didReceiveAuthenticationChallenge:mockChallenge + completionHandler:^(NSURLSessionAuthChallengeDisposition disposition, + NSURLCredential *credential) { + callbackDisposition = disposition; + callbackCredential = credential; + }]; + + XCTAssertEqual(callbackDisposition, NSURLSessionAuthChallengeCancelAuthenticationChallenge); + XCTAssertEqualObjects(callbackCredential, credential); +} @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m index 888a3a1e9a66e43a14525db680980ec7fccfd09b..8c0b90850a82d9a7fd4be09fca353fac7108e7cd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -57,8 +57,8 @@ FlutterError *error; [hostAPI - addObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 + addObserverForObjectWithIdentifier:0 + observerIdentifier:1 keyPath:@"myKey" options:@[ [FWFNSKeyValueObservingOptionsEnumData @@ -88,8 +88,8 @@ [instanceManager addDartCreatedInstance:observerObject withIdentifier:1]; FlutterError *error; - [hostAPI removeObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 + [hostAPI removeObserverForObjectWithIdentifier:0 + observerIdentifier:1 keyPath:@"myKey" error:&error]; OCMVerify([mockObject removeObserver:observerObject forKeyPath:@"myKey"]); @@ -106,7 +106,7 @@ [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI disposeObjectWithIdentifier:@0 error:&error]; + [hostAPI disposeObjectWithIdentifier:0 error:&error]; // Only the strong reference is removed, so the weak reference will remain until object is set to // nil. object = nil; @@ -130,9 +130,9 @@ change:@{NSKeyValueChangeOldKey : @"key"} context:nil]; OCMVerify([mockFlutterAPI - observeValueForObjectWithIdentifier:@0 + observeValueForObjectWithIdentifier:0 keyPath:@"keyPath" - objectIdentifier:@1 + objectIdentifier:1 changeKeys:[OCMArg checkWithBlock:^BOOL( NSArray *value) { @@ -140,8 +140,7 @@ }] changeValues:[OCMArg checkWithBlock:^BOOL(id value) { FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; - return !object.isIdentifier.boolValue && - [@"key" isEqual:object.value]; + return !object.isIdentifier && [@"key" isEqual:object.value]; }] completion:OCMOCK_ANY]); } @@ -165,9 +164,9 @@ change:@{NSKeyValueChangeOldKey : returnedObject} context:nil]; OCMVerify([mockFlutterAPI - observeValueForObjectWithIdentifier:@0 + observeValueForObjectWithIdentifier:0 keyPath:@"keyPath" - objectIdentifier:@1 + objectIdentifier:1 changeKeys:[OCMArg checkWithBlock:^BOOL( NSArray *value) { @@ -175,7 +174,7 @@ }] changeValues:[OCMArg checkWithBlock:^BOOL(id value) { FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; - return object.isIdentifier.boolValue && [@(2) isEqual:object.value]; + return object.isIdentifier && [@(2) isEqual:object.value]; }] completion:OCMOCK_ANY]); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index 95b81ad5c3890749ba160c883d166d6e1b6c3f83..dcbe75bf58fb3eaf23d9b6d59e95477735e2e7b4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -20,7 +20,7 @@ [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKPreferences *preferences = (WKPreferences *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); XCTAssertNil(error); @@ -36,7 +36,7 @@ [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setJavaScriptEnabledForPreferencesWithIdentifier:@0 isEnabled:@YES error:&error]; + [hostAPI setJavaScriptEnabledForPreferencesWithIdentifier:0 isEnabled:YES error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled:YES]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m index 84d31d1c543e71bafcf8f201908ef19c8a3d3666..fb9958726286ac8a77f455547585956eae27c1a3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m @@ -50,7 +50,7 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFScriptMessageHandler *scriptMessageHandler = (FWFScriptMessageHandler *)[instanceManager instanceForIdentifier:0]; @@ -78,8 +78,8 @@ [mockHandler userContentController:userContentController didReceiveScriptMessage:mockScriptMessage]; OCMVerify([mockFlutterAPI - didReceiveScriptMessageForHandlerWithIdentifier:@0 - userContentControllerIdentifier:@1 + didReceiveScriptMessageForHandlerWithIdentifier:0 + userContentControllerIdentifier:1 message:[OCMArg isKindOfClass:[FWFWKScriptMessageData class]] completion:OCMOCK_ANY]); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewDelegateHostApiTests.m new file mode 100644 index 0000000000000000000000000000000000000000..02e89aa6cec1a29c1ca0e5b885fb5191ee7766e4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewDelegateHostApiTests.m @@ -0,0 +1,82 @@ +// Copyright 2013 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. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFScrollViewDelegateHostApiTests : XCTestCase + +@end + +@implementation FWFScrollViewDelegateHostApiTests +/** + * Creates a partially mocked FWFScrollViewDelegate and adds it to instanceManager. + * + * @param instanceManager Instance manager to add the delegate to. + * @param identifier Identifier for the delegate added to the instanceManager. + * + * @return A mock FWFScrollViewDelegate. + */ +- (id)mockDelegateWithManager:(FWFInstanceManager *)instanceManager identifier:(long)identifier { + FWFScrollViewDelegate *delegate = [[FWFScrollViewDelegate alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + [instanceManager addDartCreatedInstance:delegate withIdentifier:0]; + return OCMPartialMock(delegate); +} + +/** + * Creates a mock FWFUIScrollViewDelegateFlutterApiImpl with instanceManager. + * + * @param instanceManager Instance manager passed to the Flutter API. + * + * @return A mock FWFUIScrollViewDelegateFlutterApiImpl. + */ +- (id)mockFlutterApiWithManager:(FWFInstanceManager *)instanceManager { + FWFScrollViewDelegateFlutterApiImpl *flutterAPI = [[FWFScrollViewDelegateFlutterApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + return OCMPartialMock(flutterAPI); +} + +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFScrollViewDelegateHostApiImpl *hostAPI = [[FWFScrollViewDelegateHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + FlutterError *error; + [hostAPI createWithIdentifier:0 error:&error]; + FWFScrollViewDelegate *delegate = + (FWFScrollViewDelegate *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([delegate conformsToProtocol:@protocol(UIScrollViewDelegate)]); + XCTAssertNil(error); +} + +- (void)testOnScrollViewDidScrollForDelegateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + + FWFScrollViewDelegate *mockDelegate = [self mockDelegateWithManager:instanceManager identifier:0]; + FWFScrollViewDelegateFlutterApiImpl *mockFlutterAPI = + [self mockFlutterApiWithManager:instanceManager]; + + OCMStub([mockDelegate scrollViewDelegateAPI]).andReturn(mockFlutterAPI); + UIScrollView *scrollView = [[UIScrollView alloc] init]; + scrollView.contentOffset = CGPointMake(1.0, 2.0); + + [instanceManager addDartCreatedInstance:scrollView withIdentifier:1]; + + [mockDelegate scrollViewDidScroll:scrollView]; + OCMVerify([mockFlutterAPI scrollViewDidScrollWithIdentifier:0 + UIScrollViewIdentifier:1 + x:1.0 + y:2.0 + completion:OCMOCK_ANY]); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m index ede8dcf35d89f6ae49a4ca25043a4969bbeaf197..306fc8f9dfc4d7a058a28fd207814d7961b1b022 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m @@ -24,7 +24,7 @@ FlutterError *error; NSArray *expectedValue = @[ @1.0, @2.0 ]; - XCTAssertEqualObjects([hostAPI contentOffsetForScrollViewWithIdentifier:@0 error:&error], + XCTAssertEqualObjects([hostAPI contentOffsetForScrollViewWithIdentifier:0 error:&error], expectedValue); XCTAssertNil(error); } @@ -40,7 +40,7 @@ [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI scrollByForScrollViewWithIdentifier:@0 x:@1 y:@2 error:&error]; + [hostAPI scrollByForScrollViewWithIdentifier:0 x:1 y:2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 2); XCTAssertEqual(scrollView.contentOffset.y, 4); XCTAssertNil(error); @@ -56,9 +56,26 @@ [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setContentOffsetForScrollViewWithIdentifier:@0 toX:@1 y:@2 error:&error]; + [hostAPI setContentOffsetForScrollViewWithIdentifier:0 toX:1 y:2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 1); XCTAssertEqual(scrollView.contentOffset.y, 2); XCTAssertNil(error); } + +- (void)testSetDelegateForScrollView { + UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)]; + FWFScrollViewDelegate *delegate = [[FWFScrollViewDelegate alloc] init]; + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addDartCreatedInstance:scrollView withIdentifier:0]; + [instanceManager addDartCreatedInstance:delegate withIdentifier:1]; + + FWFScrollViewHostApiImpl *hostAPI = + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostAPI setDelegateForScrollViewWithIdentifier:0 uiScrollViewDelegateIdentifier:@1 error:&error]; + XCTAssertEqual(scrollView.delegate, delegate); + XCTAssertNil(error); +} @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m index 72366762b7f572b91f8f3989b36b1aa0f5c249a7..ac13eb5811bec279f7f3a09e426ce2d9b65e65e2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m @@ -5,6 +5,7 @@ @import Flutter; @import XCTest; @import webview_flutter_wkwebview; +@import webview_flutter_wkwebview.Test; #import @@ -50,7 +51,7 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFUIDelegate *delegate = (FWFUIDelegate *)[instanceManager instanceForIdentifier:0]; XCTAssertTrue([delegate conformsToProtocol:@protocol(WKUIDelegate)]); @@ -70,12 +71,8 @@ WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; id mockConfigurationFlutterApi = OCMPartialMock(mockFlutterAPI.webViewConfigurationFlutterApi); - NSNumber *__block configurationIdentifier; - OCMStub([mockConfigurationFlutterApi createWithIdentifier:[OCMArg checkWithBlock:^BOOL(id value) { - configurationIdentifier = value; - return YES; - }] - completion:OCMOCK_ANY]); + OCMStub([mockConfigurationFlutterApi createWithIdentifier:0 completion:OCMOCK_ANY]) + .ignoringNonObjectArgs(); WKNavigationAction *mockNavigationAction = OCMClassMock([WKNavigationAction class]); OCMStub([mockNavigationAction request]) @@ -85,13 +82,16 @@ OCMStub([mockFrameInfo isMainFrame]).andReturn(YES); OCMStub([mockNavigationAction targetFrame]).andReturn(mockFrameInfo); + // Creating the webview will create a configuration on the host side, using the next available + // identifier, so save that for checking against later. + NSInteger configurationIdentifier = instanceManager.nextIdentifier; [mockDelegate webView:mockWebView createWebViewWithConfiguration:configuration forNavigationAction:mockNavigationAction windowFeatures:OCMClassMock([WKWindowFeatures class])]; OCMVerify([mockFlutterAPI - onCreateWebViewForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + onCreateWebViewForDelegateWithIdentifier:0 + webViewIdentifier:1 configurationIdentifier:configurationIdentifier navigationAction:[OCMArg isKindOfClass:[FWFWKNavigationActionData class]] @@ -125,8 +125,8 @@ }]; OCMVerify([mockFlutterAPI - requestMediaCapturePermissionForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + requestMediaCapturePermissionForDelegateWithIdentifier:0 + webViewIdentifier:1 origin:[OCMArg isKindOfClass: [FWFWKSecurityOriginData class]] diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m index 65a24d97a39a0e2ca178e597a2d7183e8092566f..d15937b1fe9c9e7a3922363c36a0c1734dca79ef 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m @@ -22,7 +22,7 @@ [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setBackgroundColorForViewWithIdentifier:@0 toValue:@123 error:&error]; + [hostAPI setBackgroundColorForViewWithIdentifier:0 toValue:@123 error:&error]; OCMVerify([mockUIView setBackgroundColor:[UIColor colorWithRed:(123 >> 16 & 0xff) / 255.0 green:(123 >> 8 & 0xff) / 255.0 @@ -41,7 +41,7 @@ [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setOpaqueForViewWithIdentifier:@0 isOpaque:@YES error:&error]; + [hostAPI setOpaqueForViewWithIdentifier:0 isOpaque:YES error:&error]; OCMVerify([mockUIView setOpaque:YES]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLAuthenticationChallengeHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLAuthenticationChallengeHostApiTests.m new file mode 100644 index 0000000000000000000000000000000000000000..fc0edf9f402707fbd4e714f54b3a7be906ea7c93 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLAuthenticationChallengeHostApiTests.m @@ -0,0 +1,47 @@ +// Copyright 2013 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. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFURLAuthenticationChallengeHostApiTests : XCTestCase + +@end + +@implementation FWFURLAuthenticationChallengeHostApiTests +- (void)testFlutterApiCreate { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFURLAuthenticationChallengeFlutterApiImpl *flutterApi = + [[FWFURLAuthenticationChallengeFlutterApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + flutterApi.api = OCMClassMock([FWFNSUrlAuthenticationChallengeFlutterApi class]); + + NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"host" + port:0 + protocol:nil + realm:@"realm" + authenticationMethod:nil]; + + NSURLAuthenticationChallenge *mockChallenge = OCMClassMock([NSURLAuthenticationChallenge class]); + OCMStub([mockChallenge protectionSpace]).andReturn(protectionSpace); + + [flutterApi createWithInstance:mockChallenge + protectionSpace:protectionSpace + completion:^(FlutterError *error){ + + }]; + + long identifier = [instanceManager identifierWithStrongReferenceForInstance:mockChallenge]; + long protectionSpaceIdentifier = + [instanceManager identifierWithStrongReferenceForInstance:protectionSpace]; + OCMVerify([flutterApi.api createWithIdentifier:identifier + protectionSpaceIdentifier:protectionSpaceIdentifier + completion:OCMOCK_ANY]); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLCredentialHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLCredentialHostApiTests.m new file mode 100644 index 0000000000000000000000000000000000000000..7f3aa3426dad15ba61cb8e4c5f05b3c4c0b9cf49 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLCredentialHostApiTests.m @@ -0,0 +1,35 @@ +// Copyright 2013 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. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFURLCredentialHostApiTests : XCTestCase +@end + +@implementation FWFURLCredentialHostApiTests +- (void)testHostApiCreate { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + + FWFURLCredentialHostApiImpl *hostApi = [[FWFURLCredentialHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithUserWithIdentifier:0 + user:@"user" + password:@"password" + persistence:FWFNSUrlCredentialPersistencePermanent + error:&error]; + XCTAssertNil(error); + + NSURLCredential *credential = (NSURLCredential *)[instanceManager instanceForIdentifier:0]; + XCTAssertEqualObjects(credential.user, @"user"); + XCTAssertEqualObjects(credential.password, @"password"); + XCTAssertEqual(credential.persistence, NSURLCredentialPersistencePermanent); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLProtectionSpaceHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLProtectionSpaceHostApiTests.m new file mode 100644 index 0000000000000000000000000000000000000000..c5a6cdf36cf12e773046a053642a79894d20a6ac --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLProtectionSpaceHostApiTests.m @@ -0,0 +1,43 @@ +// Copyright 2013 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. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFURLProtectionSpaceHostApiTests : XCTestCase +@end + +@implementation FWFURLProtectionSpaceHostApiTests +- (void)testFlutterApiCreate { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFURLProtectionSpaceFlutterApiImpl *flutterApi = [[FWFURLProtectionSpaceFlutterApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + flutterApi.api = OCMClassMock([FWFNSUrlProtectionSpaceFlutterApi class]); + + NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"host" + port:0 + protocol:nil + realm:@"realm" + authenticationMethod:nil]; + [flutterApi createWithInstance:protectionSpace + host:@"host" + realm:@"realm" + authenticationMethod:@"method" + completion:^(FlutterError *error){ + + }]; + + long identifier = [instanceManager identifierWithStrongReferenceForInstance:protectionSpace]; + OCMVerify([flutterApi.api createWithIdentifier:identifier + host:@"host" + realm:@"realm" + authenticationMethod:@"method" + completion:OCMOCK_ANY]); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m index bf4dc36048f9dc7dae6f9d0a5a86a0638af3564f..7e8d2ad0f1291606fe6b2962284c83c6fba2c74b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m @@ -24,7 +24,7 @@ instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:@(0) error:&error], + XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:0 error:&error], @"https://www.google.com"); XCTAssertNil(error); } @@ -43,6 +43,6 @@ }]; long identifier = [instanceManager identifierWithStrongReferenceForInstance:url]; - OCMVerify([flutterApi.api createWithIdentifier:@(identifier) completion:OCMOCK_ANY]); + OCMVerify([flutterApi.api createWithIdentifier:identifier completion:OCMOCK_ANY]); } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m index 4f523e6da40268989a338592ca0c3a0296ec5a38..38da70fd62a397e9cd00dd4dccd9a061b953a43d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m @@ -20,7 +20,7 @@ [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKUserContentController *userContentController = (WKUserContentController *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); @@ -42,8 +42,8 @@ [instanceManager addDartCreatedInstance:mockMessageHandler withIdentifier:1]; FlutterError *error; - [hostAPI addScriptMessageHandlerForControllerWithIdentifier:@0 - handlerIdentifier:@1 + [hostAPI addScriptMessageHandlerForControllerWithIdentifier:0 + handlerIdentifier:1 ofName:@"apple" error:&error]; OCMVerify([mockUserContentController addScriptMessageHandler:mockMessageHandler name:@"apple"]); @@ -61,7 +61,7 @@ [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeScriptMessageHandlerForControllerWithIdentifier:@0 name:@"apple" error:&error]; + [hostAPI removeScriptMessageHandlerForControllerWithIdentifier:0 name:@"apple" error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandlerForName:@"apple"]); XCTAssertNil(error); } @@ -77,7 +77,7 @@ [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeAllScriptMessageHandlersForControllerWithIdentifier:@0 error:&error]; + [hostAPI removeAllScriptMessageHandlersForControllerWithIdentifier:0 error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers]); XCTAssertNil(error); } @@ -94,7 +94,7 @@ FlutterError *error; [hostAPI - addUserScriptForControllerWithIdentifier:@0 + addUserScriptForControllerWithIdentifier:0 userScript: [FWFWKUserScriptData makeWithSource:@"runAScript" @@ -102,7 +102,7 @@ [FWFWKUserScriptInjectionTimeEnumData makeWithValue: FWFWKUserScriptInjectionTimeEnumAtDocumentEnd] - isMainFrameOnly:@YES] + isMainFrameOnly:YES] error:&error]; OCMVerify([mockUserContentController addUserScript:[OCMArg isKindOfClass:[WKUserScript class]]]); @@ -120,7 +120,7 @@ [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeAllUserScriptsForControllerWithIdentifier:@0 error:&error]; + [hostAPI removeAllUserScriptsForControllerWithIdentifier:0 error:&error]; OCMVerify([mockUserContentController removeAllUserScripts]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index 98be6dfe9e2bf88949bc6a5461a6e4390602c0cd..5670468c043946d5ae3e683569f0f7ea8e698fc8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -19,7 +19,7 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:0]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); @@ -37,7 +37,7 @@ [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewWithIdentifier:@1 webViewIdentifier:@0 error:&error]; + [hostAPI createFromWebViewWithIdentifier:1 webViewIdentifier:0 error:&error]; WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); @@ -55,9 +55,7 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - isAllowed:@NO - error:&error]; + [hostAPI setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:0 isAllowed:NO error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback:NO]); XCTAssertNil(error); } @@ -73,8 +71,8 @@ instanceManager:instanceManager]; FlutterError *error; - [hostAPI setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:@0 - isLimited:@NO + [hostAPI setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:0 + isLimited:NO error:&error]; OCMVerify([mockWebViewConfiguration setLimitsNavigationsToAppBoundDomains:NO]); XCTAssertNil(error); @@ -92,7 +90,7 @@ FlutterError *error; [hostAPI - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:0 forTypes:@[ [FWFWKAudiovisualMediaTypeEnumData makeWithValue: diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m index a89bf338c3fea78d3e0643ada8aadc8914a1e21c..568e5fe1ed1c554755ba2ba8e99cdcf6859a18f4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m @@ -23,7 +23,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; WKWebView *webView = (WKWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([webView isKindOfClass:[WKWebView class]]); XCTAssertNil(error); @@ -44,7 +44,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } httpMethod:@"get" httpBody:nil allHttpHeaderFields:@{@"a" : @"header"}]; - [hostAPI loadRequestForWebViewWithIdentifier:@0 request:requestData error:&error]; + [hostAPI loadRequestForWebViewWithIdentifier:0 request:requestData error:&error]; NSURL *url = [NSURL URLWithString:@"https://www.flutter.dev"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; @@ -56,7 +56,6 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } - (void)testLoadRequestWithInvalidUrl { FWFWebView *mockWebView = OCMClassMock([FWFWebView class]); - OCMReject([mockWebView loadRequest:OCMOCK_ANY]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; @@ -65,16 +64,24 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) instanceManager:instanceManager]; + NSString *badURLString = @"%invalidUrl%"; FlutterError *error; - FWFNSUrlRequestData *requestData = [FWFNSUrlRequestData makeWithUrl:@"%invalidUrl%" + FWFNSUrlRequestData *requestData = [FWFNSUrlRequestData makeWithUrl:badURLString httpMethod:nil httpBody:nil allHttpHeaderFields:@{}]; - [hostAPI loadRequestForWebViewWithIdentifier:@0 request:requestData error:&error]; - XCTAssertNotNil(error); - XCTAssertEqualObjects(error.code, @"FWFURLRequestParsingError"); - XCTAssertEqualObjects(error.message, @"Failed instantiating an NSURLRequest."); - XCTAssertEqualObjects(error.details, @"URL was: '%invalidUrl%'"); + [hostAPI loadRequestForWebViewWithIdentifier:0 request:requestData error:&error]; + // When linking against the iOS 17 SDK or later, NSURL uses a lenient parser, and won't + // fail to parse URLs, so the test must allow for either outcome. + if (error) { + XCTAssertEqualObjects(error.code, @"FWFURLRequestParsingError"); + XCTAssertEqualObjects(error.message, @"Failed instantiating an NSURLRequest."); + XCTAssertEqualObjects(error.details, @"URL was: '%invalidUrl%'"); + } else { + NSMutableURLRequest *request = + [NSMutableURLRequest requestWithURL:[NSURL URLWithString:badURLString]]; + OCMVerify([mockWebView loadRequest:request]); + } } - (void)testSetCustomUserAgent { @@ -88,7 +95,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI setUserAgentForWebViewWithIdentifier:@0 userAgent:@"userA" error:&error]; + [hostAPI setCustomUserAgentForWebViewWithIdentifier:0 userAgent:@"userA" error:&error]; OCMVerify([mockWebView setCustomUserAgent:@"userA"]); XCTAssertNil(error); } @@ -105,7 +112,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI URLForWebViewWithIdentifier:@0 error:&error], + XCTAssertEqualObjects([hostAPI URLForWebViewWithIdentifier:0 error:&error], @"https://www.flutter.dev/"); XCTAssertNil(error); } @@ -122,7 +129,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI canGoBackForWebViewWithIdentifier:@0 error:&error], @YES); + XCTAssertEqualObjects([hostAPI canGoBackForWebViewWithIdentifier:0 error:&error], @YES); XCTAssertNil(error); } @@ -140,7 +147,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; FlutterError *error; - [hostAPI setUIDelegateForWebViewWithIdentifier:@0 delegateIdentifier:@1 error:&error]; + [hostAPI setUIDelegateForWebViewWithIdentifier:0 delegateIdentifier:@1 error:&error]; OCMVerify([mockWebView setUIDelegate:mockDelegate]); XCTAssertNil(error); } @@ -159,7 +166,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; FlutterError *error; - [hostAPI setNavigationDelegateForWebViewWithIdentifier:@0 delegateIdentifier:@1 error:&error]; + [hostAPI setNavigationDelegateForWebViewWithIdentifier:0 delegateIdentifier:@1 error:&error]; OCMVerify([mockWebView setNavigationDelegate:mockDelegate]); XCTAssertNil(error); } @@ -176,7 +183,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI estimatedProgressForWebViewWithIdentifier:@0 error:&error], @34.0); + XCTAssertEqualObjects([hostAPI estimatedProgressForWebViewWithIdentifier:0 error:&error], @34.0); XCTAssertNil(error); } @@ -191,7 +198,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI loadHTMLForWebViewWithIdentifier:@0 + [hostAPI loadHTMLForWebViewWithIdentifier:0 HTMLString:@"myString" baseURL:@"myBaseUrl" error:&error]; @@ -210,7 +217,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI loadFileForWebViewWithIdentifier:@0 + [hostAPI loadFileForWebViewWithIdentifier:0 fileURL:@"myFolder/apple.txt" readAccessURL:@"myFolder" error:&error]; @@ -242,7 +249,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } assetManager:mockAssetManager]; FlutterError *error; - [hostAPI loadAssetForWebViewWithIdentifier:@0 assetKey:@"assets/index.html" error:&error]; + [hostAPI loadAssetForWebViewWithIdentifier:0 assetKey:@"assets/index.html" error:&error]; XCTAssertNil(error); OCMVerify([mockWebView @@ -262,7 +269,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI canGoForwardForWebViewWithIdentifier:@0 error:&error], @NO); + XCTAssertEqualObjects([hostAPI canGoForwardForWebViewWithIdentifier:0 error:&error], @NO); XCTAssertNil(error); } @@ -277,7 +284,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI goBackForWebViewWithIdentifier:@0 error:&error]; + [hostAPI goBackForWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView goBack]); XCTAssertNil(error); } @@ -293,7 +300,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI goForwardForWebViewWithIdentifier:@0 error:&error]; + [hostAPI goForwardForWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView goForward]); XCTAssertNil(error); } @@ -309,7 +316,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI reloadWebViewWithIdentifier:@0 error:&error]; + [hostAPI reloadWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView reload]); XCTAssertNil(error); } @@ -326,7 +333,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI titleForWebViewWithIdentifier:@0 error:&error], @"myTitle"); + XCTAssertEqualObjects([hostAPI titleForWebViewWithIdentifier:0 error:&error], @"myTitle"); XCTAssertNil(error); } @@ -341,7 +348,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI setAllowsBackForwardForWebViewWithIdentifier:@0 isAllowed:@YES error:&error]; + [hostAPI setAllowsBackForwardForWebViewWithIdentifier:0 isAllowed:YES error:&error]; OCMVerify([mockWebView setAllowsBackForwardNavigationGestures:YES]); XCTAssertNil(error); } @@ -362,7 +369,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } NSString __block *returnValue; FlutterError __block *returnError; - [hostAPI evaluateJavaScriptForWebViewWithIdentifier:@0 + [hostAPI evaluateJavaScriptForWebViewWithIdentifier:0 javaScriptString:@"runJavaScript" completion:^(id result, FlutterError *error) { returnValue = result; @@ -396,7 +403,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } NSString __block *returnValue; FlutterError __block *returnError; - [hostAPI evaluateJavaScriptForWebViewWithIdentifier:@0 + [hostAPI evaluateJavaScriptForWebViewWithIdentifier:0 javaScriptString:@"runJavaScript" completion:^(id result, FlutterError *error) { returnValue = result; @@ -406,7 +413,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } XCTAssertNil(returnValue); FWFNSErrorData *errorData = returnError.details; XCTAssertTrue([errorData isKindOfClass:[FWFNSErrorData class]]); - XCTAssertEqualObjects(errorData.code, @0); + XCTAssertEqual(errorData.code, 0); XCTAssertEqualObjects(errorData.domain, @"errorDomain"); XCTAssertEqualObjects(errorData.userInfo, @{NSLocalizedDescriptionKey : @"description"}); } @@ -420,7 +427,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; FWFWebView *webView = (FWFWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertEqual(webView.scrollView.contentInsetAdjustmentBehavior, @@ -437,7 +444,7 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; FWFWebView *webView = (FWFWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertFalse(webView.scrollView.automaticallyAdjustsScrollIndicatorInsets); @@ -476,8 +483,27 @@ static bool feq(CGFloat a, CGFloat b) { return fabs(b - a) < FLT_EPSILON; } instanceManager:instanceManager]; FlutterError *error; - [hostAPI setInspectableForWebViewWithIdentifier:@0 inspectable:@YES error:&error]; + [hostAPI setInspectableForWebViewWithIdentifier:0 inspectable:YES error:&error]; OCMVerify([mockWebView setInspectable:YES]); XCTAssertNil(error); } + +- (void)testCustomUserAgent { + FWFWebView *mockWebView = OCMClassMock([FWFWebView class]); + + NSString *userAgent = @"str"; + OCMStub([mockWebView customUserAgent]).andReturn(userAgent); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; + + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + FlutterError *error; + XCTAssertEqualObjects([hostAPI customUserAgentForWebViewWithIdentifier:0 error:&error], + userAgent); + XCTAssertNil(error); +} @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index c518f55194c4e79162ac22b93b02823bf592bf2c..880c81e59e95508295535722d9d7a68b7abd5e7d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -20,7 +20,7 @@ [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([dataStore isKindOfClass:[WKWebsiteDataStore class]]); XCTAssertNil(error); @@ -32,7 +32,7 @@ [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI createDefaultDataStoreWithIdentifier:@0 error:&error]; + [hostAPI createDefaultDataStoreWithIdentifier:0 error:&error]; WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:0]; XCTAssertEqualObjects(dataStore, [WKWebsiteDataStore defaultDataStore]); XCTAssertNil(error); @@ -59,12 +59,12 @@ NSNumber __block *returnValue; FlutterError *__block blockError; - [hostAPI removeDataFromDataStoreWithIdentifier:@0 + [hostAPI removeDataFromDataStoreWithIdentifier:0 ofTypes:@[ [FWFWKWebsiteDataTypeEnumData makeWithValue:FWFWKWebsiteDataTypeEnumLocalStorage] ] - modifiedSince:@45.0 + modifiedSince:45.0 completion:^(NSNumber *result, FlutterError *error) { returnValue = result; blockError = error; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart index 7367828dbedfef7257d9b779841bf5554671d8cf..277a586fe038bf9b2432367b5eff43d2687222a2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart @@ -74,6 +74,72 @@ const String kTransparentBackgroundPage = ''' '''; +const String kLogExamplePage = ''' + + + +Load file or HTML string example + + + +

Local demo page

+

+ This page is used to test the forwarding of console logs to Dart. +

+ + + +
+ + + + + +
+ + + +'''; + +const String kAlertTestPage = ''' + + + + + + + +

Click the following button to see the effect

+
+ + + +
+ + +'''; + class WebViewExample extends StatefulWidget { const WebViewExample({super.key, this.cookieManager}); @@ -128,6 +194,9 @@ Page resource error: }) ..setOnUrlChange((UrlChange change) { debugPrint('url change to ${change.url}'); + }) + ..setOnHttpAuthRequest((HttpAuthRequest request) { + openDialog(request); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -148,7 +217,12 @@ Page resource error: ) ..loadRequest(LoadRequestParams( uri: Uri.parse('https://flutter.dev'), - )); + )) + ..setOnScrollPositionChange((ScrollPositionChange scrollPositionChange) { + debugPrint( + 'Scroll position change to x = ${scrollPositionChange.x}, y = ${scrollPositionChange.y}', + ); + }); } @override @@ -177,7 +251,7 @@ Page resource error: return FloatingActionButton( onPressed: () async { final String? url = await _controller.currentUrl(); - if (context.mounted) { + if (mounted) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Favorited $url')), ); @@ -186,6 +260,62 @@ Page resource error: child: const Icon(Icons.favorite), ); } + + Future openDialog(HttpAuthRequest httpRequest) async { + final TextEditingController usernameTextController = + TextEditingController(); + final TextEditingController passwordTextController = + TextEditingController(); + + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: Text('${httpRequest.host}: ${httpRequest.realm ?? '-'}'), + content: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + decoration: const InputDecoration(labelText: 'Username'), + autofocus: true, + controller: usernameTextController, + ), + TextField( + decoration: const InputDecoration(labelText: 'Password'), + controller: passwordTextController, + ), + ], + ), + ), + actions: [ + // Explicitly cancel the request on iOS as the OS does not emit new + // requests when a previous request is pending. + TextButton( + onPressed: () { + httpRequest.onCancel(); + Navigator.of(context).pop(); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + httpRequest.onProceed( + WebViewCredential( + user: usernameTextController.text, + password: passwordTextController.text, + ), + ); + Navigator.of(context).pop(); + }, + child: const Text('Authenticate'), + ), + ], + ); + }, + ); + } } enum MenuOptions { @@ -202,6 +332,9 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + logExample, + basicAuthentication, + javaScriptAlert, } class SampleMenu extends StatelessWidget { @@ -262,6 +395,15 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.logExample: + _onLogExample(); + break; + case MenuOptions.basicAuthentication: + _promptForUrl(context); + break; + case MenuOptions.javaScriptAlert: + _onJavaScriptAlertExample(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -318,6 +460,18 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.transparentBackground, child: Text('Transparent background example'), ), + const PopupMenuItem( + value: MenuOptions.logExample, + child: Text('Log example'), + ), + const PopupMenuItem( + value: MenuOptions.basicAuthentication, + child: Text('Basic Authentication Example'), + ), + const PopupMenuItem( + value: MenuOptions.javaScriptAlert, + child: Text('JavaScript Alert Example'), + ), ], ); } @@ -442,6 +596,28 @@ class SampleMenu extends StatelessWidget { return webViewController.loadHtmlString(kTransparentBackgroundPage); } + Future _onJavaScriptAlertExample(BuildContext context) { + webViewController.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + await _showAlert(context, request.message); + }); + + webViewController.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + final bool result = await _showConfirm(context, request.message); + return result; + }); + + webViewController.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + final String result = + await _showTextInput(context, request.message, request.defaultText); + return result; + }); + + return webViewController.loadHtmlString(kAlertTestPage); + } + Widget _getCookieList(String cookies) { if (cookies == '""') { return Container(); @@ -466,6 +642,110 @@ class SampleMenu extends StatelessWidget { return indexFile.path; } + + Future _onLogExample() { + webViewController + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + debugPrint( + '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); + }); + + return webViewController.loadHtmlString(kLogExamplePage); + } + + Future _promptForUrl(BuildContext context) { + final TextEditingController urlTextController = + TextEditingController(text: 'https://'); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Input URL to visit'), + content: TextField( + decoration: const InputDecoration(labelText: 'URL'), + autofocus: true, + controller: urlTextController, + ), + actions: [ + TextButton( + onPressed: () { + if (urlTextController.text.isNotEmpty) { + final Uri? uri = Uri.tryParse(urlTextController.text); + if (uri != null && uri.scheme.isNotEmpty) { + webViewController.loadRequest( + LoadRequestParams(uri: uri), + ); + Navigator.pop(context); + } + } + }, + child: const Text('Visit'), + ), + ], + ); + }, + ); + } + + Future _showAlert(BuildContext context, String message) async { + return showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(); + }, + child: const Text('OK')) + ], + ); + }); + } + + Future _showConfirm(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(false); + }, + child: const Text('Cancel')), + TextButton( + onPressed: () { + Navigator.of(ctx).pop(true); + }, + child: const Text('OK')), + ], + ); + }) ?? + false; + } + + Future _showTextInput( + BuildContext context, String message, String? defaultText) async { + return await showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + content: Text(message), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop('Text test'); + }, + child: const Text('Enter')), + ], + ); + }) ?? + ''; + } } class NavigationControls extends StatelessWidget { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml index b214ded210b961839cc0e0436b46d9473547beae..8bd65a5a4a33aa68da0da1231a5dd5a98dbfb5c2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml @@ -10,7 +10,6 @@ dependencies: flutter: sdk: flutter path_provider: ^2.0.6 - webview_flutter_platform_interface: ^2.4.0 webview_flutter_wkwebview: # When depending on this package from a real application you should use: # webview_flutter: ^x.y.z @@ -19,6 +18,10 @@ dependencies: # the parent directory to use the current plugin's version. path: ../ +dependency_overrides: + webview_flutter_platform_interface: + path: ../../webview_flutter_platform_interface + dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m index 2f919839aa5bcc0e4a5d7f78f5520338f973687c..8d2d0bf28eb2317d370e54e95d2970cb3d4e52c0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m @@ -10,9 +10,11 @@ #import "FWFObjectHostApi.h" #import "FWFPreferencesHostApi.h" #import "FWFScriptMessageHandlerHostApi.h" +#import "FWFScrollViewDelegateHostApi.h" #import "FWFScrollViewHostApi.h" #import "FWFUIDelegateHostApi.h" #import "FWFUIViewHostApi.h" +#import "FWFURLCredentialHostApi.h" #import "FWFURLHostApi.h" #import "FWFUserContentControllerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" @@ -60,50 +62,58 @@ instanceManager:[[FWFInstanceManager alloc] init]]; dispatch_async(dispatch_get_main_queue(), ^{ - [objectApi disposeObjectWithIdentifier:@(identifier) + [objectApi disposeObjectWithIdentifier:identifier completion:^(FlutterError *error) { NSAssert(!error, @"%@", error); }]; }); }]; - FWFWKHttpCookieStoreHostApiSetup( + SetUpFWFWKHttpCookieStoreHostApi( registrar.messenger, [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKNavigationDelegateHostApiSetup( + SetUpFWFWKNavigationDelegateHostApi( registrar.messenger, [[FWFNavigationDelegateHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFNSObjectHostApiSetup(registrar.messenger, + SetUpFWFNSObjectHostApi(registrar.messenger, [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKPreferencesHostApiSetup(registrar.messenger, [[FWFPreferencesHostApiImpl alloc] + SetUpFWFWKPreferencesHostApi(registrar.messenger, [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKScriptMessageHandlerHostApiSetup( + SetUpFWFWKScriptMessageHandlerHostApi( registrar.messenger, [[FWFScriptMessageHandlerHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFUIScrollViewHostApiSetup(registrar.messenger, [[FWFScrollViewHostApiImpl alloc] + SetUpFWFUIScrollViewHostApi(registrar.messenger, [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKUIDelegateHostApiSetup(registrar.messenger, [[FWFUIDelegateHostApiImpl alloc] + SetUpFWFWKUIDelegateHostApi(registrar.messenger, [[FWFUIDelegateHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFUIViewHostApiSetup(registrar.messenger, + SetUpFWFUIViewHostApi(registrar.messenger, [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKUserContentControllerHostApiSetup( + SetUpFWFWKUserContentControllerHostApi( registrar.messenger, [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKWebsiteDataStoreHostApiSetup( + SetUpFWFWKWebsiteDataStoreHostApi( registrar.messenger, [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKWebViewConfigurationHostApiSetup( + SetUpFWFWKWebViewConfigurationHostApi( registrar.messenger, [[FWFWebViewConfigurationHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFWKWebViewHostApiSetup(registrar.messenger, [[FWFWebViewHostApiImpl alloc] + SetUpFWFWKWebViewHostApi(registrar.messenger, [[FWFWebViewHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFNSUrlHostApiSetup(registrar.messenger, + SetUpFWFNSUrlHostApi(registrar.messenger, [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); + SetUpFWFUIScrollViewDelegateHostApi( + registrar.messenger, + [[FWFScrollViewDelegateHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger + instanceManager:instanceManager]); + SetUpFWFNSUrlCredentialHostApi( + registrar.messenger, + [[FWFURLCredentialHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger + instanceManager:instanceManager]); FWFWebViewFactory *webviewFactory = [[FWFWebViewFactory alloc] initWithManager:instanceManager]; [registrar registerViewFactory:webviewFactory withId:@"plugins.flutter.io/webview"]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h index 005cecb39b43861357c08b101d2a299c5c4d3779..e9405f3bb90d484d5176036a17cb4d2f02c593d9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -193,4 +193,26 @@ API_AVAILABLE(ios(15.0)) extern FWFWKMediaCaptureTypeData *FWFWKMediaCaptureTypeDataFromNativeWKMediaCaptureType( WKMediaCaptureType type); +/** + * Converts an FWFNSUrlSessionAuthChallengeDisposition to an NSURLSessionAuthChallengeDisposition. + * + * @param value The object containing information to create an NSURLSessionAuthChallengeDisposition. + * + * @return A NSURLSessionAuthChallengeDisposition or -1 if data could not be converted. + */ +extern NSURLSessionAuthChallengeDisposition +FWFNativeNSURLSessionAuthChallengeDispositionFromFWFNSUrlSessionAuthChallengeDisposition( + FWFNSUrlSessionAuthChallengeDisposition value); + +/** + * Converts an FWFNSUrlCredentialPersistence to an NSURLCredentialPersistence. + * + * @param value The object containing information to create an NSURLCredentialPersistence. + * + * @return A NSURLCredentialPersistence or -1 if data could not be converted. + */ +extern NSURLCredentialPersistence +FWFNativeNSURLCredentialPersistenceFromFWFNSUrlCredentialPersistence( + FWFNSUrlCredentialPersistence value); + NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m index 28c029888a3a773509376adb229f981a8434416a..9a5cc86fe951018fe91cab22e1f9a6a4d554c8c9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -103,7 +103,7 @@ extern WKUserScript *FWFNativeWKUserScriptFromScriptData(FWFWKUserScriptData *da return [[WKUserScript alloc] initWithSource:data.source injectionTime:FWFNativeWKUserScriptInjectionTimeFromEnumData(data.injectionTime) - forMainFrameOnly:data.isMainFrameOnly.boolValue]; + forMainFrameOnly:data.isMainFrameOnly]; } WKUserScriptInjectionTime FWFNativeWKUserScriptInjectionTimeFromEnumData( @@ -167,7 +167,7 @@ FWFWKNavigationActionData *FWFWKNavigationActionDataFromNativeWKNavigationAction FWFNSUrlRequestData *FWFNSUrlRequestDataFromNativeNSURLRequest(NSURLRequest *request) { return [FWFNSUrlRequestData - makeWithUrl:request.URL.absoluteString + makeWithUrl:request.URL.absoluteString == nil ? @"" : request.URL.absoluteString httpMethod:request.HTTPMethod httpBody:request.HTTPBody ? [FlutterStandardTypedData typedDataWithBytes:request.HTTPBody] @@ -176,7 +176,9 @@ FWFNSUrlRequestData *FWFNSUrlRequestDataFromNativeNSURLRequest(NSURLRequest *req } FWFWKFrameInfoData *FWFWKFrameInfoDataFromNativeWKFrameInfo(WKFrameInfo *info) { - return [FWFWKFrameInfoData makeWithIsMainFrame:@(info.isMainFrame)]; + return [FWFWKFrameInfoData + makeWithIsMainFrame:info.isMainFrame + request:FWFNSUrlRequestDataFromNativeNSURLRequest(info.request)]; } WKNavigationActionPolicy FWFNativeWKNavigationActionPolicyFromEnumData( @@ -204,7 +206,7 @@ FWFNSErrorData *FWFNSErrorDataFromNativeNSError(NSError *error) { } } } - return [FWFNSErrorData makeWithCode:@(error.code) domain:error.domain userInfo:userInfo]; + return [FWFNSErrorData makeWithCode:error.code domain:error.domain userInfo:userInfo]; } FWFNSKeyValueChangeKeyEnumData *FWFNSKeyValueChangeKeyEnumDataFromNativeNSKeyValueChangeKey( @@ -253,7 +255,7 @@ FWFWKNavigationType FWFWKNavigationTypeFromNativeWKNavigationType(WKNavigationTy FWFWKSecurityOriginData *FWFWKSecurityOriginDataFromNativeWKSecurityOrigin( WKSecurityOrigin *origin) { return [FWFWKSecurityOriginData makeWithHost:origin.host - port:@(origin.port) + port:origin.port protocol:origin.protocol]; } @@ -285,3 +287,36 @@ FWFWKMediaCaptureTypeData *FWFWKMediaCaptureTypeDataFromNativeWKMediaCaptureType return nil; } + +NSURLSessionAuthChallengeDisposition +FWFNativeNSURLSessionAuthChallengeDispositionFromFWFNSUrlSessionAuthChallengeDisposition( + FWFNSUrlSessionAuthChallengeDisposition value) { + switch (value) { + case FWFNSUrlSessionAuthChallengeDispositionUseCredential: + return NSURLSessionAuthChallengeUseCredential; + case FWFNSUrlSessionAuthChallengeDispositionPerformDefaultHandling: + return NSURLSessionAuthChallengePerformDefaultHandling; + case FWFNSUrlSessionAuthChallengeDispositionCancelAuthenticationChallenge: + return NSURLSessionAuthChallengeCancelAuthenticationChallenge; + case FWFNSUrlSessionAuthChallengeDispositionRejectProtectionSpace: + return NSURLSessionAuthChallengeRejectProtectionSpace; + } + + return -1; +} + +NSURLCredentialPersistence FWFNativeNSURLCredentialPersistenceFromFWFNSUrlCredentialPersistence( + FWFNSUrlCredentialPersistence value) { + switch (value) { + case FWFNSUrlCredentialPersistenceNone: + return NSURLCredentialPersistenceNone; + case FWFNSUrlCredentialPersistenceSession: + return NSURLCredentialPersistenceForSession; + case FWFNSUrlCredentialPersistencePermanent: + return NSURLCredentialPersistencePermanent; + case FWFNSUrlCredentialPersistenceSynchronizable: + return NSURLCredentialPersistenceSynchronizable; + } + + return -1; +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h index 5158dcd9689c4746286db98b42d650132365399e..3a0fa3021d2f6582aac78fe07987a8f4cf782a97 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -1,7 +1,7 @@ // Copyright 2013 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. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -24,6 +24,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumPriorNotification = 3, }; +/// Wrapper for FWFNSKeyValueObservingOptionsEnum to allow for nullability. +@interface FWFNSKeyValueObservingOptionsEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueObservingOptionsEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueObservingOptionsEnum)value; +@end + /// Mirror of NSKeyValueChange. /// /// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. @@ -34,6 +40,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeEnum) { FWFNSKeyValueChangeEnumReplacement = 3, }; +/// Wrapper for FWFNSKeyValueChangeEnum to allow for nullability. +@interface FWFNSKeyValueChangeEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueChangeEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueChangeEnum)value; +@end + /// Mirror of NSKeyValueChangeKey. /// /// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. @@ -46,6 +58,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeKeyEnum) { FWFNSKeyValueChangeKeyEnumUnknown = 5, }; +/// Wrapper for FWFNSKeyValueChangeKeyEnum to allow for nullability. +@interface FWFNSKeyValueChangeKeyEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueChangeKeyEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueChangeKeyEnum)value; +@end + /// Mirror of WKUserScriptInjectionTime. /// /// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. @@ -54,6 +72,12 @@ typedef NS_ENUM(NSUInteger, FWFWKUserScriptInjectionTimeEnum) { FWFWKUserScriptInjectionTimeEnumAtDocumentEnd = 1, }; +/// Wrapper for FWFWKUserScriptInjectionTimeEnum to allow for nullability. +@interface FWFWKUserScriptInjectionTimeEnumBox : NSObject +@property(nonatomic, assign) FWFWKUserScriptInjectionTimeEnum value; +- (instancetype)initWithValue:(FWFWKUserScriptInjectionTimeEnum)value; +@end + /// Mirror of WKAudiovisualMediaTypes. /// /// See @@ -65,6 +89,12 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumAll = 3, }; +/// Wrapper for FWFWKAudiovisualMediaTypeEnum to allow for nullability. +@interface FWFWKAudiovisualMediaTypeEnumBox : NSObject +@property(nonatomic, assign) FWFWKAudiovisualMediaTypeEnum value; +- (instancetype)initWithValue:(FWFWKAudiovisualMediaTypeEnum)value; +@end + /// Mirror of WKWebsiteDataTypes. /// /// See @@ -80,6 +110,12 @@ typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumIndexedDBDatabases = 7, }; +/// Wrapper for FWFWKWebsiteDataTypeEnum to allow for nullability. +@interface FWFWKWebsiteDataTypeEnumBox : NSObject +@property(nonatomic, assign) FWFWKWebsiteDataTypeEnum value; +- (instancetype)initWithValue:(FWFWKWebsiteDataTypeEnum)value; +@end + /// Mirror of WKNavigationActionPolicy. /// /// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. @@ -88,6 +124,12 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationActionPolicyEnum) { FWFWKNavigationActionPolicyEnumCancel = 1, }; +/// Wrapper for FWFWKNavigationActionPolicyEnum to allow for nullability. +@interface FWFWKNavigationActionPolicyEnumBox : NSObject +@property(nonatomic, assign) FWFWKNavigationActionPolicyEnum value; +- (instancetype)initWithValue:(FWFWKNavigationActionPolicyEnum)value; +@end + /// Mirror of NSHTTPCookiePropertyKey. /// /// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. @@ -108,6 +150,12 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { FWFNSHttpCookiePropertyKeyEnumVersion = 13, }; +/// Wrapper for FWFNSHttpCookiePropertyKeyEnum to allow for nullability. +@interface FWFNSHttpCookiePropertyKeyEnumBox : NSObject +@property(nonatomic, assign) FWFNSHttpCookiePropertyKeyEnum value; +- (instancetype)initWithValue:(FWFNSHttpCookiePropertyKeyEnum)value; +@end + /// An object that contains information about an action that causes navigation /// to occur. /// @@ -151,6 +199,12 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { FWFWKNavigationTypeUnknown = 6, }; +/// Wrapper for FWFWKNavigationType to allow for nullability. +@interface FWFWKNavigationTypeBox : NSObject +@property(nonatomic, assign) FWFWKNavigationType value; +- (instancetype)initWithValue:(FWFWKNavigationType)value; +@end + /// Possible permission decisions for device resource access. /// /// See https://developer.apple.com/documentation/webkit/wkpermissiondecision?language=objc. @@ -172,6 +226,12 @@ typedef NS_ENUM(NSUInteger, FWFWKPermissionDecision) { FWFWKPermissionDecisionPrompt = 2, }; +/// Wrapper for FWFWKPermissionDecision to allow for nullability. +@interface FWFWKPermissionDecisionBox : NSObject +@property(nonatomic, assign) FWFWKPermissionDecision value; +- (instancetype)initWithValue:(FWFWKPermissionDecision)value; +@end + /// List of the types of media devices that can capture audio, video, or both. /// /// See https://developer.apple.com/documentation/webkit/wkmediacapturetype?language=objc. @@ -198,6 +258,79 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { FWFWKMediaCaptureTypeUnknown = 3, }; +/// Wrapper for FWFWKMediaCaptureType to allow for nullability. +@interface FWFWKMediaCaptureTypeBox : NSObject +@property(nonatomic, assign) FWFWKMediaCaptureType value; +- (instancetype)initWithValue:(FWFWKMediaCaptureType)value; +@end + +/// Responses to an authentication challenge. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition?language=objc. +typedef NS_ENUM(NSUInteger, FWFNSUrlSessionAuthChallengeDisposition) { + /// Use the specified credential, which may be nil. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeusecredential?language=objc. + FWFNSUrlSessionAuthChallengeDispositionUseCredential = 0, + /// Use the default handling for the challenge as though this delegate method + /// were not implemented. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeperformdefaulthandling?language=objc. + FWFNSUrlSessionAuthChallengeDispositionPerformDefaultHandling = 1, + /// Cancel the entire request. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengecancelauthenticationchallenge?language=objc. + FWFNSUrlSessionAuthChallengeDispositionCancelAuthenticationChallenge = 2, + /// Reject this challenge, and call the authentication delegate method again + /// with the next authentication protection space. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengerejectprotectionspace?language=objc. + FWFNSUrlSessionAuthChallengeDispositionRejectProtectionSpace = 3, +}; + +/// Wrapper for FWFNSUrlSessionAuthChallengeDisposition to allow for nullability. +@interface FWFNSUrlSessionAuthChallengeDispositionBox : NSObject +@property(nonatomic, assign) FWFNSUrlSessionAuthChallengeDisposition value; +- (instancetype)initWithValue:(FWFNSUrlSessionAuthChallengeDisposition)value; +@end + +/// Specifies how long a credential will be kept. +typedef NS_ENUM(NSUInteger, FWFNSUrlCredentialPersistence) { + /// The credential should not be stored. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencenone?language=objc. + FWFNSUrlCredentialPersistenceNone = 0, + /// The credential should be stored only for this session. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistenceforsession?language=objc. + FWFNSUrlCredentialPersistenceSession = 1, + /// The credential should be stored in the keychain. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencepermanent?language=objc. + FWFNSUrlCredentialPersistencePermanent = 2, + /// The credential should be stored permanently in the keychain, and in + /// addition should be distributed to other devices based on the owning Apple + /// ID. + /// + /// See + /// https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencesynchronizable?language=objc. + FWFNSUrlCredentialPersistenceSynchronizable = 3, +}; + +/// Wrapper for FWFNSUrlCredentialPersistence to allow for nullability. +@interface FWFNSUrlCredentialPersistenceBox : NSObject +@property(nonatomic, assign) FWFNSUrlCredentialPersistence value; +- (instancetype)initWithValue:(FWFNSUrlCredentialPersistence)value; +@end + @class FWFNSKeyValueObservingOptionsEnumData; @class FWFNSKeyValueChangeKeyEnumData; @class FWFWKUserScriptInjectionTimeEnumData; @@ -216,6 +349,7 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @class FWFWKSecurityOriginData; @class FWFNSHttpCookieData; @class FWFObjectOrIdentifier; +@class FWFAuthenticationChallengeResponse; @interface FWFNSKeyValueObservingOptionsEnumData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. @@ -293,7 +427,7 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @property(nonatomic, copy) NSString *url; @property(nonatomic, copy, nullable) NSString *httpMethod; @property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; +@property(nonatomic, copy) NSDictionary *allHttpHeaderFields; @end /// Mirror of WKUserScript. @@ -304,10 +438,10 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; + isMainFrameOnly:(BOOL)isMainFrameOnly; @property(nonatomic, copy) NSString *source; @property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; +@property(nonatomic, assign) BOOL isMainFrameOnly; @end /// Mirror of WKNavigationAction. @@ -330,8 +464,9 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKFrameInfoData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber *isMainFrame; ++ (instancetype)makeWithIsMainFrame:(BOOL)isMainFrame request:(FWFNSUrlRequestData *)request; +@property(nonatomic, assign) BOOL isMainFrame; +@property(nonatomic, strong) FWFNSUrlRequestData *request; @end /// Mirror of NSError. @@ -340,12 +475,12 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFNSErrorData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithCode:(NSNumber *)code ++ (instancetype)makeWithCode:(NSInteger)code domain:(NSString *)domain userInfo:(nullable NSDictionary *)userInfo; -@property(nonatomic, strong) NSNumber *code; +@property(nonatomic, assign) NSInteger code; @property(nonatomic, copy) NSString *domain; -@property(nonatomic, strong, nullable) NSDictionary *userInfo; +@property(nonatomic, copy, nullable) NSDictionary *userInfo; @end /// Mirror of WKScriptMessage. @@ -354,9 +489,9 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name body:(id)body; ++ (instancetype)makeWithName:(NSString *)name body:(nullable id)body; @property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) id body; +@property(nonatomic, strong, nullable) id body; @end /// Mirror of WKSecurityOrigin. @@ -365,9 +500,9 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKSecurityOriginData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithHost:(NSString *)host port:(NSNumber *)port protocol:(NSString *)protocol; ++ (instancetype)makeWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol; @property(nonatomic, copy) NSString *host; -@property(nonatomic, strong) NSNumber *port; +@property(nonatomic, assign) NSInteger port; @property(nonatomic, copy) NSString *protocol; @end @@ -379,8 +514,8 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray *propertyKeys; -@property(nonatomic, strong) NSArray *propertyValues; +@property(nonatomic, copy) NSArray *propertyKeys; +@property(nonatomic, copy) NSArray *propertyValues; @end /// An object that can represent either a value supported by @@ -389,11 +524,20 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFObjectOrIdentifier : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier; -@property(nonatomic, strong) id value; ++ (instancetype)makeWithValue:(nullable id)value isIdentifier:(BOOL)isIdentifier; +@property(nonatomic, strong, nullable) id value; /// Whether value is an int that is used to retrieve an instance stored in an /// `InstanceManager`. -@property(nonatomic, strong) NSNumber *isIdentifier; +@property(nonatomic, assign) BOOL isIdentifier; +@end + +@interface FWFAuthenticationChallengeResponse : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)makeWithDisposition:(FWFNSUrlSessionAuthChallengeDisposition)disposition + credentialIdentifier:(nullable NSNumber *)credentialIdentifier; +@property(nonatomic, assign) FWFNSUrlSessionAuthChallengeDisposition disposition; +@property(nonatomic, strong, nullable) NSNumber *credentialIdentifier; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. @@ -403,19 +547,19 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier +- (void)createDefaultDataStoreWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier +- (void)removeDataFromDataStoreWithIdentifier:(NSInteger)identifier ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch + modifiedSince:(double)modificationTimeInSecondsSinceEpoch completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( +extern void SetUpFWFWKWebsiteDataStoreHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -426,15 +570,15 @@ NSObject *FWFUIViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier +- (void)setBackgroundColorForViewWithIdentifier:(NSInteger)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier - isOpaque:(NSNumber *)opaque +- (void)setOpaqueForViewWithIdentifier:(NSInteger)identifier + isOpaque:(BOOL)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFUIViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. @@ -444,24 +588,27 @@ NSObject *FWFUIScrollViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. - (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + contentOffsetForScrollViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier - x:(NSNumber *)x - y:(NSNumber *)y +- (void)scrollByForScrollViewWithIdentifier:(NSInteger)identifier + x:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - toX:(NSNumber *)x - y:(NSNumber *)y +- (void)setContentOffsetForScrollViewWithIdentifier:(NSInteger)identifier + toX:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDelegateForScrollViewWithIdentifier:(NSInteger)identifier + uiScrollViewDelegateIdentifier:(nullable NSNumber *)uiScrollViewDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFUIScrollViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. @@ -471,21 +618,21 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @protocol FWFWKWebViewConfigurationHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error: (FlutterError *_Nullable *_Nonnull) error; -- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSNumber *)identifier - isLimited:(NSNumber *)limit +- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSInteger)identifier + isLimited:(BOOL)limit error:(FlutterError *_Nullable *_Nonnull)error; - (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSInteger)identifier forTypes: (NSArray< FWFWKAudiovisualMediaTypeEnumData @@ -495,7 +642,7 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( +extern void SetUpFWFWKWebViewConfigurationHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -507,7 +654,7 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end @@ -518,29 +665,29 @@ NSObject *FWFWKUserContentControllerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - handlerIdentifier:(NSNumber *)handlerIdentifier +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier + handlerIdentifier:(NSInteger)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull) error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull) error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier +- (void)addUserScriptForControllerWithIdentifier:(NSInteger)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( +extern void SetUpFWFWKUserContentControllerHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -551,15 +698,15 @@ NSObject *FWFWKPreferencesHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier - isEnabled:(NSNumber *)enabled +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSInteger)identifier + isEnabled:(BOOL)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKPreferencesHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. @@ -569,10 +716,10 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @protocol FWFWKScriptMessageHandlerHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( +extern void SetUpFWFWKScriptMessageHandlerHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -584,8 +731,8 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier - userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSInteger)identifier + userContentControllerIdentifier:(NSInteger)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion: (void (^)(FlutterError *_Nullable))completion; @@ -598,10 +745,10 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @protocol FWFWKNavigationDelegateHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( +extern void SetUpFWFWKNavigationDelegateHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -613,38 +760,46 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFinishNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier URL:(nullable NSString *)url completion:(void (^)(FlutterError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier URL:(nullable NSString *)url completion:(void (^)(FlutterError *_Nullable)) completion; - (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier navigationAction: (FWFWKNavigationActionData *)navigationAction completion: (void (^)(FWFWKNavigationActionPolicyEnumData *_Nullable, FlutterError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFailNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FWFNSErrorData *)error completion:(void (^)(FlutterError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FWFNSErrorData *)error completion:(void (^)(FlutterError *_Nullable)) completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier completion: (void (^)(FlutterError *_Nullable)) completion; +- (void)didReceiveAuthenticationChallengeForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier + challengeIdentifier:(NSInteger)challengeIdentifier + completion: + (void (^)( + FWFAuthenticationChallengeResponse + *_Nullable, + FlutterError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. @@ -654,21 +809,21 @@ NSObject *FWFNSObjectHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/objectivec/nsobject. @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier +- (void)addObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observerIdentifier keyPath:(NSString *)keyPath options: (NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier +- (void)removeObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, +extern void SetUpFWFNSObjectHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. @@ -679,13 +834,13 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/objectivec/nsobject. @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier +- (void)observeValueForObjectWithIdentifier:(NSInteger)identifier keyPath:(NSString *)keyPath - objectIdentifier:(NSNumber *)objectIdentifier + objectIdentifier:(NSInteger)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void (^)(FlutterError *_Nullable))completion; -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end @@ -696,67 +851,70 @@ NSObject *FWFWKWebViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setUIDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier: (nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)URLForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull) error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadRequestForWebViewWithIdentifier:(NSInteger)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadHTMLForWebViewWithIdentifier:(NSInteger)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadFileForWebViewWithIdentifier:(NSInteger)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadAssetForWebViewWithIdentifier:(NSInteger)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier +- (void)goBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier +- (void)goForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier +- (void)reloadWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)titleForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setCustomUserAgentForWebViewWithIdentifier:(NSInteger)identifier + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSInteger)identifier javaScriptString:(NSString *)javaScriptString completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -- (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier - inspectable:(NSNumber *)inspectable +- (void)setInspectableForWebViewWithIdentifier:(NSInteger)identifier + inspectable:(BOOL)inspectable error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)customUserAgentForWebViewWithIdentifier:(NSInteger)identifier + error:(FlutterError *_Nullable *_Nonnull) + error; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKWebViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. @@ -766,10 +924,10 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @protocol FWFWKUIDelegateHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKUIDelegateHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. @@ -780,14 +938,14 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)onCreateWebViewForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier + configurationIdentifier:(NSInteger)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void (^)(FlutterError *_Nullable))completion; /// Callback to Dart function `WKUIDelegate.requestMediaCapturePermission`. -- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier origin:(FWFWKSecurityOriginData *)origin frame:(FWFWKFrameInfoData *)frame type:(FWFWKMediaCaptureTypeData *)type @@ -795,6 +953,27 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); (void (^)( FWFWKPermissionDecisionData *_Nullable, FlutterError *_Nullable))completion; +/// Callback to Dart function `WKUIDelegate.runJavaScriptAlertPanel`. +- (void)runJavaScriptAlertPanelForDelegateWithIdentifier:(NSInteger)identifier + message:(NSString *)message + frame:(FWFWKFrameInfoData *)frame + completion: + (void (^)(FlutterError *_Nullable))completion; +/// Callback to Dart function `WKUIDelegate.runJavaScriptConfirmPanel`. +- (void)runJavaScriptConfirmPanelForDelegateWithIdentifier:(NSInteger)identifier + message:(NSString *)message + frame:(FWFWKFrameInfoData *)frame + completion: + (void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; +/// Callback to Dart function `WKUIDelegate.runJavaScriptTextInputPanel`. +- (void)runJavaScriptTextInputPanelForDelegateWithIdentifier:(NSInteger)identifier + prompt:(NSString *)prompt + defaultText:(NSString *)defaultText + frame:(FWFWKFrameInfoData *)frame + completion: + (void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; @end /// The codec used by FWFWKHttpCookieStoreHostApi. @@ -804,15 +983,15 @@ NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier - dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier +- (void)createFromWebsiteDataStoreWithIdentifier:(NSInteger)identifier + dataStoreIdentifier:(NSInteger)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier +- (void)setCookieForStoreWithIdentifier:(NSInteger)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKHttpCookieStoreHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSUrlHostApi. @@ -826,12 +1005,12 @@ NSObject *FWFNSUrlHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @protocol FWFNSUrlHostApi -- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSUrlHostApiSetup(id binaryMessenger, +extern void SetUpFWFNSUrlHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSUrlFlutterApi. @@ -846,8 +1025,102 @@ NSObject *FWFNSUrlFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @interface FWFNSUrlFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end +/// The codec used by FWFUIScrollViewDelegateHostApi. +NSObject *FWFUIScrollViewDelegateHostApiGetCodec(void); + +/// Host API for `UIScrollViewDelegate`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +@protocol FWFUIScrollViewDelegateHostApi +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void SetUpFWFUIScrollViewDelegateHostApi( + id binaryMessenger, + NSObject *_Nullable api); + +/// The codec used by FWFUIScrollViewDelegateFlutterApi. +NSObject *FWFUIScrollViewDelegateFlutterApiGetCodec(void); + +/// Flutter API for `UIScrollViewDelegate`. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +@interface FWFUIScrollViewDelegateFlutterApi : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +- (void)scrollViewDidScrollWithIdentifier:(NSInteger)identifier + UIScrollViewIdentifier:(NSInteger)uiScrollViewIdentifier + x:(double)x + y:(double)y + completion:(void (^)(FlutterError *_Nullable))completion; +@end + +/// The codec used by FWFNSUrlCredentialHostApi. +NSObject *FWFNSUrlCredentialHostApiGetCodec(void); + +/// Host API for `NSUrlCredential`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlcredential?language=objc. +@protocol FWFNSUrlCredentialHostApi +/// Create a new native instance and add it to the `InstanceManager`. +- (void)createWithUserWithIdentifier:(NSInteger)identifier + user:(NSString *)user + password:(NSString *)password + persistence:(FWFNSUrlCredentialPersistence)persistence + error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void SetUpFWFNSUrlCredentialHostApi(id binaryMessenger, + NSObject *_Nullable api); + +/// The codec used by FWFNSUrlProtectionSpaceFlutterApi. +NSObject *FWFNSUrlProtectionSpaceFlutterApiGetCodec(void); + +/// Flutter API for `NSUrlProtectionSpace`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlprotectionspace?language=objc. +@interface FWFNSUrlProtectionSpaceFlutterApi : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +/// Create a new Dart instance and add it to the `InstanceManager`. +- (void)createWithIdentifier:(NSInteger)identifier + host:(nullable NSString *)host + realm:(nullable NSString *)realm + authenticationMethod:(nullable NSString *)authenticationMethod + completion:(void (^)(FlutterError *_Nullable))completion; +@end + +/// The codec used by FWFNSUrlAuthenticationChallengeFlutterApi. +NSObject *FWFNSUrlAuthenticationChallengeFlutterApiGetCodec(void); + +/// Flutter API for `NSUrlAuthenticationChallenge`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nsurlauthenticationchallenge?language=objc. +@interface FWFNSUrlAuthenticationChallengeFlutterApi : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +/// Create a new Dart instance and add it to the `InstanceManager`. +- (void)createWithIdentifier:(NSInteger)identifier + protectionSpaceIdentifier:(NSInteger)protectionSpaceIdentifier + completion:(void (^)(FlutterError *_Nullable))completion; +@end + NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index d8d4e2972eeba16b2c6079af77b61e1e4ab861cd..450efd648313e07c00e3cc72a0dbdd1a1e9174ad 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -1,7 +1,7 @@ // Copyright 2013 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. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "FWFGeneratedWebKitApis.h" @@ -24,11 +24,194 @@ static NSArray *wrapResult(id result, FlutterError *error) { } return @[ result ?: [NSNull null] ]; } + +static FlutterError *createConnectionError(NSString *channelName) { + return [FlutterError + errorWithCode:@"channel-error" + message:[NSString stringWithFormat:@"%@/%@/%@", + @"Unable to establish connection on channel: '", + channelName, @"'."] + details:@""]; +} + static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } +/// Mirror of NSKeyValueObservingOptions. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. +@implementation FWFNSKeyValueObservingOptionsEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueObservingOptionsEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSKeyValueChange. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. +@implementation FWFNSKeyValueChangeEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueChangeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSKeyValueChangeKey. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. +@implementation FWFNSKeyValueChangeKeyEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueChangeKeyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKUserScriptInjectionTime. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. +@implementation FWFWKUserScriptInjectionTimeEnumBox +- (instancetype)initWithValue:(FWFWKUserScriptInjectionTimeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKAudiovisualMediaTypes. +/// +/// See +/// [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). +@implementation FWFWKAudiovisualMediaTypeEnumBox +- (instancetype)initWithValue:(FWFWKAudiovisualMediaTypeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKWebsiteDataTypes. +/// +/// See +/// https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. +@implementation FWFWKWebsiteDataTypeEnumBox +- (instancetype)initWithValue:(FWFWKWebsiteDataTypeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKNavigationActionPolicy. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. +@implementation FWFWKNavigationActionPolicyEnumBox +- (instancetype)initWithValue:(FWFWKNavigationActionPolicyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSHTTPCookiePropertyKey. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. +@implementation FWFNSHttpCookiePropertyKeyEnumBox +- (instancetype)initWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// An object that contains information about an action that causes navigation +/// to occur. +/// +/// Wraps +/// [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +@implementation FWFWKNavigationTypeBox +- (instancetype)initWithValue:(FWFWKNavigationType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Possible permission decisions for device resource access. +/// +/// See https://developer.apple.com/documentation/webkit/wkpermissiondecision?language=objc. +@implementation FWFWKPermissionDecisionBox +- (instancetype)initWithValue:(FWFWKPermissionDecision)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// List of the types of media devices that can capture audio, video, or both. +/// +/// See https://developer.apple.com/documentation/webkit/wkmediacapturetype?language=objc. +@implementation FWFWKMediaCaptureTypeBox +- (instancetype)initWithValue:(FWFWKMediaCaptureType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Responses to an authentication challenge. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition?language=objc. +@implementation FWFNSUrlSessionAuthChallengeDispositionBox +- (instancetype)initWithValue:(FWFNSUrlSessionAuthChallengeDisposition)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Specifies how long a credential will be kept. +@implementation FWFNSUrlCredentialPersistenceBox +- (instancetype)initWithValue:(FWFNSUrlCredentialPersistence)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list; + (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list; @@ -137,6 +320,12 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { - (NSArray *)toList; @end +@interface FWFAuthenticationChallengeResponse () ++ (FWFAuthenticationChallengeResponse *)fromList:(NSArray *)list; ++ (nullable FWFAuthenticationChallengeResponse *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; +@end + @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { FWFNSKeyValueObservingOptionsEnumData *pigeonResult = @@ -351,11 +540,9 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFNSUrlRequestData *)fromList:(NSArray *)list { FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.url != nil, @""); pigeonResult.httpMethod = GetNullableObjectAtIndex(list, 1); pigeonResult.httpBody = GetNullableObjectAtIndex(list, 2); pigeonResult.allHttpHeaderFields = GetNullableObjectAtIndex(list, 3); - NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } + (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { @@ -363,10 +550,10 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.url ?: [NSNull null]), - (self.httpMethod ?: [NSNull null]), - (self.httpBody ?: [NSNull null]), - (self.allHttpHeaderFields ?: [NSNull null]), + self.url ?: [NSNull null], + self.httpMethod ?: [NSNull null], + self.httpBody ?: [NSNull null], + self.allHttpHeaderFields ?: [NSNull null], ]; } @end @@ -374,7 +561,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { + isMainFrameOnly:(BOOL)isMainFrameOnly { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; @@ -384,11 +571,9 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFWKUserScriptData *)fromList:(NSArray *)list { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.source != nil, @""); pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; - pigeonResult.isMainFrameOnly = GetNullableObjectAtIndex(list, 2); - NSAssert(pigeonResult.isMainFrameOnly != nil, @""); + pigeonResult.isMainFrameOnly = [GetNullableObjectAtIndex(list, 2) boolValue]; return pigeonResult; } + (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { @@ -396,9 +581,9 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.source ?: [NSNull null]), + self.source ?: [NSNull null], (self.injectionTime ? [self.injectionTime toList] : [NSNull null]), - (self.isMainFrameOnly ?: [NSNull null]), + @(self.isMainFrameOnly), ]; } @end @@ -416,10 +601,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFWKNavigationActionData *)fromList:(NSArray *)list { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 0))]; - NSAssert(pigeonResult.request != nil, @""); pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; - NSAssert(pigeonResult.targetFrame != nil, @""); pigeonResult.navigationType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } @@ -436,15 +619,16 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @end @implementation FWFWKFrameInfoData -+ (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { ++ (instancetype)makeWithIsMainFrame:(BOOL)isMainFrame request:(FWFNSUrlRequestData *)request { FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; + pigeonResult.request = request; return pigeonResult; } + (FWFWKFrameInfoData *)fromList:(NSArray *)list { FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; - pigeonResult.isMainFrame = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.isMainFrame != nil, @""); + pigeonResult.isMainFrame = [GetNullableObjectAtIndex(list, 0) boolValue]; + pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; return pigeonResult; } + (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { @@ -452,13 +636,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.isMainFrame ?: [NSNull null]), + @(self.isMainFrame), + (self.request ? [self.request toList] : [NSNull null]), ]; } @end @implementation FWFNSErrorData -+ (instancetype)makeWithCode:(NSNumber *)code ++ (instancetype)makeWithCode:(NSInteger)code domain:(NSString *)domain userInfo:(nullable NSDictionary *)userInfo { FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; @@ -469,10 +654,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } + (FWFNSErrorData *)fromList:(NSArray *)list { FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; - pigeonResult.code = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.code != nil, @""); + pigeonResult.code = [GetNullableObjectAtIndex(list, 0) integerValue]; pigeonResult.domain = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.domain != nil, @""); pigeonResult.userInfo = GetNullableObjectAtIndex(list, 2); return pigeonResult; } @@ -481,15 +664,15 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.code ?: [NSNull null]), - (self.domain ?: [NSNull null]), - (self.userInfo ?: [NSNull null]), + @(self.code), + self.domain ?: [NSNull null], + self.userInfo ?: [NSNull null], ]; } @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name body:(id)body { ++ (instancetype)makeWithName:(NSString *)name body:(nullable id)body { FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; @@ -498,7 +681,6 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFWKScriptMessageData *)fromList:(NSArray *)list { FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.name != nil, @""); pigeonResult.body = GetNullableObjectAtIndex(list, 1); return pigeonResult; } @@ -507,14 +689,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.name ?: [NSNull null]), - (self.body ?: [NSNull null]), + self.name ?: [NSNull null], + self.body ?: [NSNull null], ]; } @end @implementation FWFWKSecurityOriginData -+ (instancetype)makeWithHost:(NSString *)host port:(NSNumber *)port protocol:(NSString *)protocol { ++ (instancetype)makeWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol { FWFWKSecurityOriginData *pigeonResult = [[FWFWKSecurityOriginData alloc] init]; pigeonResult.host = host; pigeonResult.port = port; @@ -524,11 +706,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFWKSecurityOriginData *)fromList:(NSArray *)list { FWFWKSecurityOriginData *pigeonResult = [[FWFWKSecurityOriginData alloc] init]; pigeonResult.host = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.host != nil, @""); - pigeonResult.port = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.port != nil, @""); + pigeonResult.port = [GetNullableObjectAtIndex(list, 1) integerValue]; pigeonResult.protocol = GetNullableObjectAtIndex(list, 2); - NSAssert(pigeonResult.protocol != nil, @""); return pigeonResult; } + (nullable FWFWKSecurityOriginData *)nullableFromList:(NSArray *)list { @@ -536,9 +715,9 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.host ?: [NSNull null]), - (self.port ?: [NSNull null]), - (self.protocol ?: [NSNull null]), + self.host ?: [NSNull null], + @(self.port), + self.protocol ?: [NSNull null], ]; } @end @@ -554,9 +733,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFNSHttpCookieData *)fromList:(NSArray *)list { FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.propertyKeys != nil, @""); pigeonResult.propertyValues = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } + (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list { @@ -564,14 +741,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.propertyKeys ?: [NSNull null]), - (self.propertyValues ?: [NSNull null]), + self.propertyKeys ?: [NSNull null], + self.propertyValues ?: [NSNull null], ]; } @end @implementation FWFObjectOrIdentifier -+ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier { ++ (instancetype)makeWithValue:(nullable id)value isIdentifier:(BOOL)isIdentifier { FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init]; pigeonResult.value = value; pigeonResult.isIdentifier = isIdentifier; @@ -580,8 +757,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + (FWFObjectOrIdentifier *)fromList:(NSArray *)list { FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init]; pigeonResult.value = GetNullableObjectAtIndex(list, 0); - pigeonResult.isIdentifier = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.isIdentifier != nil, @""); + pigeonResult.isIdentifier = [GetNullableObjectAtIndex(list, 1) boolValue]; return pigeonResult; } + (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list { @@ -589,8 +765,35 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } - (NSArray *)toList { return @[ - (self.value ?: [NSNull null]), - (self.isIdentifier ?: [NSNull null]), + self.value ?: [NSNull null], + @(self.isIdentifier), + ]; +} +@end + +@implementation FWFAuthenticationChallengeResponse ++ (instancetype)makeWithDisposition:(FWFNSUrlSessionAuthChallengeDisposition)disposition + credentialIdentifier:(nullable NSNumber *)credentialIdentifier { + FWFAuthenticationChallengeResponse *pigeonResult = + [[FWFAuthenticationChallengeResponse alloc] init]; + pigeonResult.disposition = disposition; + pigeonResult.credentialIdentifier = credentialIdentifier; + return pigeonResult; +} ++ (FWFAuthenticationChallengeResponse *)fromList:(NSArray *)list { + FWFAuthenticationChallengeResponse *pigeonResult = + [[FWFAuthenticationChallengeResponse alloc] init]; + pigeonResult.disposition = [GetNullableObjectAtIndex(list, 0) integerValue]; + pigeonResult.credentialIdentifier = GetNullableObjectAtIndex(list, 1); + return pigeonResult; +} ++ (nullable FWFAuthenticationChallengeResponse *)nullableFromList:(NSArray *)list { + return (list) ? [FWFAuthenticationChallengeResponse fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + @(self.disposition), + self.credentialIdentifier ?: [NSNull null], ]; } @end @@ -643,7 +846,7 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void) { return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, +void SetUpFWFWKWebsiteDataStoreHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -660,8 +863,8 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -685,7 +888,7 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -709,9 +912,10 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); + double arg_modificationTimeInSecondsSinceEpoch = + [GetNullableObjectAtIndex(args, 2) doubleValue]; [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch @@ -731,7 +935,7 @@ NSObject *FWFUIViewHostApiGetCodec(void) { return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, +void SetUpFWFUIViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -747,7 +951,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_value = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; @@ -769,8 +973,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_opaque = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_opaque = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); @@ -786,7 +990,7 @@ NSObject *FWFUIScrollViewHostApiGetCodec(void) { return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, +void SetUpFWFUIScrollViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -802,8 +1006,8 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_webViewIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier @@ -827,7 +1031,7 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; @@ -849,9 +1053,9 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + double arg_x = [GetNullableObjectAtIndex(args, 1) doubleValue]; + double arg_y = [GetNullableObjectAtIndex(args, 2) doubleValue]; FlutterError *error; [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); @@ -874,9 +1078,9 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + double arg_x = [GetNullableObjectAtIndex(args, 1) doubleValue]; + double arg_y = [GetNullableObjectAtIndex(args, 2) doubleValue]; FlutterError *error; [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x @@ -888,6 +1092,33 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setDelegate" + binaryMessenger:binaryMessenger + codec:FWFUIScrollViewHostApiGetCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(setDelegateForScrollViewWithIdentifier: + uiScrollViewDelegateIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setDelegateForScrollViewWithIdentifier:uiScrollViewDelegateIdentifier:" + @"error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSNumber *arg_uiScrollViewDelegateIdentifier = GetNullableObjectAtIndex(args, 1); + FlutterError *error; + [api setDelegateForScrollViewWithIdentifier:arg_identifier + uiScrollViewDelegateIdentifier:arg_uiScrollViewDelegateIdentifier + error:&error]; + callback(wrapResult(nil, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } } @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @@ -937,7 +1168,7 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void) { return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, +void SetUpFWFWKWebViewConfigurationHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -952,7 +1183,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -975,8 +1206,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_webViewIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier @@ -1002,8 +1233,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_allow = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow @@ -1030,8 +1261,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_limit = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_limit = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:arg_identifier isLimited:arg_limit @@ -1058,7 +1289,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier @@ -1090,16 +1321,27 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier +- (void)createWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationFlutterApi.create"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationFlutterApi.create" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } @end @@ -1157,7 +1399,7 @@ NSObject *FWFWKUserContentControllerHostApiGetCodec(void) { return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, +void SetUpFWFWKUserContentControllerHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1174,8 +1416,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -1202,8 +1444,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_handlerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier @@ -1230,7 +1472,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier @@ -1256,7 +1498,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1279,7 +1521,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api addUserScriptForControllerWithIdentifier:arg_identifier @@ -1305,7 +1547,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1321,7 +1563,7 @@ NSObject *FWFWKPreferencesHostApiGetCodec(void) { return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, +void SetUpFWFWKPreferencesHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1338,8 +1580,8 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -1364,8 +1606,8 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled @@ -1383,7 +1625,7 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void) { return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, +void SetUpFWFWKScriptMessageHandlerHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1398,7 +1640,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1470,21 +1712,31 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) return self; } - (void) - didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier - userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier + didReceiveScriptMessageForHandlerWithIdentifier:(NSInteger)arg_identifier + userContentControllerIdentifier:(NSInteger)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], - arg_message ?: [NSNull null] + @(arg_identifier), @(arg_userContentControllerIdentifier), arg_message ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } @end @@ -1495,7 +1747,7 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void) { return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, +void SetUpFWFWKNavigationDelegateHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1510,7 +1762,7 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1526,14 +1778,16 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSErrorData fromList:[self readValue]]; + return [FWFAuthenticationChallengeResponse fromList:[self readValue]]; case 129: - return [FWFNSUrlRequestData fromList:[self readValue]]; + return [FWFNSErrorData fromList:[self readValue]]; case 130: - return [FWFWKFrameInfoData fromList:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 131: - return [FWFWKNavigationActionData fromList:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 132: + return [FWFWKNavigationActionData fromList:[self readValue]]; + case 133: return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1545,21 +1799,24 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen @end @implementation FWFWKNavigationDelegateFlutterApiCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[FWFNSErrorData class]]) { + if ([value isKindOfClass:[FWFAuthenticationChallengeResponse class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + [self writeByte:133]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1601,43 +1858,59 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void) { } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didFinishNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.didFinishNavigation"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.didFinishNavigation" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_url ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void (^)(FlutterError *_Nullable)) completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.didStartProvisionalNavigation"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_url ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *) arg_navigationAction completion: @@ -1645,69 +1918,139 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void) { FWFWKNavigationActionPolicyEnumData *_Nullable, FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_navigationAction ?: [NSNull null] + @(arg_identifier), @(arg_webViewIdentifier), arg_navigationAction ?: [NSNull null] ] - reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FWFWKNavigationActionPolicyEnumData *output = + reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } }]; } -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didFailNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.didFailNavigation"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.didFailNavigation" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_error ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void (^)(FlutterError *_Nullable)) completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.didFailProvisionalNavigation"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_error ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSInteger)arg_identifier webViewIdentifier: - (NSNumber *)arg_webViewIdentifier + (NSInteger)arg_webViewIdentifier completion: (void (^)(FlutterError *_Nullable)) completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate"; + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; +} +- (void) + didReceiveAuthenticationChallengeForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier + challengeIdentifier:(NSInteger)arg_challengeIdentifier + completion: + (void (^)(FWFAuthenticationChallengeResponse + *_Nullable, + FlutterError *_Nullable)) + completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview." - @"WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + [channel sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), @(arg_challengeIdentifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FWFAuthenticationChallengeResponse *output = + reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } }]; } @end @@ -1760,7 +2103,7 @@ NSObject *FWFNSObjectHostApiGetCodec(void) { return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, +void SetUpFWFNSObjectHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1774,7 +2117,7 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1798,8 +2141,8 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_observerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); NSArray *arg_options = GetNullableObjectAtIndex(args, 3); @@ -1830,8 +2173,8 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_observerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; [api removeObserverForObjectWithIdentifier:arg_identifier @@ -1911,37 +2254,58 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void) { } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier +- (void)observeValueForObjectWithIdentifier:(NSInteger)arg_identifier keyPath:(NSString *)arg_keyPath - objectIdentifier:(NSNumber *)arg_objectIdentifier + objectIdentifier:(NSInteger)arg_objectIdentifier changeKeys: (NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues completion:(void (^)(FlutterError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.observeValue" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.observeValue"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], - arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], - arg_changeValues ?: [NSNull null] + @(arg_identifier), arg_keyPath ?: [NSNull null], @(arg_objectIdentifier), + arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier +- (void)disposeObjectWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.dispose"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } @end @@ -1952,40 +2316,42 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void) { - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSErrorData fromList:[self readValue]]; + return [FWFAuthenticationChallengeResponse fromList:[self readValue]]; case 129: - return [FWFNSHttpCookieData fromList:[self readValue]]; + return [FWFNSErrorData fromList:[self readValue]]; case 130: - return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; + return [FWFNSHttpCookieData fromList:[self readValue]]; case 131: - return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; + return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; case 132: - return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; + return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; case 133: - return [FWFNSUrlRequestData fromList:[self readValue]]; + return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; case 134: - return [FWFObjectOrIdentifier fromList:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 135: - return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; + return [FWFObjectOrIdentifier fromList:[self readValue]]; case 136: - return [FWFWKFrameInfoData fromList:[self readValue]]; + return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; case 137: - return [FWFWKMediaCaptureTypeData fromList:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 138: - return [FWFWKNavigationActionData fromList:[self readValue]]; + return [FWFWKMediaCaptureTypeData fromList:[self readValue]]; case 139: - return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; + return [FWFWKNavigationActionData fromList:[self readValue]]; case 140: - return [FWFWKPermissionDecisionData fromList:[self readValue]]; + return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; case 141: - return [FWFWKScriptMessageData fromList:[self readValue]]; + return [FWFWKPermissionDecisionData fromList:[self readValue]]; case 142: - return [FWFWKSecurityOriginData fromList:[self readValue]]; + return [FWFWKScriptMessageData fromList:[self readValue]]; case 143: - return [FWFWKUserScriptData fromList:[self readValue]]; + return [FWFWKSecurityOriginData fromList:[self readValue]]; case 144: - return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; + return [FWFWKUserScriptData fromList:[self readValue]]; case 145: + return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; + case 146: return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1997,60 +2363,63 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void) { @end @implementation FWFWKWebViewHostApiCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[FWFNSErrorData class]]) { + if ([value isKindOfClass:[FWFAuthenticationChallengeResponse class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:133]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:134]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { [self writeByte:135]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:136]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKMediaCaptureTypeData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:137]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKMediaCaptureTypeData class]]) { [self writeByte:138]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:139]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKPermissionDecisionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:140]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else if ([value isKindOfClass:[FWFWKPermissionDecisionData class]]) { [self writeByte:141]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKSecurityOriginData class]]) { + } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:142]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKSecurityOriginData class]]) { [self writeByte:143]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:144]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:145]; [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + [self writeByte:146]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -2079,7 +2448,7 @@ NSObject *FWFWKWebViewHostApiGetCodec(void) { return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, +void SetUpFWFWKWebViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2094,8 +2463,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -2120,7 +2489,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setUIDelegateForWebViewWithIdentifier:arg_identifier @@ -2147,7 +2516,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier @@ -2171,7 +2540,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2194,7 +2563,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; @@ -2217,7 +2586,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFNSUrlRequestData *arg_request = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; @@ -2241,7 +2610,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; @@ -2268,7 +2637,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; @@ -2296,7 +2665,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_key = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; @@ -2318,7 +2687,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2340,7 +2709,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2361,7 +2730,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2382,7 +2751,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2403,7 +2772,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2424,7 +2793,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2447,8 +2816,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_allow = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow @@ -2466,19 +2835,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, binaryMessenger:binaryMessenger codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], + NSCAssert([api respondsToSelector:@selector + (setCustomUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + @"@selector(setCustomUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_identifier - userAgent:arg_userAgent - error:&error]; + [api setCustomUserAgentForWebViewWithIdentifier:arg_identifier + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; } else { @@ -2500,7 +2869,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString @@ -2527,8 +2896,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_inspectable = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_inspectable = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setInspectableForWebViewWithIdentifier:arg_identifier inspectable:arg_inspectable @@ -2539,6 +2908,29 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent" + binaryMessenger:binaryMessenger + codec:FWFWKWebViewHostApiGetCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(customUserAgentForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(customUserAgentForWebViewWithIdentifier:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + FlutterError *error; + NSString *output = [api customUserAgentForWebViewWithIdentifier:arg_identifier + error:&error]; + callback(wrapResult(output, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } } NSObject *FWFWKUIDelegateHostApiGetCodec(void) { static FlutterStandardMessageCodec *sSharedObject = nil; @@ -2546,7 +2938,7 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void) { return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, +void SetUpFWFWKUIDelegateHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2560,7 +2952,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2656,26 +3048,37 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void) { } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - configurationIdentifier:(NSNumber *)arg_configurationIdentifier +- (void)onCreateWebViewForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier + configurationIdentifier:(NSInteger)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void (^)(FlutterError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.onCreateWebView" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.onCreateWebView"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] + @(arg_identifier), @(arg_webViewIdentifier), @(arg_configurationIdentifier), + arg_navigationAction ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } -- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier origin:(FWFWKSecurityOriginData *)arg_origin frame:(FWFWKFrameInfoData *)arg_frame type:(FWFWKMediaCaptureTypeData *)arg_type @@ -2683,18 +3086,118 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void) { (void (^)( FWFWKPermissionDecisionData *_Nullable, FlutterError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi." - @"requestMediaCapturePermission" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi." + @"requestMediaCapturePermission"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_origin ?: [NSNull null], arg_frame ?: [NSNull null], arg_type ?: [NSNull null] + @(arg_identifier), @(arg_webViewIdentifier), arg_origin ?: [NSNull null], + arg_frame ?: [NSNull null], arg_type ?: [NSNull null] ] - reply:^(id reply) { - FWFWKPermissionDecisionData *output = reply; - completion(output, nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FWFWKPermissionDecisionData *output = + reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} +- (void)runJavaScriptAlertPanelForDelegateWithIdentifier:(NSInteger)arg_identifier + message:(NSString *)arg_message + frame:(FWFWKFrameInfoData *)arg_frame + completion: + (void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi." + @"runJavaScriptAlertPanel"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel + sendMessage:@[ @(arg_identifier), arg_message ?: [NSNull null], arg_frame ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; +} +- (void)runJavaScriptConfirmPanelForDelegateWithIdentifier:(NSInteger)arg_identifier + message:(NSString *)arg_message + frame:(FWFWKFrameInfoData *)arg_frame + completion: + (void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi." + @"runJavaScriptConfirmPanel"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel + sendMessage:@[ @(arg_identifier), arg_message ?: [NSNull null], arg_frame ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} +- (void)runJavaScriptTextInputPanelForDelegateWithIdentifier:(NSInteger)arg_identifier + prompt:(NSString *)arg_prompt + defaultText:(NSString *)arg_defaultText + frame:(FWFWKFrameInfoData *)arg_frame + completion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable)) + completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi." + @"runJavaScriptTextInputPanel"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + @(arg_identifier), arg_prompt ?: [NSNull null], arg_defaultText ?: [NSNull null], + arg_frame ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + NSString *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } }]; } @end @@ -2752,7 +3255,7 @@ NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void) { return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, +void SetUpFWFWKHttpCookieStoreHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2768,8 +3271,8 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_websiteDataStoreIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier @@ -2794,7 +3297,7 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie @@ -2813,7 +3316,7 @@ NSObject *FWFNSUrlHostApiGetCodec(void) { return sSharedObject; } -void FWFNSUrlHostApiSetup(id binaryMessenger, +void SetUpFWFNSUrlHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2828,7 +3331,7 @@ void FWFNSUrlHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api absoluteStringForNSURLWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2857,15 +3360,240 @@ NSObject *FWFNSUrlFlutterApiGetCodec(void) { } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier +- (void)createWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlFlutterApi.create"; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFNSUrlFlutterApiGetCodec()]; + [channel sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; +} +@end + +NSObject *FWFUIScrollViewDelegateHostApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +void SetUpFWFUIScrollViewDelegateHostApi(id binaryMessenger, + NSObject *api) { + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateHostApi.create" + binaryMessenger:binaryMessenger + codec:FWFUIScrollViewDelegateHostApiGetCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFUIScrollViewDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + FlutterError *error; + [api createWithIdentifier:arg_identifier error:&error]; + callback(wrapResult(nil, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } +} +NSObject *FWFUIScrollViewDelegateFlutterApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +@interface FWFUIScrollViewDelegateFlutterApi () +@property(nonatomic, strong) NSObject *binaryMessenger; +@end + +@implementation FWFUIScrollViewDelegateFlutterApi + +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { + self = [super init]; + if (self) { + _binaryMessenger = binaryMessenger; + } + return self; +} +- (void)scrollViewDidScrollWithIdentifier:(NSInteger)arg_identifier + UIScrollViewIdentifier:(NSInteger)arg_uiScrollViewIdentifier + x:(double)arg_x + y:(double)arg_y + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = @"dev.flutter.pigeon.webview_flutter_wkwebview." + @"UIScrollViewDelegateFlutterApi.scrollViewDidScroll"; + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFUIScrollViewDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ @(arg_identifier), @(arg_uiScrollViewIdentifier), @(arg_x), @(arg_y) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; +} +@end + +NSObject *FWFNSUrlCredentialHostApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +void SetUpFWFNSUrlCredentialHostApi(id binaryMessenger, + NSObject *api) { + /// Create a new native instance and add it to the `InstanceManager`. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser" + binaryMessenger:binaryMessenger + codec:FWFNSUrlCredentialHostApiGetCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector + (createWithUserWithIdentifier:user:password:persistence:error:)], + @"FWFNSUrlCredentialHostApi api (%@) doesn't respond to " + @"@selector(createWithUserWithIdentifier:user:password:persistence:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSString *arg_user = GetNullableObjectAtIndex(args, 1); + NSString *arg_password = GetNullableObjectAtIndex(args, 2); + FWFNSUrlCredentialPersistence arg_persistence = + [GetNullableObjectAtIndex(args, 3) integerValue]; + FlutterError *error; + [api createWithUserWithIdentifier:arg_identifier + user:arg_user + password:arg_password + persistence:arg_persistence + error:&error]; + callback(wrapResult(nil, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } +} +NSObject *FWFNSUrlProtectionSpaceFlutterApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +@interface FWFNSUrlProtectionSpaceFlutterApi () +@property(nonatomic, strong) NSObject *binaryMessenger; +@end + +@implementation FWFNSUrlProtectionSpaceFlutterApi + +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { + self = [super init]; + if (self) { + _binaryMessenger = binaryMessenger; + } + return self; +} +- (void)createWithIdentifier:(NSInteger)arg_identifier + host:(nullable NSString *)arg_host + realm:(nullable NSString *)arg_realm + authenticationMethod:(nullable NSString *)arg_authenticationMethod + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlProtectionSpaceFlutterApi.create"; + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FWFNSUrlProtectionSpaceFlutterApiGetCodec()]; + [channel sendMessage:@[ + @(arg_identifier), arg_host ?: [NSNull null], arg_realm ?: [NSNull null], + arg_authenticationMethod ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; +} +@end + +NSObject *FWFNSUrlAuthenticationChallengeFlutterApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +@interface FWFNSUrlAuthenticationChallengeFlutterApi () +@property(nonatomic, strong) NSObject *binaryMessenger; +@end + +@implementation FWFNSUrlAuthenticationChallengeFlutterApi + +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { + self = [super init]; + if (self) { + _binaryMessenger = binaryMessenger; + } + return self; +} +- (void)createWithIdentifier:(NSInteger)arg_identifier + protectionSpaceIdentifier:(NSInteger)arg_protectionSpaceIdentifier + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = + @"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlAuthenticationChallengeFlutterApi.create"; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlFlutterApi.create" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:FWFNSUrlFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); + codec:FWFNSUrlAuthenticationChallengeFlutterApiGetCodec()]; + [channel sendMessage:@[ @(arg_identifier), @(arg_protectionSpaceIdentifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m index a5f4e02b9c2f9c6382a1c2968cf573dd832ead1a..54703ff15b70f5810730a957016d2921d17a4c2a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -20,21 +20,20 @@ return self; } -- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSNumber *)identifier { - return (WKHTTPCookieStore *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSInteger)identifier { + return (WKHTTPCookieStore *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)identifier - dataStoreIdentifier:(nonnull NSNumber *)websiteDataStoreIdentifier +- (void)createFromWebsiteDataStoreWithIdentifier:(NSInteger)identifier + dataStoreIdentifier:(NSInteger)websiteDataStoreIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { - WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[self.instanceManager - instanceForIdentifier:websiteDataStoreIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:dataStore.httpCookieStore - withIdentifier:identifier.longValue]; + WKWebsiteDataStore *dataStore = + (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:websiteDataStoreIdentifier]; + [self.instanceManager addDartCreatedInstance:dataStore.httpCookieStore withIdentifier:identifier]; } -- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)identifier +- (void)setCookieForStoreWithIdentifier:(NSInteger)identifier cookie:(nonnull FWFNSHttpCookieData *)cookie completion:(nonnull void (^)(FlutterError *_Nullable))completion { NSHTTPCookie *nsCookie = FWFNativeNSHTTPCookieFromCookieData(cookie); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m index 242a5f707348316c806466c751482616937ff355..c2af8444a425bf097fb5f18665f87df93de92e61 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m @@ -51,7 +51,6 @@ @property NSMapTable *identifiers; @property NSMapTable *weakInstances; @property NSMapTable *strongInstances; -@property long nextIdentifier; @end @implementation FWFInstanceManager diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h index c33388b1a0ecec9177211aee919016f92ad88aff..63480ce180184a0688dd5584032bc9bd00002ddd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h @@ -7,6 +7,11 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFInstanceManager () +/** + * The next identifier that will be used for a host-created instance. + */ +@property long nextIdentifier; + /** * The number of instances stored as a strong reference. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m index f8b5925f221583d9d37d8f37a699bab8f37efda2..db8c4562748fb3723c3fdbe8c356de95e510a881 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -4,9 +4,13 @@ #import "FWFNavigationDelegateHostApi.h" #import "FWFDataConverters.h" +#import "FWFURLAuthenticationChallengeHostApi.h" #import "FWFWebViewConfigurationHostApi.h" @interface FWFNavigationDelegateFlutterApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; // InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -16,6 +20,7 @@ instanceManager:(FWFInstanceManager *)instanceManager { self = [self initWithBinaryMessenger:binaryMessenger]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -29,9 +34,9 @@ webView:(WKWebView *)webView URL:(NSString *)URL completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didFinishNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFinishNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier URL:URL completion:completion]; @@ -41,10 +46,9 @@ webView:(WKWebView *)webView URL:(NSString *)URL completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didStartProvisionalNavigationForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didStartProvisionalNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier URL:URL completion:completion]; @@ -57,13 +61,12 @@ completion: (void (^)(FWFWKNavigationActionPolicyEnumData *_Nullable, FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNativeWKNavigationAction(navigationAction); [self - decidePolicyForNavigationActionForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + decidePolicyForNavigationActionForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier navigationAction:navigationActionData completion:completion]; @@ -73,9 +76,9 @@ webView:(WKWebView *)webView error:(NSError *)error completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didFailNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFailNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier error:FWFNSErrorDataFromNativeNSError(error) completion:completion]; @@ -85,26 +88,56 @@ webView:(WKWebView *)webView error:(NSError *)error completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self - didFailProvisionalNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) - webViewIdentifier:webViewIdentifier - error:FWFNSErrorDataFromNativeNSError(error) - completion:completion]; + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFailProvisionalNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] + webViewIdentifier:webViewIdentifier + error:FWFNSErrorDataFromNativeNSError(error) + completion:completion]; } - (void)webViewWebContentProcessDidTerminateForDelegate:(FWFNavigationDelegate *)instance webView:(WKWebView *)webView completion: (void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; [self webViewWebContentProcessDidTerminateForDelegateWithIdentifier: - @([self identifierForDelegate:instance]) + [self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier completion:completion]; } + +- (void) + didReceiveAuthenticationChallengeForDelegate:(FWFNavigationDelegate *)instance + webView:(WKWebView *)webView + challenge:(NSURLAuthenticationChallenge *)challenge + completion: + (void (^)(FWFAuthenticationChallengeResponse *_Nullable, + FlutterError *_Nullable))completion { + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + + FWFURLAuthenticationChallengeFlutterApiImpl *challengeApi = + [[FWFURLAuthenticationChallengeFlutterApiImpl alloc] + initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [challengeApi createWithInstance:challenge + protectionSpace:challenge.protectionSpace + completion:^(FlutterError *error) { + NSAssert(!error, @"%@", error); + }]; + + [self + didReceiveAuthenticationChallengeForDelegateWithIdentifier:[self + identifierForDelegate:instance] + webViewIdentifier:webViewIdentifier + challengeIdentifier: + [self.instanceManager + identifierWithStrongReferenceForInstance: + challenge] + completion:completion]; +} @end @implementation FWFNavigationDelegate @@ -147,8 +180,13 @@ completion:^(FWFWKNavigationActionPolicyEnumData *policy, FlutterError *error) { NSAssert(!error, @"%@", error); - decisionHandler( - FWFNativeWKNavigationActionPolicyFromEnumData(policy)); + if (!error) { + decisionHandler( + FWFNativeWKNavigationActionPolicyFromEnumData( + policy)); + } else { + decisionHandler(WKNavigationActionPolicyCancel); + } }]; } @@ -182,6 +220,40 @@ NSAssert(!error, @"%@", error); }]; } + +- (void)webView:(WKWebView *)webView + didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge + completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, + NSURLCredential *_Nullable))completionHandler { + [self.navigationDelegateAPI + didReceiveAuthenticationChallengeForDelegate:self + webView:webView + challenge:challenge + completion:^(FWFAuthenticationChallengeResponse *response, + FlutterError *error) { + NSAssert(!error, @"%@", error); + if (!error) { + NSURLSessionAuthChallengeDisposition disposition = + FWFNativeNSURLSessionAuthChallengeDispositionFromFWFNSUrlSessionAuthChallengeDisposition( + response.disposition); + + NSURLCredential *credential = + response.credentialIdentifier + ? (NSURLCredential *)[self.navigationDelegateAPI + .instanceManager + instanceForIdentifier: + response.credentialIdentifier + .longValue] + : nil; + + completionHandler(disposition, credential); + } else { + completionHandler( + NSURLSessionAuthChallengeCancelAuthenticationChallenge, + nil); + } + }]; +} @end @interface FWFNavigationDelegateHostApiImpl () @@ -203,16 +275,15 @@ return self; } -- (FWFNavigationDelegate *)navigationDelegateForIdentifier:(NSNumber *)identifier { - return (FWFNavigationDelegate *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (FWFNavigationDelegate *)navigationDelegateForIdentifier:(NSInteger)identifier { + return (FWFNavigationDelegate *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { FWFNavigationDelegate *navigationDelegate = [[FWFNavigationDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:navigationDelegate - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:navigationDelegate withIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index 3adf7246a9a0ef9a70a4ee2a7b57ef4703d782e0..098d291c6c2ba115606791756512278d8147ed40 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -58,12 +58,12 @@ ? @([self.instanceManager identifierWithStrongReferenceForInstance:value]) : value; [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue - isIdentifier:@(isIdentifier)]]; + isIdentifier:isIdentifier]]; }]; - NSNumber *objectIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:object]); - [self observeValueForObjectWithIdentifier:@([self identifierForObject:instance]) + NSInteger objectIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:object]; + [self observeValueForObjectWithIdentifier:[self identifierForObject:instance] keyPath:keyPath objectIdentifier:objectIdentifier changeKeys:changeKeys @@ -111,12 +111,12 @@ return self; } -- (NSObject *)objectForIdentifier:(NSNumber *)identifier { - return (NSObject *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (NSObject *)objectForIdentifier:(NSInteger)identifier { + return (NSObject *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)identifier - observerIdentifier:(nonnull NSNumber *)observer +- (void)addObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observer keyPath:(nonnull NSString *)keyPath options: (nonnull NSArray *) @@ -132,16 +132,16 @@ context:nil]; } -- (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)identifier - observerIdentifier:(nonnull NSNumber *)observer +- (void)removeObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observer keyPath:(nonnull NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error { [[self objectForIdentifier:identifier] removeObserver:[self objectForIdentifier:observer] forKeyPath:keyPath]; } -- (void)disposeObjectWithIdentifier:(nonnull NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { - [self.instanceManager removeInstanceWithIdentifier:identifier.longValue]; + [self.instanceManager removeInstanceWithIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m index 1a10c08eec4a5a2bbcc0bc11cac4556bce7c1fcf..95078975f4d9eacc3b4bc7db65df57099cfccd93 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -19,28 +19,26 @@ return self; } -- (WKPreferences *)preferencesForIdentifier:(NSNumber *)identifier { - return (WKPreferences *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKPreferences *)preferencesForIdentifier:(NSInteger)identifier { + return (WKPreferences *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { WKPreferences *preferences = [[WKPreferences alloc] init]; - [self.instanceManager addDartCreatedInstance:preferences withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:preferences withIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:configuration.preferences - withIdentifier:identifier.longValue]; + instanceForIdentifier:configurationIdentifier]; + [self.instanceManager addDartCreatedInstance:configuration.preferences withIdentifier:identifier]; } -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)identifier - isEnabled:(nonnull NSNumber *)enabled +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSInteger)identifier + isEnabled:(BOOL)enabled error:(FlutterError *_Nullable *_Nonnull)error { - [[self preferencesForIdentifier:identifier] setJavaScriptEnabled:enabled.boolValue]; + [[self preferencesForIdentifier:identifier] setJavaScriptEnabled:enabled]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m index f1b83993c4f800bb2e2788b53e8fd6c753b24b32..1e27c1208bd003a1a5063037ff1df4931ea90d91 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -28,10 +28,10 @@ userContentController:(WKUserContentController *)userContentController message:(WKScriptMessage *)message completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *userContentControllerIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:userContentController]); + NSInteger userContentControllerIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:userContentController]; FWFWKScriptMessageData *messageData = FWFWKScriptMessageDataFromNativeWKScriptMessage(message); - [self didReceiveScriptMessageForHandlerWithIdentifier:@([self identifierForHandler:instance]) + [self didReceiveScriptMessageForHandlerWithIdentifier:[self identifierForHandler:instance] userContentControllerIdentifier:userContentControllerIdentifier message:messageData completion:completion]; @@ -85,12 +85,10 @@ instanceForIdentifier:identifier.longValue]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:scriptMessageHandler - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:scriptMessageHandler withIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.h new file mode 100644 index 0000000000000000000000000000000000000000..5324725a8fbe63ce174226d6ee242ff6eb7610d9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.h @@ -0,0 +1,46 @@ +// Copyright 2013 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. + +#import +#import +#import "FWFObjectHostApi.h" + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Flutter api implementation for UIScrollViewDelegate. + * + * Handles making callbacks to Dart for a UIScrollViewDelegate. + */ +@interface FWFScrollViewDelegateFlutterApiImpl : FWFUIScrollViewDelegateFlutterApi + +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +@end + +/** + * Implementation of WKUIScrollViewDelegate for FWFUIScrollViewDelegateHostApiImpl. + */ +@interface FWFScrollViewDelegate : FWFObject +@property(readonly, nonnull, nonatomic) FWFScrollViewDelegateFlutterApiImpl *scrollViewDelegateAPI; + +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; + +@end + +/** + * Host api implementation for UIScrollViewDelegate. + * + * Handles creating UIScrollView that intercommunicate with a paired Dart object. + */ +@interface FWFScrollViewDelegateHostApiImpl : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.m new file mode 100644 index 0000000000000000000000000000000000000000..f8d7630dc8aeecd22e5a2988a2d9af63af919225 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewDelegateHostApi.m @@ -0,0 +1,90 @@ +// Copyright 2013 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. + +#import "FWFScrollViewDelegateHostApi.h" +#import "FWFWebViewHostApi.h" + +@interface FWFScrollViewDelegateFlutterApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScrollViewDelegateFlutterApiImpl + +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self initWithBinaryMessenger:binaryMessenger]; + if (self) { + _binaryMessenger = binaryMessenger; + _instanceManager = instanceManager; + } + return self; +} +- (long)identifierForDelegate:(FWFScrollViewDelegate *)instance { + return [self.instanceManager identifierWithStrongReferenceForInstance:instance]; +} + +- (void)scrollViewDidScrollForDelegate:(FWFScrollViewDelegate *)instance + uiScrollView:(UIScrollView *)scrollView + completion:(void (^)(FlutterError *_Nullable))completion { + [self scrollViewDidScrollWithIdentifier:[self identifierForDelegate:instance] + UIScrollViewIdentifier:[self.instanceManager + identifierWithStrongReferenceForInstance:scrollView] + x:scrollView.contentOffset.x + y:scrollView.contentOffset.y + completion:completion]; +} +@end + +@implementation FWFScrollViewDelegate + +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [super initWithBinaryMessenger:binaryMessenger instanceManager:instanceManager]; + if (self) { + _scrollViewDelegateAPI = + [[FWFScrollViewDelegateFlutterApiImpl alloc] initWithBinaryMessenger:binaryMessenger + instanceManager:instanceManager]; + } + return self; +} + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + [self.scrollViewDelegateAPI scrollViewDidScrollForDelegate:self + uiScrollView:scrollView + completion:^(FlutterError *error) { + NSAssert(!error, @"%@", error); + }]; +} +@end + +@interface FWFScrollViewDelegateHostApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScrollViewDelegateHostApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _binaryMessenger = binaryMessenger; + _instanceManager = instanceManager; + } + return self; +} + +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { + FWFScrollViewDelegate *uiScrollViewDelegate = + [[FWFScrollViewDelegate alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [self.instanceManager addDartCreatedInstance:uiScrollViewDelegate withIdentifier:identifier]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m index a32e9565b5140bd561e943504873873a7ac0ce76..9cefa330c0479798c6e05090d582c7acce573a51 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -3,9 +3,14 @@ // found in the LICENSE file. #import "FWFScrollViewHostApi.h" +#import "FWFScrollViewDelegateHostApi.h" #import "FWFWebViewHostApi.h" @interface FWFScrollViewHostApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; + // InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -19,41 +24,47 @@ return self; } -- (UIScrollView *)scrollViewForIdentifier:(NSNumber *)identifier { - return (UIScrollView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (UIScrollView *)scrollViewForIdentifier:(NSInteger)identifier { + return (UIScrollView *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)identifier - webViewIdentifier:(nonnull NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - WKWebView *webView = - (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:webView.scrollView - withIdentifier:identifier.longValue]; + WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier]; + [self.instanceManager addDartCreatedInstance:webView.scrollView withIdentifier:identifier]; } - (NSArray *) - contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)identifier + contentOffsetForScrollViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { CGPoint point = [[self scrollViewForIdentifier:identifier] contentOffset]; return @[ @(point.x), @(point.y) ]; } -- (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)identifier - x:(nonnull NSNumber *)x - y:(nonnull NSNumber *)y +- (void)scrollByForScrollViewWithIdentifier:(NSInteger)identifier + x:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error { UIScrollView *scrollView = [self scrollViewForIdentifier:identifier]; CGPoint contentOffset = scrollView.contentOffset; - [scrollView setContentOffset:CGPointMake(contentOffset.x + x.doubleValue, - contentOffset.y + y.doubleValue)]; + [scrollView setContentOffset:CGPointMake(contentOffset.x + x, contentOffset.y + y)]; } -- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)identifier - toX:(nonnull NSNumber *)x - y:(nonnull NSNumber *)y +- (void)setContentOffsetForScrollViewWithIdentifier:(NSInteger)identifier + toX:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error { + [[self scrollViewForIdentifier:identifier] setContentOffset:CGPointMake(x, y)]; +} + +- (void)setDelegateForScrollViewWithIdentifier:(NSInteger)identifier + uiScrollViewDelegateIdentifier:(nullable NSNumber *)uiScrollViewDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error { [[self scrollViewForIdentifier:identifier] - setContentOffset:CGPointMake(x.doubleValue, y.doubleValue)]; + setDelegate:uiScrollViewDelegateIdentifier + ? (FWFScrollViewDelegate *)[self.instanceManager + instanceForIdentifier:uiScrollViewDelegateIdentifier.longValue] + : nil]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index a7010509ef225502f276404a81d0b49d5d4db068..f9d78eaea06ae1722253f20c7df0383cc48d2eb2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -43,18 +43,18 @@ }]; } - NSNumber *configurationIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); + NSInteger configurationIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:configuration]; FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNativeWKNavigationAction(navigationAction); - [self onCreateWebViewForDelegateWithIdentifier:@([self identifierForDelegate:instance]) - webViewIdentifier: - @([self.instanceManager - identifierWithStrongReferenceForInstance:webView]) - configurationIdentifier:configurationIdentifier - navigationAction:navigationActionData - completion:completion]; + [self + onCreateWebViewForDelegateWithIdentifier:[self identifierForDelegate:instance] + webViewIdentifier:[self.instanceManager + identifierWithStrongReferenceForInstance:webView] + configurationIdentifier:configurationIdentifier + navigationAction:navigationActionData + completion:completion]; } - (void)requestMediaCapturePermissionForDelegateWithIdentifier:(FWFUIDelegate *)instance @@ -66,12 +66,10 @@ (void (^)(WKPermissionDecision))completion API_AVAILABLE(ios(15.0)) { [self - requestMediaCapturePermissionForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + requestMediaCapturePermissionForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier: - @([self.instanceManager - identifierWithStrongReferenceForInstance: - webView]) + [self.instanceManager + identifierWithStrongReferenceForInstance:webView] origin: FWFWKSecurityOriginDataFromNativeWKSecurityOrigin( origin) @@ -90,6 +88,63 @@ decision)); }]; } + +- (void)runJavaScriptAlertPanelForDelegateWithIdentifier:(FWFUIDelegate *)instance + message:(NSString *)message + frame:(WKFrameInfo *)frame + completionHandler:(void (^)(void))completionHandler { + [self runJavaScriptAlertPanelForDelegateWithIdentifier:[self identifierForDelegate:instance] + message:message + frame:FWFWKFrameInfoDataFromNativeWKFrameInfo( + frame) + completion:^(FlutterError *error) { + NSAssert(!error, @"%@", error); + completionHandler(); + }]; +} + +- (void)runJavaScriptConfirmPanelForDelegateWithIdentifier:(FWFUIDelegate *)instance + message:(NSString *)message + frame:(WKFrameInfo *)frame + completionHandler:(void (^)(BOOL))completionHandler { + [self runJavaScriptConfirmPanelForDelegateWithIdentifier:[self identifierForDelegate:instance] + message:message + frame:FWFWKFrameInfoDataFromNativeWKFrameInfo( + frame) + completion:^(NSNumber *isConfirmed, + FlutterError *error) { + NSAssert(!error, @"%@", error); + if (error) { + completionHandler(NO); + } else { + completionHandler(isConfirmed.boolValue); + } + }]; +} + +- (void)runJavaScriptTextInputPanelForDelegateWithIdentifier:(FWFUIDelegate *)instance + prompt:(NSString *)prompt + defaultText:(NSString *)defaultText + frame:(WKFrameInfo *)frame + completionHandler: + (void (^)(NSString *_Nullable))completionHandler { + [self + runJavaScriptTextInputPanelForDelegateWithIdentifier:[self identifierForDelegate:instance] + prompt:prompt + defaultText:defaultText + frame:FWFWKFrameInfoDataFromNativeWKFrameInfo( + frame) + completion:^(NSString *inputText, + FlutterError *error) { + NSAssert(!error, @"%@", error); + if (error) { + completionHandler(nil); + } else { + completionHandler(inputText); + } + }]; +} + @end @implementation FWFUIDelegate @@ -133,6 +188,39 @@ decisionHandler(decision); }]; } + +- (void)webView:(WKWebView *)webView + runJavaScriptAlertPanelWithMessage:(NSString *)message + initiatedByFrame:(WKFrameInfo *)frame + completionHandler:(void (^)(void))completionHandler { + [self.UIDelegateAPI runJavaScriptAlertPanelForDelegateWithIdentifier:self + message:message + frame:frame + completionHandler:completionHandler]; +} + +- (void)webView:(WKWebView *)webView + runJavaScriptConfirmPanelWithMessage:(NSString *)message + initiatedByFrame:(WKFrameInfo *)frame + completionHandler:(void (^)(BOOL))completionHandler { + [self.UIDelegateAPI runJavaScriptConfirmPanelForDelegateWithIdentifier:self + message:message + frame:frame + completionHandler:completionHandler]; +} + +- (void)webView:(WKWebView *)webView + runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt + defaultText:(NSString *)defaultText + initiatedByFrame:(WKFrameInfo *)frame + completionHandler:(void (^)(NSString *_Nullable))completionHandler { + [self.UIDelegateAPI runJavaScriptTextInputPanelForDelegateWithIdentifier:self + prompt:prompt + defaultText:defaultText + frame:frame + completionHandler:completionHandler]; +} + @end @interface FWFUIDelegateHostApiImpl () @@ -158,10 +246,10 @@ return (FWFUIDelegate *)[self.instanceManager instanceForIdentifier:identifier.longValue]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier]; } + @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m index 1e168d0a8fcb340e30aca569144e39cf0e38d36f..3ee6f38faa80c464d6647437b83b2dd34870c03c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -18,11 +18,11 @@ return self; } -- (UIView *)viewForIdentifier:(NSNumber *)identifier { - return (UIView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (UIView *)viewForIdentifier:(NSInteger)identifier { + return (UIView *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)setBackgroundColorForViewWithIdentifier:(NSInteger)identifier toValue:(nullable NSNumber *)color error:(FlutterError *_Nullable *_Nonnull)error { if (color == nil) { @@ -36,9 +36,9 @@ [[self viewForIdentifier:identifier] setBackgroundColor:colorObject]; } -- (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)identifier - isOpaque:(nonnull NSNumber *)opaque +- (void)setOpaqueForViewWithIdentifier:(NSInteger)identifier + isOpaque:(BOOL)opaque error:(FlutterError *_Nullable *_Nonnull)error { - [[self viewForIdentifier:identifier] setOpaque:opaque.boolValue]; + [[self viewForIdentifier:identifier] setOpaque:opaque]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.h new file mode 100644 index 0000000000000000000000000000000000000000..6100b703c29ba56a2760563bd642bbb324d2c75c --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.h @@ -0,0 +1,33 @@ +// Copyright 2013 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. + +#import +#import +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Flutter API implementation for `NSURLAuthenticationChallenge`. + * + * This class may handle instantiating and adding Dart instances that are attached to a native + * instance or sending callback methods from an overridden native class. + */ +@interface FWFURLAuthenticationChallengeFlutterApiImpl : NSObject +/** + * The Flutter API used to send messages back to Dart. + */ +@property FWFNSUrlAuthenticationChallengeFlutterApi *api; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +/** + * Sends a message to Dart to create a new Dart instance and add it to the `InstanceManager`. + */ +- (void)createWithInstance:(NSURLAuthenticationChallenge *)instance + protectionSpace:(NSURLProtectionSpace *)protectionSpace + completion:(void (^)(FlutterError *_Nullable))completion; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.m new file mode 100644 index 0000000000000000000000000000000000000000..965952dfebeb0b6a73fe7629936161a9eeb673d3 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLAuthenticationChallengeHostApi.m @@ -0,0 +1,52 @@ +// Copyright 2013 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. + +#import "FWFURLAuthenticationChallengeHostApi.h" +#import "FWFURLProtectionSpaceHostApi.h" + +@interface FWFURLAuthenticationChallengeFlutterApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFURLAuthenticationChallengeFlutterApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _binaryMessenger = binaryMessenger; + _instanceManager = instanceManager; + _api = + [[FWFNSUrlAuthenticationChallengeFlutterApi alloc] initWithBinaryMessenger:binaryMessenger]; + } + return self; +} + +- (void)createWithInstance:(NSURLAuthenticationChallenge *)instance + protectionSpace:(NSURLProtectionSpace *)protectionSpace + completion:(void (^)(FlutterError *_Nullable))completion { + if ([self.instanceManager containsInstance:instance]) { + return; + } + + FWFURLProtectionSpaceFlutterApiImpl *protectionSpaceApi = + [[FWFURLProtectionSpaceFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [protectionSpaceApi createWithInstance:protectionSpace + host:protectionSpace.host + realm:protectionSpace.realm + authenticationMethod:protectionSpace.authenticationMethod + completion:^(FlutterError *error) { + NSAssert(!error, @"%@", error); + }]; + + [self.api createWithIdentifier:[self.instanceManager addHostCreatedInstance:instance] + protectionSpaceIdentifier:[self.instanceManager + identifierWithStrongReferenceForInstance:protectionSpace] + completion:completion]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.h new file mode 100644 index 0000000000000000000000000000000000000000..fe9b3d0d8d507f017ceb925bd8fb140ea34a286d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.h @@ -0,0 +1,24 @@ +// Copyright 2013 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. + +#import +#import +#import "FWFDataConverters.h" +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host API implementation for `NSURLCredential`. + * + * This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or method calls on the associated native class or an instance of the class. + */ +@interface FWFURLCredentialHostApiImpl : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.m new file mode 100644 index 0000000000000000000000000000000000000000..2b6955ff28751b978596ae4f07d89b150ab7e285 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLCredentialHostApi.m @@ -0,0 +1,58 @@ +// Copyright 2013 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. + +#import "FWFURLCredentialHostApi.h" + +@interface FWFURLCredentialHostApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFURLCredentialHostApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _binaryMessenger = binaryMessenger; + _instanceManager = instanceManager; + } + return self; +} + +- (void)createWithUserWithIdentifier:(NSInteger)identifier + user:(nonnull NSString *)user + password:(nonnull NSString *)password + persistence:(FWFNSUrlCredentialPersistence)persistence + error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { + [self.instanceManager + addDartCreatedInstance: + [NSURLCredential + credentialWithUser:user + password:password + persistence: + FWFNativeNSURLCredentialPersistenceFromFWFNSUrlCredentialPersistence( + persistence)] + withIdentifier:identifier]; +} + +- (nullable NSURL *)credentialForIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable __autoreleasing *_Nonnull)error { + NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier.longValue]; + + if (!instance) { + NSString *message = + [NSString stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %@", + identifier]; + *error = [FlutterError errorWithCode:NSInternalInconsistencyException + message:message + details:nil]; + } + + return instance; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m index 9f747c22994ba5e6776a16ad561b836168d09287..c3101c7bfaaf81f1aeca3a9fc123f41c7befa9d5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m @@ -29,7 +29,7 @@ } - (nullable NSString *) - absoluteStringForNSURLWithIdentifier:(nonnull NSNumber *)identifier + absoluteStringForNSURLWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { NSURL *instance = [self urlForIdentifier:identifier error:error]; if (*error) { @@ -39,14 +39,14 @@ return instance.absoluteString; } -- (nullable NSURL *)urlForIdentifier:(NSNumber *)identifier +- (nullable NSURL *)urlForIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier.longValue]; + NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier]; if (!instance) { - NSString *message = - [NSString stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %@", - identifier]; + NSString *message = [NSString + stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %li", + (long)identifier]; *error = [FlutterError errorWithCode:NSInternalInconsistencyException message:message details:nil]; @@ -68,7 +68,7 @@ } - (void)create:(NSURL *)instance completion:(void (^)(FlutterError *_Nullable))completion { - [self.api createWithIdentifier:@([self.instanceManager addHostCreatedInstance:instance]) + [self.api createWithIdentifier:[self.instanceManager addHostCreatedInstance:instance] completion:completion]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.h new file mode 100644 index 0000000000000000000000000000000000000000..5e57ab5404abb14ad424e13eeaf84c1db42968c9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.h @@ -0,0 +1,35 @@ +// Copyright 2013 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. + +#import +#import +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Flutter API implementation for `NSURLProtectionSpace`. + * + * This class may handle instantiating and adding Dart instances that are attached to a native + * instance or sending callback methods from an overridden native class. + */ +@interface FWFURLProtectionSpaceFlutterApiImpl : NSObject +/** + * The Flutter API used to send messages back to Dart. + */ +@property FWFNSUrlProtectionSpaceFlutterApi *api; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +/** + * Sends a message to Dart to create a new Dart instance and add it to the `InstanceManager`. + */ +- (void)createWithInstance:(NSURLProtectionSpace *)instance + host:(nullable NSString *)host + realm:(nullable NSString *)realm + authenticationMethod:(nullable NSString *)authenticationMethod + completion:(void (^)(FlutterError *_Nullable))completion; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.m new file mode 100644 index 0000000000000000000000000000000000000000..fc2d1630701345c204010a9c2ac5d3b25fc7f711 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLProtectionSpaceHostApi.m @@ -0,0 +1,36 @@ +// Copyright 2013 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. + +#import "FWFURLProtectionSpaceHostApi.h" + +@interface FWFURLProtectionSpaceFlutterApiImpl () +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFURLProtectionSpaceFlutterApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + _api = [[FWFNSUrlProtectionSpaceFlutterApi alloc] initWithBinaryMessenger:binaryMessenger]; + } + return self; +} + +- (void)createWithInstance:(NSURLProtectionSpace *)instance + host:(nullable NSString *)host + realm:(nullable NSString *)realm + authenticationMethod:(nullable NSString *)authenticationMethod + completion:(void (^)(FlutterError *_Nullable))completion { + if (![self.instanceManager containsInstance:instance]) { + [self.api createWithIdentifier:[self.instanceManager addHostCreatedInstance:instance] + host:host + realm:realm + authenticationMethod:authenticationMethod + completion:completion]; + } +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m index ac314323da3b23d76ab64504ae9c3151a31c515b..074a54c9a8a9b200f8279e5d03732b7d9ee72ac7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -20,39 +20,38 @@ return self; } -- (WKUserContentController *)userContentControllerForIdentifier:(NSNumber *)identifier { - return (WKUserContentController *)[self.instanceManager - instanceForIdentifier:identifier.longValue]; +- (WKUserContentController *)userContentControllerForIdentifier:(NSInteger)identifier { + return (WKUserContentController *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; [self.instanceManager addDartCreatedInstance:configuration.userContentController - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)identifier - handlerIdentifier:(nonnull NSNumber *)handler +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier + handlerIdentifier:(NSInteger)handler ofName:(nonnull NSString *)name error: (FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] addScriptMessageHandler:(id)[self.instanceManager - instanceForIdentifier:handler.longValue] + instanceForIdentifier:handler] name:name]; } -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier name:(nonnull NSString *)name error:(FlutterError *_Nullable *_Nonnull) error { [[self userContentControllerForIdentifier:identifier] removeScriptMessageHandlerForName:name]; } -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull) error { @@ -66,14 +65,14 @@ } } -- (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)addUserScriptForControllerWithIdentifier:(NSInteger)identifier userScript:(nonnull FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] addUserScript:FWFNativeWKUserScriptFromScriptData(userScript)]; } -- (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] removeAllUserScripts]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m index 762c07b5abe69ea4fd458b6da120e7b2e7646643..ee4896c1d2a1cd15f15149d64fa929cc55874f3a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -24,7 +24,7 @@ - (void)createWithConfiguration:(WKWebViewConfiguration *)configuration completion:(void (^)(FlutterError *_Nullable))completion { long identifier = [self.instanceManager addHostCreatedInstance:configuration]; - [self createWithIdentifier:@(identifier) completion:completion]; + [self createWithIdentifier:identifier completion:completion]; } @end @@ -72,47 +72,39 @@ return self; } -- (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSNumber *)identifier { - return (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:identifier.longValue]; +- (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSInteger)identifier { + return (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFWebViewConfiguration *webViewConfiguration = [[FWFWebViewConfiguration alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:webViewConfiguration - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:webViewConfiguration withIdentifier:identifier]; } -- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)identifier - webViewIdentifier:(nonnull NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - WKWebView *webView = - (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:webView.configuration - withIdentifier:identifier.longValue]; + WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier]; + [self.instanceManager addDartCreatedInstance:webView.configuration withIdentifier:identifier]; } -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)identifier - isAllowed:(nonnull NSNumber *)allow +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error: (FlutterError *_Nullable *_Nonnull) error { - [[self webViewConfigurationForIdentifier:identifier] - setAllowsInlineMediaPlayback:allow.boolValue]; + [[self webViewConfigurationForIdentifier:identifier] setAllowsInlineMediaPlayback:allow]; } -- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier: - (nonnull NSNumber *)identifier - isLimited: - (nonnull NSNumber *)limit +- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSInteger)identifier + isLimited:(BOOL)limit error:(FlutterError *_Nullable *_Nonnull)error { if (@available(iOS 14, *)) { [[self webViewConfigurationForIdentifier:identifier] - setLimitsNavigationsToAppBoundDomains:limit.boolValue]; + setLimitsNavigationsToAppBoundDomains:limit]; } else { *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" @@ -122,7 +114,7 @@ } - (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)identifier + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSInteger)identifier forTypes: (nonnull NSArray< FWFWKAudiovisualMediaTypeEnumData diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 924b9bba4bca1c881e923cdf0181e28990b632ba..7c2f3ede932d8ee3b2fb234baf50ac207bb085bb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -95,8 +95,8 @@ return self; } -- (FWFWebView *)webViewForIdentifier:(NSNumber *)identifier { - return (FWFWebView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (FWFWebView *)webViewForIdentifier:(NSInteger)identifier { + return (FWFWebView *)[self.instanceManager instanceForIdentifier:identifier]; } + (nonnull FlutterError *)errorForURLString:(nonnull NSString *)string { @@ -108,19 +108,19 @@ details:errorDetails]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; FWFWebView *webView = [[FWFWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) configuration:configuration binaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:webView withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:webView withIdentifier:identifier]; } -- (void)loadRequestForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadRequestForWebViewWithIdentifier:(NSInteger)identifier request:(nonnull FWFNSUrlRequestData *)request error: (FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -134,39 +134,40 @@ [[self webViewForIdentifier:identifier] loadRequest:urlRequest]; } -- (void)setUserAgentForWebViewWithIdentifier:(nonnull NSNumber *)identifier - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable __autoreleasing *_Nonnull) - error { +- (void)setCustomUserAgentForWebViewWithIdentifier:(NSInteger)identifier + userAgent:(nullable NSString *)userAgent + error: + (FlutterError *_Nullable __autoreleasing *_Nonnull) + error { [[self webViewForIdentifier:identifier] setCustomUserAgent:userAgent]; } - (nullable NSNumber *) - canGoBackForWebViewWithIdentifier:(nonnull NSNumber *)identifier + canGoBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return @([self webViewForIdentifier:identifier].canGoBack); } - (nullable NSString *) - URLForWebViewWithIdentifier:(nonnull NSNumber *)identifier + URLForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return [self webViewForIdentifier:identifier].URL.absoluteString; } - (nullable NSNumber *) - canGoForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier + canGoForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return @([[self webViewForIdentifier:identifier] canGoForward]); } - (nullable NSNumber *) - estimatedProgressForWebViewWithIdentifier:(nonnull NSNumber *)identifier + estimatedProgressForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { return @([[self webViewForIdentifier:identifier] estimatedProgress]); } -- (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSInteger)identifier javaScriptString:(nonnull NSString *)javaScriptString completion: (nonnull void (^)(id _Nullable, @@ -197,12 +198,12 @@ }]; } -- (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier - inspectable:(NSNumber *)inspectable +- (void)setInspectableForWebViewWithIdentifier:(NSInteger)identifier + inspectable:(BOOL)inspectable error:(FlutterError *_Nullable *_Nonnull)error { if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 - [[self webViewForIdentifier:identifier] setInspectable:inspectable.boolValue]; + [[self webViewForIdentifier:identifier] setInspectable:inspectable]; #endif } else { *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" @@ -211,17 +212,17 @@ } } -- (void)goBackForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)goBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] goBack]; } -- (void)goForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)goForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] goForward]; } -- (void)loadAssetForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadAssetForWebViewWithIdentifier:(NSInteger)identifier assetKey:(nonnull NSString *)key error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { NSString *assetFilePath = [self.assetManager lookupKeyForAsset:key]; @@ -236,7 +237,7 @@ } } -- (void)loadFileForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadFileForWebViewWithIdentifier:(NSInteger)identifier fileURL:(nonnull NSString *)url readAccessURL:(nonnull NSString *)readAccessUrl error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -253,7 +254,7 @@ } } -- (void)loadHTMLForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadHTMLForWebViewWithIdentifier:(NSInteger)identifier HTMLString:(nonnull NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -261,21 +262,21 @@ baseURL:[NSURL URLWithString:baseUrl]]; } -- (void)reloadWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)reloadWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] reload]; } - (void) - setAllowsBackForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier - isAllowed:(nonnull NSNumber *)allow + setAllowsBackForwardForWebViewWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { - [[self webViewForIdentifier:identifier] setAllowsBackForwardNavigationGestures:allow.boolValue]; + [[self webViewForIdentifier:identifier] setAllowsBackForwardNavigationGestures:allow]; } - (void) - setNavigationDelegateForWebViewWithIdentifier:(nonnull NSNumber *)identifier + setNavigationDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error: (FlutterError *_Nullable __autoreleasing *_Nonnull) @@ -285,7 +286,7 @@ [[self webViewForIdentifier:identifier] setNavigationDelegate:navigationDelegate]; } -- (void)setUIDelegateForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)setUIDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { @@ -295,8 +296,15 @@ } - (nullable NSString *) - titleForWebViewWithIdentifier:(nonnull NSNumber *)identifier + titleForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return [[self webViewForIdentifier:identifier] title]; } + +- (nullable NSString *) + customUserAgentForWebViewWithIdentifier:(NSInteger)identifier + error: + (FlutterError *_Nullable __autoreleasing *_Nonnull)error { + return [[self webViewForIdentifier:identifier] customUserAgent]; +} @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m index 51c7784931bbbe87bfba7c1c57fade7aced2c66c..f7252240957d94e5c1fc3c6605ac0c6ff3a5c28a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -20,49 +20,47 @@ return self; } -- (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSNumber *)identifier { - return (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSInteger)identifier { + return (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; [self.instanceManager addDartCreatedInstance:configuration.websiteDataStore - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)identifier +- (void)createDefaultDataStoreWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { [self.instanceManager addDartCreatedInstance:[WKWebsiteDataStore defaultDataStore] - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void) - removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)identifier - ofTypes: - (nonnull NSArray *)dataTypes - modifiedSince:(nonnull NSNumber *)modificationTimeInSecondsSinceEpoch - completion:(nonnull void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion { +- (void)removeDataFromDataStoreWithIdentifier:(NSInteger)identifier + ofTypes:(nonnull NSArray *) + dataTypes + modifiedSince:(double)modificationTimeInSecondsSinceEpoch + completion: + (nonnull void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion { NSMutableSet *stringDataTypes = [NSMutableSet set]; for (FWFWKWebsiteDataTypeEnumData *type in dataTypes) { [stringDataTypes addObject:FWFNativeWKWebsiteDataTypeFromEnumData(type)]; } WKWebsiteDataStore *dataStore = [self websiteDataStoreForIdentifier:identifier]; - [dataStore - fetchDataRecordsOfTypes:stringDataTypes - completionHandler:^(NSArray *records) { - [dataStore - removeDataOfTypes:stringDataTypes - modifiedSince:[NSDate dateWithTimeIntervalSince1970: - modificationTimeInSecondsSinceEpoch.doubleValue] - completionHandler:^{ - completion([NSNumber numberWithBool:(records.count > 0)], nil); - }]; - }]; + [dataStore fetchDataRecordsOfTypes:stringDataTypes + completionHandler:^(NSArray *records) { + [dataStore removeDataOfTypes:stringDataTypes + modifiedSince:[NSDate dateWithTimeIntervalSince1970: + modificationTimeInSecondsSinceEpoch] + completionHandler:^{ + completion([NSNumber numberWithBool:(records.count > 0)], nil); + }]; + }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index 283682957c2cf4fa828aec1f79b52eb790685319..726b20c5ffa078f219c9f54bb420b45f4c7e6e97 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -13,10 +13,14 @@ #import "FWFObjectHostApi.h" #import "FWFPreferencesHostApi.h" #import "FWFScriptMessageHandlerHostApi.h" +#import "FWFScrollViewDelegateHostApi.h" #import "FWFScrollViewHostApi.h" #import "FWFUIDelegateHostApi.h" #import "FWFUIViewHostApi.h" +#import "FWFURLAuthenticationChallengeHostApi.h" +#import "FWFURLCredentialHostApi.h" #import "FWFURLHostApi.h" +#import "FWFURLProtectionSpaceHostApi.h" #import "FWFUserContentControllerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" #import "FWFWebViewFlutterWKWebViewExternalAPI.h" diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Resources/PrivacyInfo.xcprivacy b/packages/webview_flutter/webview_flutter_wkwebview/ios/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 0000000000000000000000000000000000000000..a34b7e2e60ccbccdcafcf9d8a0b1d902b9a6f430 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/webview_flutter_wkwebview.podspec b/packages/webview_flutter/webview_flutter_wkwebview/ios/webview_flutter_wkwebview.podspec index b51dc0d96df84f715ece8f5f179b93d93908c3a0..6ddd0b6beffaf9af649fa84a3ce5bbe8ad1dcd17 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/webview_flutter_wkwebview.podspec +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/webview_flutter_wkwebview.podspec @@ -21,4 +21,5 @@ Downloaded by pub (not CocoaPods). s.platform = :ios, '11.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.resource_bundles = {'webview_flutter_wkwebview_privacy' => ['Resources/PrivacyInfo.xcprivacy']} end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart index 25649a01099f91fd193b86d738c96661324e1c6f..6e1162a97caab6819b5fe841db4703380388673d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 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. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -11,6 +11,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + /// Mirror of NSKeyValueObservingOptions. /// /// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. @@ -191,6 +209,58 @@ enum WKMediaCaptureType { unknown, } +/// Responses to an authentication challenge. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition?language=objc. +enum NSUrlSessionAuthChallengeDisposition { + /// Use the specified credential, which may be nil. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeusecredential?language=objc. + useCredential, + + /// Use the default handling for the challenge as though this delegate method + /// were not implemented. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeperformdefaulthandling?language=objc. + performDefaultHandling, + + /// Cancel the entire request. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengecancelauthenticationchallenge?language=objc. + cancelAuthenticationChallenge, + + /// Reject this challenge, and call the authentication delegate method again + /// with the next authentication protection space. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengerejectprotectionspace?language=objc. + rejectProtectionSpace, +} + +/// Specifies how long a credential will be kept. +enum NSUrlCredentialPersistence { + /// The credential should not be stored. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencenone?language=objc. + none, + + /// The credential should be stored only for this session. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistenceforsession?language=objc. + session, + + /// The credential should be stored in the keychain. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencepermanent?language=objc. + permanent, + + /// The credential should be stored permanently in the keychain, and in + /// addition should be distributed to other devices based on the owning Apple + /// ID. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencesynchronizable?language=objc. + synchronizable, +} + class NSKeyValueObservingOptionsEnumData { NSKeyValueObservingOptionsEnumData({ required this.value, @@ -497,13 +567,17 @@ class WKNavigationActionData { class WKFrameInfoData { WKFrameInfoData({ required this.isMainFrame, + required this.request, }); bool isMainFrame; + NSUrlRequestData request; + Object encode() { return [ isMainFrame, + request.encode(), ]; } @@ -511,6 +585,7 @@ class WKFrameInfoData { result as List; return WKFrameInfoData( isMainFrame: result[0]! as bool, + request: NSUrlRequestData.decode(result[1]! as List), ); } } @@ -673,6 +748,33 @@ class ObjectOrIdentifier { } } +class AuthenticationChallengeResponse { + AuthenticationChallengeResponse({ + required this.disposition, + this.credentialIdentifier, + }); + + NSUrlSessionAuthChallengeDisposition disposition; + + int? credentialIdentifier; + + Object encode() { + return [ + disposition.index, + credentialIdentifier, + ]; + } + + static AuthenticationChallengeResponse decode(Object result) { + result as List; + return AuthenticationChallengeResponse( + disposition: + NSUrlSessionAuthChallengeDisposition.values[result[0]! as int], + credentialIdentifier: result[1] as int?, + ); + } +} + class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _WKWebsiteDataStoreHostApiCodec(); @override @@ -711,18 +813,18 @@ class WKWebsiteDataStoreHostApi { Future createFromWebViewConfiguration( int arg_identifier, int arg_configurationIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -735,17 +837,17 @@ class WKWebsiteDataStoreHostApi { } Future createDefaultDataStore(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createDefaultDataStore'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -761,20 +863,20 @@ class WKWebsiteDataStoreHostApi { int arg_identifier, List arg_dataTypes, double arg_modificationTimeInSecondsSinceEpoch) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.removeDataOfTypes'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.removeDataOfTypes', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([ arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch ]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -806,17 +908,17 @@ class UIViewHostApi { static const MessageCodec codec = StandardMessageCodec(); Future setBackgroundColor(int arg_identifier, int? arg_value) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setBackgroundColor'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setBackgroundColor', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_value]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -829,17 +931,17 @@ class UIViewHostApi { } Future setOpaque(int arg_identifier, bool arg_opaque) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setOpaque'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setOpaque', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_opaque]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -867,18 +969,18 @@ class UIScrollViewHostApi { Future createFromWebView( int arg_identifier, int arg_webViewIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.createFromWebView'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -891,17 +993,17 @@ class UIScrollViewHostApi { } Future> getContentOffset(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.getContentOffset'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.getContentOffset', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -919,17 +1021,17 @@ class UIScrollViewHostApi { } Future scrollBy(int arg_identifier, double arg_x, double arg_y) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.scrollBy'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.scrollBy', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -943,17 +1045,42 @@ class UIScrollViewHostApi { Future setContentOffset( int arg_identifier, double arg_x, double arg_y) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setContentOffset'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setContentOffset', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { + throw _createConnectionError(channelName); + } else if (replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); + } else { + return; + } + } + + Future setDelegate( + int arg_identifier, int? arg_uiScrollViewDelegateIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setDelegate'; + final BasicMessageChannel channel = BasicMessageChannel( + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); + final List? replyList = await channel + .send([arg_identifier, arg_uiScrollViewDelegateIdentifier]) + as List?; + if (replyList == null) { + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1004,17 +1131,17 @@ class WKWebViewConfigurationHostApi { _WKWebViewConfigurationHostApiCodec(); Future create(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.create'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1028,18 +1155,18 @@ class WKWebViewConfigurationHostApi { Future createFromWebView( int arg_identifier, int arg_webViewIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.createFromWebView'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1053,17 +1180,17 @@ class WKWebViewConfigurationHostApi { Future setAllowsInlineMediaPlayback( int arg_identifier, bool arg_allow) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_allow]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1077,17 +1204,17 @@ class WKWebViewConfigurationHostApi { Future setLimitsNavigationsToAppBoundDomains( int arg_identifier, bool arg_limit) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setLimitsNavigationsToAppBoundDomains'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setLimitsNavigationsToAppBoundDomains', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_limit]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1101,17 +1228,17 @@ class WKWebViewConfigurationHostApi { Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, List arg_types) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_types]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1149,8 +1276,15 @@ abstract class WKWebViewConfigurationFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1201,18 +1335,18 @@ class WKUserContentControllerHostApi { Future createFromWebViewConfiguration( int arg_identifier, int arg_configurationIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.createFromWebViewConfiguration'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1226,18 +1360,18 @@ class WKUserContentControllerHostApi { Future addScriptMessageHandler( int arg_identifier, int arg_handlerIdentifier, String arg_name) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addScriptMessageHandler'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_handlerIdentifier, arg_name]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1251,17 +1385,17 @@ class WKUserContentControllerHostApi { Future removeScriptMessageHandler( int arg_identifier, String arg_name) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeScriptMessageHandler'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_name]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1274,17 +1408,17 @@ class WKUserContentControllerHostApi { } Future removeAllScriptMessageHandlers(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllScriptMessageHandlers'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1298,17 +1432,17 @@ class WKUserContentControllerHostApi { Future addUserScript( int arg_identifier, WKUserScriptData arg_userScript) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addUserScript'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_userScript]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1321,17 +1455,17 @@ class WKUserContentControllerHostApi { } Future removeAllUserScripts(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllUserScripts'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1359,18 +1493,18 @@ class WKPreferencesHostApi { Future createFromWebViewConfiguration( int arg_identifier, int arg_configurationIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.createFromWebViewConfiguration'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1384,17 +1518,17 @@ class WKPreferencesHostApi { Future setJavaScriptEnabled( int arg_identifier, bool arg_enabled) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.setJavaScriptEnabled'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.setJavaScriptEnabled', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_enabled]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1421,17 +1555,17 @@ class WKScriptMessageHandlerHostApi { static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerHostApi.create'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1501,9 +1635,16 @@ abstract class WKScriptMessageHandlerFlutterApi { (args[2] as WKScriptMessageData?); assert(arg_message != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, - arg_userContentControllerIdentifier!, arg_message!); - return; + try { + api.didReceiveScriptMessage(arg_identifier!, + arg_userContentControllerIdentifier!, arg_message!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1524,17 +1665,17 @@ class WKNavigationDelegateHostApi { static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateHostApi.create'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1551,21 +1692,24 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NSErrorData) { + if (value is AuthenticationChallengeResponse) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else if (value is NSErrorData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(132); writeValue(buffer, value.encode()); + } else if (value is WKNavigationActionPolicyEnumData) { + buffer.putUint8(133); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1575,14 +1719,16 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return NSErrorData.decode(readValue(buffer)!); + return AuthenticationChallengeResponse.decode(readValue(buffer)!); case 129: - return NSUrlRequestData.decode(readValue(buffer)!); + return NSErrorData.decode(readValue(buffer)!); case 130: - return WKFrameInfoData.decode(readValue(buffer)!); + return NSUrlRequestData.decode(readValue(buffer)!); case 131: - return WKNavigationActionData.decode(readValue(buffer)!); + return WKFrameInfoData.decode(readValue(buffer)!); case 132: + return WKNavigationActionData.decode(readValue(buffer)!); + case 133: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1616,6 +1762,9 @@ abstract class WKNavigationDelegateFlutterApi { void webViewWebContentProcessDidTerminate( int identifier, int webViewIdentifier); + Future didReceiveAuthenticationChallenge( + int identifier, int webViewIdentifier, int challengeIdentifier); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1637,9 +1786,16 @@ abstract class WKNavigationDelegateFlutterApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); - return; + try { + api.didFinishNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1662,9 +1818,16 @@ abstract class WKNavigationDelegateFlutterApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); - return; + try { + api.didStartProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1690,10 +1853,17 @@ abstract class WKNavigationDelegateFlutterApi { (args[2] as WKNavigationActionData?); assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = - await api.decidePolicyForNavigationAction(arg_identifier!, - arg_webViewIdentifier!, arg_navigationAction!); - return output; + try { + final WKNavigationActionPolicyEnumData output = + await api.decidePolicyForNavigationAction(arg_identifier!, + arg_webViewIdentifier!, arg_navigationAction!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1718,9 +1888,16 @@ abstract class WKNavigationDelegateFlutterApi { final NSErrorData? arg_error = (args[2] as NSErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); - return; + try { + api.didFailNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1745,9 +1922,16 @@ abstract class WKNavigationDelegateFlutterApi { final NSErrorData? arg_error = (args[2] as NSErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); - return; + try { + api.didFailProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1769,9 +1953,51 @@ abstract class WKNavigationDelegateFlutterApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate( - arg_identifier!, arg_webViewIdentifier!); - return; + try { + api.webViewWebContentProcessDidTerminate( + arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge was null, expected non-null int.'); + final int? arg_webViewIdentifier = (args[1] as int?); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge was null, expected non-null int.'); + final int? arg_challengeIdentifier = (args[2] as int?); + assert(arg_challengeIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didReceiveAuthenticationChallenge was null, expected non-null int.'); + try { + final AuthenticationChallengeResponse output = + await api.didReceiveAuthenticationChallenge(arg_identifier!, + arg_webViewIdentifier!, arg_challengeIdentifier!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1815,17 +2041,17 @@ class NSObjectHostApi { static const MessageCodec codec = _NSObjectHostApiCodec(); Future dispose(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.dispose'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.dispose', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1842,10 +2068,13 @@ class NSObjectHostApi { int arg_observerIdentifier, String arg_keyPath, List arg_options) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.addObserver'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.addObserver', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([ arg_identifier, arg_observerIdentifier, @@ -1853,10 +2082,7 @@ class NSObjectHostApi { arg_options ]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1870,18 +2096,18 @@ class NSObjectHostApi { Future removeObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.removeObserver'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.removeObserver', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send( [arg_identifier, arg_observerIdentifier, arg_keyPath]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -1968,9 +2194,16 @@ abstract class NSObjectFlutterApi { (args[4] as List?)?.cast(); assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, - arg_changeKeys!, arg_changeValues!); - return; + try { + api.observeValue(arg_identifier!, arg_keyPath!, + arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1989,8 +2222,15 @@ abstract class NSObjectFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.dispose was null, expected non-null int.'); - api.dispose(arg_identifier!); - return; + try { + api.dispose(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2001,60 +2241,63 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { const _WKWebViewHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NSErrorData) { + if (value is AuthenticationChallengeResponse) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else if (value is NSErrorData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookieData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is ObjectOrIdentifier) { + } else if (value is NSUrlRequestData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is ObjectOrIdentifier) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKMediaCaptureTypeData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else if (value is WKMediaCaptureTypeData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKPermissionDecisionData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else if (value is WKPermissionDecisionData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is WKSecurityOriginData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else if (value is WKSecurityOriginData) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptData) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(145); writeValue(buffer, value.encode()); + } else if (value is WKWebsiteDataTypeEnumData) { + buffer.putUint8(146); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2064,40 +2307,42 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return NSErrorData.decode(readValue(buffer)!); + return AuthenticationChallengeResponse.decode(readValue(buffer)!); case 129: - return NSHttpCookieData.decode(readValue(buffer)!); + return NSErrorData.decode(readValue(buffer)!); case 130: - return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); + return NSHttpCookieData.decode(readValue(buffer)!); case 131: - return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); + return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); case 132: - return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); + return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); case 133: - return NSUrlRequestData.decode(readValue(buffer)!); + return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); case 134: - return ObjectOrIdentifier.decode(readValue(buffer)!); + return NSUrlRequestData.decode(readValue(buffer)!); case 135: - return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); + return ObjectOrIdentifier.decode(readValue(buffer)!); case 136: - return WKFrameInfoData.decode(readValue(buffer)!); + return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); case 137: - return WKMediaCaptureTypeData.decode(readValue(buffer)!); + return WKFrameInfoData.decode(readValue(buffer)!); case 138: - return WKNavigationActionData.decode(readValue(buffer)!); + return WKMediaCaptureTypeData.decode(readValue(buffer)!); case 139: - return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); + return WKNavigationActionData.decode(readValue(buffer)!); case 140: - return WKPermissionDecisionData.decode(readValue(buffer)!); + return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); case 141: - return WKScriptMessageData.decode(readValue(buffer)!); + return WKPermissionDecisionData.decode(readValue(buffer)!); case 142: - return WKSecurityOriginData.decode(readValue(buffer)!); + return WKScriptMessageData.decode(readValue(buffer)!); case 143: - return WKUserScriptData.decode(readValue(buffer)!); + return WKSecurityOriginData.decode(readValue(buffer)!); case 144: - return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); + return WKUserScriptData.decode(readValue(buffer)!); case 145: + return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); + case 146: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2120,18 +2365,18 @@ class WKWebViewHostApi { Future create( int arg_identifier, int arg_configurationIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.create'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2145,18 +2390,18 @@ class WKWebViewHostApi { Future setUIDelegate( int arg_identifier, int? arg_uiDelegateIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setUIDelegate'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setUIDelegate', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier, arg_uiDelegateIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2170,18 +2415,18 @@ class WKWebViewHostApi { Future setNavigationDelegate( int arg_identifier, int? arg_navigationDelegateIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setNavigationDelegate'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setNavigationDelegate', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_navigationDelegateIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2194,17 +2439,17 @@ class WKWebViewHostApi { } Future getUrl(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getUrl'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getUrl', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2217,17 +2462,17 @@ class WKWebViewHostApi { } Future getEstimatedProgress(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getEstimatedProgress'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getEstimatedProgress', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2246,17 +2491,17 @@ class WKWebViewHostApi { Future loadRequest( int arg_identifier, NSUrlRequestData arg_request) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadRequest'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadRequest', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_request]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2270,18 +2515,18 @@ class WKWebViewHostApi { Future loadHtmlString( int arg_identifier, String arg_string, String? arg_baseUrl) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadHtmlString'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadHtmlString', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier, arg_string, arg_baseUrl]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2295,18 +2540,18 @@ class WKWebViewHostApi { Future loadFileUrl( int arg_identifier, String arg_url, String arg_readAccessUrl) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFileUrl'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFileUrl', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_url, arg_readAccessUrl]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2319,17 +2564,17 @@ class WKWebViewHostApi { } Future loadFlutterAsset(int arg_identifier, String arg_key) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFlutterAsset'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFlutterAsset', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_key]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2342,17 +2587,17 @@ class WKWebViewHostApi { } Future canGoBack(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoBack'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoBack', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2370,17 +2615,17 @@ class WKWebViewHostApi { } Future canGoForward(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoForward'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoForward', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2398,17 +2643,17 @@ class WKWebViewHostApi { } Future goBack(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goBack'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goBack', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2421,17 +2666,17 @@ class WKWebViewHostApi { } Future goForward(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goForward'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goForward', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2444,17 +2689,17 @@ class WKWebViewHostApi { } Future reload(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.reload'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.reload', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2467,17 +2712,17 @@ class WKWebViewHostApi { } Future getTitle(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getTitle'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getTitle', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2491,17 +2736,17 @@ class WKWebViewHostApi { Future setAllowsBackForwardNavigationGestures( int arg_identifier, bool arg_allow) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setAllowsBackForwardNavigationGestures'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_allow]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2515,17 +2760,17 @@ class WKWebViewHostApi { Future setCustomUserAgent( int arg_identifier, String? arg_userAgent) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setCustomUserAgent'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setCustomUserAgent', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_userAgent]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2539,18 +2784,18 @@ class WKWebViewHostApi { Future evaluateJavaScript( int arg_identifier, String arg_javaScriptString) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.evaluateJavaScript'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.evaluateJavaScript', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier, arg_javaScriptString]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2563,17 +2808,40 @@ class WKWebViewHostApi { } Future setInspectable(int arg_identifier, bool arg_inspectable) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setInspectable'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setInspectable', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_inspectable]) as List?; if (replyList == null) { + throw _createConnectionError(channelName); + } else if (replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); + } else { + return; + } + } + + Future getCustomUserAgent(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent'; + final BasicMessageChannel channel = BasicMessageChannel( + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2581,7 +2849,7 @@ class WKWebViewHostApi { details: replyList[2], ); } else { - return; + return (replyList[0] as String?); } } } @@ -2600,17 +2868,17 @@ class WKUIDelegateHostApi { static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateHostApi.create'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateHostApi.create', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2688,6 +2956,18 @@ abstract class WKUIDelegateFlutterApi { WKFrameInfoData frame, WKMediaCaptureTypeData type); + /// Callback to Dart function `WKUIDelegate.runJavaScriptAlertPanel`. + Future runJavaScriptAlertPanel( + int identifier, String message, WKFrameInfoData frame); + + /// Callback to Dart function `WKUIDelegate.runJavaScriptConfirmPanel`. + Future runJavaScriptConfirmPanel( + int identifier, String message, WKFrameInfoData frame); + + /// Callback to Dart function `WKUIDelegate.runJavaScriptTextInputPanel`. + Future runJavaScriptTextInputPanel( + int identifier, String prompt, String defaultText, WKFrameInfoData frame); + static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -2715,9 +2995,16 @@ abstract class WKUIDelegateFlutterApi { (args[3] as WKNavigationActionData?); assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, - arg_configurationIdentifier!, arg_navigationAction!); - return; + try { + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, + arg_configurationIdentifier!, arg_navigationAction!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2750,10 +3037,122 @@ abstract class WKUIDelegateFlutterApi { (args[4] as WKMediaCaptureTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.requestMediaCapturePermission was null, expected non-null WKMediaCaptureTypeData.'); - final WKPermissionDecisionData output = - await api.requestMediaCapturePermission(arg_identifier!, - arg_webViewIdentifier!, arg_origin!, arg_frame!, arg_type!); - return output; + try { + final WKPermissionDecisionData output = + await api.requestMediaCapturePermission(arg_identifier!, + arg_webViewIdentifier!, arg_origin!, arg_frame!, arg_type!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptAlertPanel', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptAlertPanel was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptAlertPanel was null, expected non-null int.'); + final String? arg_message = (args[1] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptAlertPanel was null, expected non-null String.'); + final WKFrameInfoData? arg_frame = (args[2] as WKFrameInfoData?); + assert(arg_frame != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptAlertPanel was null, expected non-null WKFrameInfoData.'); + try { + await api.runJavaScriptAlertPanel( + arg_identifier!, arg_message!, arg_frame!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptConfirmPanel', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptConfirmPanel was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptConfirmPanel was null, expected non-null int.'); + final String? arg_message = (args[1] as String?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptConfirmPanel was null, expected non-null String.'); + final WKFrameInfoData? arg_frame = (args[2] as WKFrameInfoData?); + assert(arg_frame != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptConfirmPanel was null, expected non-null WKFrameInfoData.'); + try { + final bool output = await api.runJavaScriptConfirmPanel( + arg_identifier!, arg_message!, arg_frame!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel was null, expected non-null int.'); + final String? arg_prompt = (args[1] as String?); + assert(arg_prompt != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel was null, expected non-null String.'); + final String? arg_defaultText = (args[2] as String?); + assert(arg_defaultText != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel was null, expected non-null String.'); + final WKFrameInfoData? arg_frame = (args[3] as WKFrameInfoData?); + assert(arg_frame != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.runJavaScriptTextInputPanel was null, expected non-null WKFrameInfoData.'); + try { + final String output = await api.runJavaScriptTextInputPanel( + arg_identifier!, arg_prompt!, arg_defaultText!, arg_frame!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2803,18 +3202,18 @@ class WKHttpCookieStoreHostApi { Future createFromWebsiteDataStore( int arg_identifier, int arg_websiteDataStoreIdentifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.createFromWebsiteDataStore'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_websiteDataStoreIdentifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2828,17 +3227,17 @@ class WKHttpCookieStoreHostApi { Future setCookie( int arg_identifier, NSHttpCookieData arg_cookie) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.setCookie'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.setCookie', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel .send([arg_identifier, arg_cookie]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2869,17 +3268,17 @@ class NSUrlHostApi { static const MessageCodec codec = StandardMessageCodec(); Future getAbsoluteString(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlHostApi.getAbsoluteString'; final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlHostApi.getAbsoluteString', - codec, - binaryMessenger: _binaryMessenger); + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); final List? replyList = await channel.send([arg_identifier]) as List?; if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); + throw _createConnectionError(channelName); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, @@ -2920,8 +3319,252 @@ abstract class NSUrlFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + +/// Host API for `UIScrollViewDelegate`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +class UIScrollViewDelegateHostApi { + /// Constructor for [UIScrollViewDelegateHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + UIScrollViewDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future create(int arg_identifier) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateHostApi.create'; + final BasicMessageChannel channel = BasicMessageChannel( + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw _createConnectionError(channelName); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `UIScrollViewDelegate`. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +abstract class UIScrollViewDelegateFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + void scrollViewDidScroll( + int identifier, int uiScrollViewIdentifier, double x, double y); + + static void setup(UIScrollViewDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll was null, expected non-null int.'); + final int? arg_uiScrollViewIdentifier = (args[1] as int?); + assert(arg_uiScrollViewIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll was null, expected non-null int.'); + final double? arg_x = (args[2] as double?); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll was null, expected non-null double.'); + final double? arg_y = (args[3] as double?); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateFlutterApi.scrollViewDidScroll was null, expected non-null double.'); + try { + api.scrollViewDidScroll( + arg_identifier!, arg_uiScrollViewIdentifier!, arg_x!, arg_y!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + +/// Host API for `NSUrlCredential`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlcredential?language=objc. +class NSUrlCredentialHostApi { + /// Constructor for [NSUrlCredentialHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + NSUrlCredentialHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + Future createWithUser(int arg_identifier, String arg_user, + String arg_password, NSUrlCredentialPersistence arg_persistence) async { + const String channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser'; + final BasicMessageChannel channel = BasicMessageChannel( + channelName, + codec, + binaryMessenger: _binaryMessenger, + ); + final List? replyList = await channel.send([ + arg_identifier, + arg_user, + arg_password, + arg_persistence.index + ]) as List?; + if (replyList == null) { + throw _createConnectionError(channelName); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `NSUrlProtectionSpace`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlprotectionspace?language=objc. +abstract class NSUrlProtectionSpaceFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier, String? host, String? realm, + String? authenticationMethod); + + static void setup(NSUrlProtectionSpaceFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlProtectionSpaceFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlProtectionSpaceFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlProtectionSpaceFlutterApi.create was null, expected non-null int.'); + final String? arg_host = (args[1] as String?); + final String? arg_realm = (args[2] as String?); + final String? arg_authenticationMethod = (args[3] as String?); + try { + api.create( + arg_identifier!, arg_host, arg_realm, arg_authenticationMethod); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + +/// Flutter API for `NSUrlAuthenticationChallenge`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlauthenticationchallenge?language=objc. +abstract class NSUrlAuthenticationChallengeFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier, int protectionSpaceIdentifier); + + static void setup(NSUrlAuthenticationChallengeFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlAuthenticationChallengeFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlAuthenticationChallengeFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlAuthenticationChallengeFlutterApi.create was null, expected non-null int.'); + final int? arg_protectionSpaceIdentifier = (args[1] as int?); + assert(arg_protectionSpaceIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlAuthenticationChallengeFlutterApi.create was null, expected non-null int.'); + try { + api.create(arg_identifier!, arg_protectionSpaceIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index 3fe1a57c1b2edf20bd69fb98f5a3db7263910261..5c6d61aa8f7e695528f6c593d08ec9ded1ca86f0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -9,6 +9,9 @@ import '../common/instance_manager.dart'; import '../common/weak_reference_utils.dart'; import 'foundation_api_impls.dart'; +export 'foundation_api_impls.dart' + show NSUrlCredentialPersistence, NSUrlSessionAuthChallengeDisposition; + /// The values that can be returned in a change map. /// /// Wraps [NSKeyValueObservingOptions](https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc). @@ -387,3 +390,131 @@ class NSObject with Copyable { ); } } + +/// An authentication credential consisting of information specific to the type +/// of credential and the type of persistent storage to use, if any. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlcredential?language=objc. +class NSUrlCredential extends NSObject { + /// Creates a URL credential instance for internet password authentication + /// with a given user name and password, using a given persistence setting. + NSUrlCredential.withUser({ + required String user, + required String password, + required NSUrlCredentialPersistence persistence, + @visibleForTesting super.binaryMessenger, + @visibleForTesting super.instanceManager, + }) : _urlCredentialApi = NSUrlCredentialHostApiImpl( + binaryMessenger: binaryMessenger, instanceManager: instanceManager), + super.detached() { + // Ensures Flutter Apis are setup. + FoundationFlutterApis.instance.ensureSetUp(); + _urlCredentialApi.createWithUserFromInstances( + this, + user, + password, + persistence, + ); + } + + /// Instantiates a [NSUrlCredential] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + NSUrlCredential.detached({super.binaryMessenger, super.instanceManager}) + : _urlCredentialApi = NSUrlCredentialHostApiImpl( + binaryMessenger: binaryMessenger, instanceManager: instanceManager), + super.detached(); + + final NSUrlCredentialHostApiImpl _urlCredentialApi; + + @override + NSObject copy() { + return NSUrlCredential.detached( + binaryMessenger: _urlCredentialApi.binaryMessenger, + instanceManager: _urlCredentialApi.instanceManager, + ); + } +} + +/// A server or an area on a server, commonly referred to as a realm, that +/// requires authentication. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlprotectionspace?language=objc. +class NSUrlProtectionSpace extends NSObject { + /// Instantiates a [NSUrlProtectionSpace] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + NSUrlProtectionSpace.detached({ + required this.host, + required this.realm, + required this.authenticationMethod, + super.binaryMessenger, + super.instanceManager, + }) : super.detached(); + + /// The receiver’s host. + final String? host; + + /// The receiver’s authentication realm. + final String? realm; + + /// The authentication method used by the receiver. + final String? authenticationMethod; + + @override + NSUrlProtectionSpace copy() { + return NSUrlProtectionSpace.detached( + host: host, + realm: realm, + authenticationMethod: authenticationMethod, + ); + } +} + +/// The authentication method used by the receiver. +class NSUrlAuthenticationMethod { + /// Use the default authentication method for a protocol. + static const String default_ = 'NSURLAuthenticationMethodDefault'; + + /// Use HTML form authentication for this protection space. + static const String htmlForm = 'NSURLAuthenticationMethodHTMLForm'; + + /// Use HTTP basic authentication for this protection space. + static const String httpBasic = 'NSURLAuthenticationMethodHTTPBasic'; + + /// Use HTTP digest authentication for this protection space. + static const String httpDigest = 'NSURLAuthenticationMethodHTTPDigest'; +} + +/// A challenge from a server requiring authentication from the client. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlauthenticationchallenge?language=objc. +class NSUrlAuthenticationChallenge extends NSObject { + /// Instantiates a [NSUrlAuthenticationChallenge] without creating and + /// attaching to an instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + NSUrlAuthenticationChallenge.detached({ + required this.protectionSpace, + super.binaryMessenger, + super.instanceManager, + }) : super.detached(); + + /// The receiver’s protection space. + late final NSUrlProtectionSpace protectionSpace; + + @override + NSUrlAuthenticationChallenge copy() { + return NSUrlAuthenticationChallenge.detached( + protectionSpace: protectionSpace, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart index 4f73c0825580e063926c7b77c2867960e5226858..2a0e4a54d50f81d1900384b64262e90084dec677 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart @@ -9,6 +9,9 @@ import '../common/instance_manager.dart'; import '../common/web_kit.g.dart'; import 'foundation.dart'; +export '../common/web_kit.g.dart' + show NSUrlCredentialPersistence, NSUrlSessionAuthChallengeDisposition; + Iterable _toNSKeyValueObservingOptionsEnumData( Iterable options, @@ -56,6 +59,14 @@ class FoundationFlutterApis { url = NSUrlFlutterApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, + ), + urlProtectionSpace = NSUrlProtectionSpaceFlutterApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + urlAuthenticationChallenge = NSUrlAuthenticationChallengeFlutterApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, ); static FoundationFlutterApis _instance = FoundationFlutterApis(); @@ -82,6 +93,14 @@ class FoundationFlutterApis { @visibleForTesting final NSUrlFlutterApiImpl url; + /// Flutter Api for [NSUrlProtectionSpace]. + @visibleForTesting + final NSUrlProtectionSpaceFlutterApiImpl urlProtectionSpace; + + /// Flutter Api for [NSUrlAuthenticationChallenge]. + @visibleForTesting + final NSUrlAuthenticationChallengeFlutterApiImpl urlAuthenticationChallenge; + /// Ensures all the Flutter APIs have been set up to receive calls from native code. void ensureSetUp() { if (!_hasBeenSetUp) { @@ -90,6 +109,14 @@ class FoundationFlutterApis { binaryMessenger: _binaryMessenger, ); NSUrlFlutterApi.setup(url, binaryMessenger: _binaryMessenger); + NSUrlProtectionSpaceFlutterApi.setup( + urlProtectionSpace, + binaryMessenger: _binaryMessenger, + ); + NSUrlAuthenticationChallengeFlutterApi.setup( + urlAuthenticationChallenge, + binaryMessenger: _binaryMessenger, + ); _hasBeenSetUp = true; } } @@ -249,3 +276,121 @@ class NSUrlFlutterApiImpl implements NSUrlFlutterApi { ); } } + +/// Host api implementation for [NSUrlCredential]. +class NSUrlCredentialHostApiImpl extends NSUrlCredentialHostApi { + /// Constructs an [NSUrlCredentialHostApiImpl]. + NSUrlCredentialHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with Objective-C objects. + final InstanceManager instanceManager; + + /// Calls [createWithUser] with the ids of the provided object instances. + Future createWithUserFromInstances( + NSUrlCredential instance, + String user, + String password, + NSUrlCredentialPersistence persistence, + ) { + return createWithUser( + instanceManager.addDartCreatedInstance(instance), + user, + password, + persistence, + ); + } +} + +/// Flutter API implementation for [NSUrlProtectionSpace]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +@protected +class NSUrlProtectionSpaceFlutterApiImpl + implements NSUrlProtectionSpaceFlutterApi { + /// Constructs a [NSUrlProtectionSpaceFlutterApiImpl]. + NSUrlProtectionSpaceFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create( + int identifier, + String? host, + String? realm, + String? authenticationMethod, + ) { + instanceManager.addHostCreatedInstance( + NSUrlProtectionSpace.detached( + host: host, + realm: realm, + authenticationMethod: authenticationMethod, + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + +/// Flutter API implementation for [NSUrlAuthenticationChallenge]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +@protected +class NSUrlAuthenticationChallengeFlutterApiImpl + implements NSUrlAuthenticationChallengeFlutterApi { + /// Constructs a [NSUrlAuthenticationChallengeFlutterApiImpl]. + NSUrlAuthenticationChallengeFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create( + int identifier, + int protectionSpaceIdentifier, + ) { + instanceManager.addHostCreatedInstance( + NSUrlAuthenticationChallenge.detached( + protectionSpace: instanceManager.getInstanceWithWeakReference( + protectionSpaceIdentifier, + )!, + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart index c05f699e87ac304d1bf8b653c114053bf6399066..b3f5ebe79f6e7a3386171b55ad38588c0d5a9a70 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:math'; import 'package:flutter/foundation.dart'; @@ -10,6 +11,7 @@ import 'package:flutter/services.dart'; import '../common/instance_manager.dart'; import '../foundation/foundation.dart'; import '../web_kit/web_kit.dart'; +import '../web_kit/web_kit_api_impls.dart'; import 'ui_kit_api_impls.dart'; /// A view that allows the scrolling and zooming of its contained views. @@ -75,6 +77,13 @@ class UIScrollView extends UIView { return _scrollViewApi.setContentOffsetForInstances(this, offset); } + /// Set the delegate to this scroll view. + /// + /// Represents [UIScrollView.delegate](https://developer.apple.com/documentation/uikit/uiscrollview/1619430-delegate?language=objc). + Future setDelegate(UIScrollViewDelegate? delegate) { + return _scrollViewApi.setDelegateForInstances(this, delegate); + } + @override UIScrollView copy() { return UIScrollView.detached( @@ -132,3 +141,59 @@ class UIView extends NSObject { ); } } + +/// Responding to scroll view interactions. +/// +/// Represent [UIScrollViewDelegate](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc). +@immutable +class UIScrollViewDelegate extends NSObject { + /// Constructs a [UIScrollViewDelegate]. + UIScrollViewDelegate({ + this.scrollViewDidScroll, + super.binaryMessenger, + super.instanceManager, + }) : _scrollViewDelegateApi = UIScrollViewDelegateHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached() { + // Ensures FlutterApis for the WebKit library are set up. + WebKitFlutterApis.instance.ensureSetUp(); + _scrollViewDelegateApi.createForInstance(this); + } + + /// Constructs a [UIScrollViewDelegate] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + UIScrollViewDelegate.detached({ + this.scrollViewDidScroll, + super.binaryMessenger, + super.instanceManager, + }) : _scrollViewDelegateApi = UIScrollViewDelegateHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + + final UIScrollViewDelegateHostApiImpl _scrollViewDelegateApi; + + /// Called when scroll view did scroll. + /// + /// {@macro webview_flutter_wkwebview.foundation.callbacks} + final void Function( + UIScrollView scrollView, + double x, + double y, + )? scrollViewDidScroll; + + @override + UIScrollViewDelegate copy() { + return UIScrollViewDelegate.detached( + scrollViewDidScroll: scrollViewDidScroll, + binaryMessenger: _scrollViewDelegateApi.binaryMessenger, + instanceManager: _scrollViewDelegateApi.instanceManager, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart index 4672537ef51c30d7b387ddf8069214e4276cb898..6f15f7d6a9a6b6970ce14e5671ccb7ee9baf9612 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart @@ -75,6 +75,17 @@ class UIScrollViewHostApiImpl extends UIScrollViewHostApi { offset.y, ); } + + /// Calls [setDelegate] with the ids of the provided object instances. + Future setDelegateForInstances( + UIScrollView instance, + UIScrollViewDelegate? delegate, + ) async { + return setDelegate( + instanceManager.getIdentifier(instance)!, + delegate != null ? instanceManager.getIdentifier(delegate) : null, + ); + } } /// Host api implementation for [UIView]. @@ -114,3 +125,57 @@ class UIViewHostApiImpl extends UIViewHostApi { return setOpaque(instanceManager.getIdentifier(instance)!, opaque); } } + +/// Flutter api implementation for [UIScrollViewDelegate]. +class UIScrollViewDelegateFlutterApiImpl + extends UIScrollViewDelegateFlutterApi { + /// Constructs a [UIScrollViewDelegateFlutterApiImpl]. + UIScrollViewDelegateFlutterApiImpl({InstanceManager? instanceManager}) + : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + UIScrollViewDelegate _getDelegate(int identifier) { + return instanceManager.getInstanceWithWeakReference(identifier)!; + } + + @override + void scrollViewDidScroll( + int identifier, + int uiScrollViewIdentifier, + double x, + double y, + ) { + final void Function(UIScrollView, double, double)? callback = + _getDelegate(identifier).scrollViewDidScroll; + final UIScrollView? uiScrollView = instanceManager + .getInstanceWithWeakReference(uiScrollViewIdentifier) as UIScrollView?; + assert(uiScrollView != null); + callback?.call(uiScrollView!, x, y); + } +} + +/// Host api implementation for [UIScrollViewDelegate]. +class UIScrollViewDelegateHostApiImpl extends UIScrollViewDelegateHostApi { + /// Constructs a [UIScrollViewDelegateHostApiImpl]. + UIScrollViewDelegateHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with Objective-C objects. + final InstanceManager instanceManager; + + /// Calls [create] with the ids of the provided object instances. + Future createForInstance(UIScrollViewDelegate instance) async { + return create(instanceManager.addDartCreatedInstance(instance)); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart index 714739c7a6f5d76e09c71951500ee7beb2ba3a84..fb99be0940ef11e0f19d55e1a198585778682f69 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart @@ -11,7 +11,7 @@ import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; export 'web_kit_api_impls.dart' - show WKNavigationType, WKPermissionDecision, WKMediaCaptureType; + show WKMediaCaptureType, WKNavigationType, WKPermissionDecision; /// Times at which to inject script content into a webpage. /// @@ -172,10 +172,16 @@ class WKNavigationAction { @immutable class WKFrameInfo { /// Construct a [WKFrameInfo]. - const WKFrameInfo({required this.isMainFrame}); + const WKFrameInfo({ + required this.isMainFrame, + required this.request, + }); /// Indicates whether the frame is the web site's main frame or a subframe. final bool isMainFrame; + + /// The URL request object associated with the navigation action. + final NSUrlRequest request; } /// A script that the web view injects into a webpage. @@ -728,6 +734,9 @@ class WKUIDelegate extends NSObject { WKUIDelegate({ this.onCreateWebView, this.requestMediaCapturePermission, + this.runJavaScriptAlertDialog, + this.runJavaScriptConfirmDialog, + this.runJavaScriptTextInputDialog, super.observeValue, super.binaryMessenger, super.instanceManager, @@ -749,6 +758,9 @@ class WKUIDelegate extends NSObject { WKUIDelegate.detached({ this.onCreateWebView, this.requestMediaCapturePermission, + this.runJavaScriptAlertDialog, + this.runJavaScriptConfirmDialog, + this.runJavaScriptTextInputDialog, super.observeValue, super.binaryMessenger, super.instanceManager, @@ -780,11 +792,30 @@ class WKUIDelegate extends NSObject { WKMediaCaptureType type, )? requestMediaCapturePermission; + /// Notifies the host application that the web page + /// wants to display a JavaScript alert() dialog. + final Future Function(String message, WKFrameInfo frame)? + runJavaScriptAlertDialog; + + /// Notifies the host application that the web page + /// wants to display a JavaScript confirm() dialog. + final Future Function(String message, WKFrameInfo frame)? + runJavaScriptConfirmDialog; + + /// Notifies the host application that the web page + /// wants to display a JavaScript prompt() dialog. + final Future Function( + String prompt, String defaultText, WKFrameInfo frame)? + runJavaScriptTextInputDialog; + @override WKUIDelegate copy() { return WKUIDelegate.detached( onCreateWebView: onCreateWebView, requestMediaCapturePermission: requestMediaCapturePermission, + runJavaScriptAlertDialog: runJavaScriptAlertDialog, + runJavaScriptConfirmDialog: runJavaScriptConfirmDialog, + runJavaScriptTextInputDialog: runJavaScriptTextInputDialog, observeValue: observeValue, binaryMessenger: _uiDelegateApi.binaryMessenger, instanceManager: _uiDelegateApi.instanceManager, @@ -830,6 +861,7 @@ class WKNavigationDelegate extends NSObject { this.didFailNavigation, this.didFailProvisionalNavigation, this.webViewWebContentProcessDidTerminate, + this.didReceiveAuthenticationChallenge, super.observeValue, super.binaryMessenger, super.instanceManager, @@ -855,6 +887,7 @@ class WKNavigationDelegate extends NSObject { this.didFailNavigation, this.didFailProvisionalNavigation, this.webViewWebContentProcessDidTerminate, + this.didReceiveAuthenticationChallenge, super.observeValue, super.binaryMessenger, super.instanceManager, @@ -901,6 +934,16 @@ class WKNavigationDelegate extends NSObject { /// {@macro webview_flutter_wkwebview.foundation.callbacks} final void Function(WKWebView webView)? webViewWebContentProcessDidTerminate; + /// Called when the delegate needs a response to an authentication challenge. + final void Function( + WKWebView webView, + NSUrlAuthenticationChallenge challenge, + void Function( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ) completionHandler, + )? didReceiveAuthenticationChallenge; + @override WKNavigationDelegate copy() { return WKNavigationDelegate.detached( @@ -911,6 +954,7 @@ class WKNavigationDelegate extends NSObject { didFailProvisionalNavigation: didFailProvisionalNavigation, webViewWebContentProcessDidTerminate: webViewWebContentProcessDidTerminate, + didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, observeValue: observeValue, binaryMessenger: _navigationDelegateApi.binaryMessenger, instanceManager: _navigationDelegateApi.instanceManager, @@ -1125,6 +1169,13 @@ class WKWebView extends UIView { ); } + /// The custom user agent string. + /// + /// Represents [WKWebView.customUserAgent](https://developer.apple.com/documentation/webkit/wkwebview/1414950-customuseragent?language=objc). + Future getCustomUserAgent() { + return _webViewApi.getCustomUserAgentForInstances(this); + } + @override WKWebView copy() { return WKWebView.detached( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart index ccc87377cb041c90f37bd487f1a832e3821b594d..3680f632714810f4f3bfe67456ae81d382b36f41 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart @@ -2,16 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import '../common/instance_manager.dart'; import '../common/web_kit.g.dart'; import '../foundation/foundation.dart'; +import '../ui_kit/ui_kit.dart'; +import '../ui_kit/ui_kit_api_impls.dart'; import 'web_kit.dart'; export '../common/web_kit.g.dart' - show WKNavigationType, WKPermissionDecision, WKMediaCaptureType; + show WKMediaCaptureType, WKNavigationType, WKPermissionDecision; Iterable _toWKWebsiteDataTypeEnumData( Iterable types) { @@ -179,7 +183,10 @@ extension _NavigationActionDataConverter on WKNavigationActionData { extension _WKFrameInfoDataConverter on WKFrameInfoData { WKFrameInfo toWKFrameInfo() { - return WKFrameInfo(isMainFrame: isMainFrame); + return WKFrameInfo( + isMainFrame: isMainFrame, + request: request.toNSUrlRequest(), + ); } } @@ -257,6 +264,9 @@ class WebKitFlutterApis { webViewConfiguration = WKWebViewConfigurationFlutterApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, + ), + uiScrollViewDelegate = UIScrollViewDelegateFlutterApiImpl( + instanceManager: instanceManager, ); static WebKitFlutterApis _instance = WebKitFlutterApis(); @@ -291,6 +301,10 @@ class WebKitFlutterApis { @visibleForTesting final WKWebViewConfigurationFlutterApiImpl webViewConfiguration; + /// Flutter Api for [UIScrollViewDelegate]. + @visibleForTesting + final UIScrollViewDelegateFlutterApiImpl uiScrollViewDelegate; + /// Ensures all the Flutter APIs have been set up to receive calls from native code. void ensureSetUp() { if (!_hasBeenSetUp) { @@ -310,6 +324,8 @@ class WebKitFlutterApis { webViewConfiguration, binaryMessenger: _binaryMessenger, ); + UIScrollViewDelegateFlutterApi.setup(uiScrollViewDelegate, + binaryMessenger: _binaryMessenger); _hasBeenSetUp = true; } } @@ -767,6 +783,33 @@ class WKUIDelegateFlutterApiImpl extends WKUIDelegateFlutterApi { return WKPermissionDecisionData(value: decision); } + + @override + Future runJavaScriptAlertPanel( + int identifier, String message, WKFrameInfoData frame) { + final WKUIDelegate instance = + instanceManager.getInstanceWithWeakReference(identifier)!; + return instance.runJavaScriptAlertDialog! + .call(message, frame.toWKFrameInfo()); + } + + @override + Future runJavaScriptConfirmPanel( + int identifier, String message, WKFrameInfoData frame) { + final WKUIDelegate instance = + instanceManager.getInstanceWithWeakReference(identifier)!; + return instance.runJavaScriptConfirmDialog! + .call(message, frame.toWKFrameInfo()); + } + + @override + Future runJavaScriptTextInputPanel(int identifier, String prompt, + String defaultText, WKFrameInfoData frame) { + final WKUIDelegate instance = + instanceManager.getInstanceWithWeakReference(identifier)!; + return instance.runJavaScriptTextInputDialog! + .call(prompt, defaultText, frame.toWKFrameInfo()); + } } /// Host api implementation for [WKNavigationDelegate]. @@ -904,6 +947,53 @@ class WKNavigationDelegateFlutterApiImpl as WKWebView, ); } + + @override + Future didReceiveAuthenticationChallenge( + int identifier, + int webViewIdentifier, + int challengeIdentifier, + ) async { + final void Function( + WKWebView webView, + NSUrlAuthenticationChallenge challenge, + void Function( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ), + )? function = _getDelegate(identifier).didReceiveAuthenticationChallenge; + + if (function == null) { + return AuthenticationChallengeResponse( + disposition: NSUrlSessionAuthChallengeDisposition.rejectProtectionSpace, + ); + } + + final Completer responseCompleter = + Completer(); + + function.call( + instanceManager.getInstanceWithWeakReference(webViewIdentifier)! + as WKWebView, + instanceManager.getInstanceWithWeakReference(challengeIdentifier)! + as NSUrlAuthenticationChallenge, + ( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ) { + responseCompleter.complete( + AuthenticationChallengeResponse( + disposition: disposition, + credentialIdentifier: credential != null + ? instanceManager.getIdentifier(credential) + : null, + ), + ); + }, + ); + + return responseCompleter.future; + } } /// Host api implementation for [WKWebView]. @@ -1078,6 +1168,11 @@ class WKWebViewHostApiImpl extends WKWebViewHostApi { ); } + /// Calls [getCustomUserAgent] with the ids of the provided object instances. + Future getCustomUserAgentForInstances(WKWebView instance) { + return getCustomUserAgent(instanceManager.getIdentifier(instance)!); + } + /// Calls [setNavigationDelegate] with the ids of the provided object instances. Future setNavigationDelegateForInstances( WKWebView instance, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart index 68ce913202190d01dc9682cc691f5b4118f9b80b..e4793d7e0ed2dfbecdaf580c78ad48759dabde80 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart @@ -4,6 +4,7 @@ import 'common/instance_manager.dart'; import 'foundation/foundation.dart'; +import 'ui_kit/ui_kit.dart'; import 'web_kit/web_kit.dart'; // This convenience method was added because Dart doesn't support constant @@ -29,6 +30,7 @@ class WebKitProxy { this.defaultWebsiteDataStore = _defaultWebsiteDataStore, this.createNavigationDelegate = WKNavigationDelegate.new, this.createUIDelegate = WKUIDelegate.new, + this.createUIScrollViewDelegate = UIScrollViewDelegate.new, }); /// Constructs a [WKWebView]. @@ -71,6 +73,14 @@ class WebKitProxy { void Function(WKWebView webView, NSError error)? didFailProvisionalNavigation, void Function(WKWebView webView)? webViewWebContentProcessDidTerminate, + void Function( + WKWebView webView, + NSUrlAuthenticationChallenge challenge, + void Function( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ) completionHandler, + )? didReceiveAuthenticationChallenge, }) createNavigationDelegate; /// Constructs a [WKUIDelegate]. @@ -87,6 +97,28 @@ class WebKitProxy { WKFrameInfo frame, WKMediaCaptureType type, )? requestMediaCapturePermission, + Future Function( + String message, + WKFrameInfo frame, + )? runJavaScriptAlertDialog, + Future Function( + String message, + WKFrameInfo frame, + )? runJavaScriptConfirmDialog, + Future Function( + String prompt, + String defaultText, + WKFrameInfo frame, + )? runJavaScriptTextInputDialog, InstanceManager? instanceManager, }) createUIDelegate; + + /// Constructs a [UIScrollViewDelegate]. + final UIScrollViewDelegate Function({ + void Function( + UIScrollView scrollView, + double x, + double y, + )? scrollViewDidScroll, + }) createUIScrollViewDelegate; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart index 764ed11d6aa804a6a220654f47668303e10f23ac..c1099181ad7982ac05d0222cf15f73d83a4e2c92 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -13,6 +14,7 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'common/instance_manager.dart'; import 'common/weak_reference_utils.dart'; import 'foundation/foundation.dart'; +import 'ui_kit/ui_kit.dart'; import 'web_kit/web_kit.dart'; import 'webkit_proxy.dart'; @@ -69,8 +71,14 @@ class WebKitWebViewControllerCreationParams ); } _configuration.setAllowsInlineMediaPlayback(allowsInlineMediaPlayback); - _configuration.setLimitsNavigationsToAppBoundDomains( - limitsNavigationsToAppBoundDomains); + // `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` is only + // supported on iOS versions 14+. So this only calls it if the value is set + // to true. + if (limitsNavigationsToAppBoundDomains) { + _configuration.setLimitsNavigationsToAppBoundDomains( + limitsNavigationsToAppBoundDomains, + ); + } } /// Constructs a [WebKitWebViewControllerCreationParams] using a @@ -216,6 +224,46 @@ class WebKitWebViewController extends PlatformWebViewController { return decisionCompleter.future; } }, + runJavaScriptAlertDialog: (String message, WKFrameInfo frame) async { + final Future Function(JavaScriptAlertDialogRequest request)? + callback = weakThis.target?._onJavaScriptAlertDialog; + if (callback != null) { + final JavaScriptAlertDialogRequest request = + JavaScriptAlertDialogRequest( + message: message, url: frame.request.url); + await callback.call(request); + return; + } + }, + runJavaScriptConfirmDialog: (String message, WKFrameInfo frame) async { + final Future Function(JavaScriptConfirmDialogRequest request)? + callback = weakThis.target?._onJavaScriptConfirmDialog; + if (callback != null) { + final JavaScriptConfirmDialogRequest request = + JavaScriptConfirmDialogRequest( + message: message, url: frame.request.url); + final bool result = await callback.call(request); + return result; + } + + return false; + }, + runJavaScriptTextInputDialog: + (String prompt, String defaultText, WKFrameInfo frame) async { + final Future Function(JavaScriptTextInputDialogRequest request)? + callback = weakThis.target?._onJavaScriptTextInputDialog; + if (callback != null) { + final JavaScriptTextInputDialogRequest request = + JavaScriptTextInputDialogRequest( + message: prompt, + url: frame.request.url, + defaultText: defaultText); + final String result = await callback.call(request); + return result; + } + + return ''; + }, ); _webView.setUIDelegate(_uiDelegate); @@ -263,14 +311,27 @@ class WebKitWebViewController extends PlatformWebViewController { late final WKUIDelegate _uiDelegate; + late final UIScrollViewDelegate? _uiScrollViewDelegate; + final Map _javaScriptChannelParams = {}; bool _zoomEnabled = true; WebKitNavigationDelegate? _currentNavigationDelegate; + void Function(JavaScriptConsoleMessage)? _onConsoleMessageCallback; void Function(PlatformWebViewPermissionRequest)? _onPermissionRequestCallback; + Future Function(JavaScriptAlertDialogRequest request)? + _onJavaScriptAlertDialog; + Future Function(JavaScriptConfirmDialogRequest request)? + _onJavaScriptConfirmDialog; + Future Function(JavaScriptTextInputDialogRequest request)? + _onJavaScriptTextInputDialog; + + void Function(ScrollPositionChange scrollPositionChange)? + _onScrollPositionChangeCallback; + WebKitWebViewControllerCreationParams get _webKitParams => params as WebKitWebViewControllerCreationParams; @@ -323,11 +384,19 @@ class WebKitWebViewController extends PlatformWebViewController { Future addJavaScriptChannel( JavaScriptChannelParams javaScriptChannelParams, ) { + final String channelName = javaScriptChannelParams.name; + if (_javaScriptChannelParams.containsKey(channelName)) { + throw ArgumentError( + 'A JavaScriptChannel with name `$channelName` already exists.', + ); + } + final WebKitJavaScriptChannelParams webKitParams = javaScriptChannelParams is WebKitJavaScriptChannelParams ? javaScriptChannelParams : WebKitJavaScriptChannelParams.fromJavaScriptChannelParams( - javaScriptChannelParams); + javaScriptChannelParams, + ); _javaScriptChannelParams[webKitParams.name] = webKitParams; @@ -512,6 +581,104 @@ class WebKitWebViewController extends PlatformWebViewController { .addUserScript(userScript); } + /// Sets a callback that notifies the host application of any log messages + /// written to the JavaScript console. + /// + /// Because the iOS WKWebView doesn't provide a built-in way to access the + /// console, setting this callback will inject a custom [WKUserScript] which + /// overrides the JavaScript `console.debug`, `console.error`, `console.info`, + /// `console.log` and `console.warn` methods and forwards the console message + /// via a `JavaScriptChannel` to the host application. + @override + Future setOnConsoleMessage( + void Function(JavaScriptConsoleMessage consoleMessage) onConsoleMessage, + ) { + _onConsoleMessageCallback = onConsoleMessage; + + final JavaScriptChannelParams channelParams = WebKitJavaScriptChannelParams( + name: 'fltConsoleMessage', + webKitProxy: _webKitParams.webKitProxy, + onMessageReceived: (JavaScriptMessage message) { + if (_onConsoleMessageCallback == null) { + return; + } + + final Map consoleLog = + jsonDecode(message.message) as Map; + + JavaScriptLogLevel level; + switch (consoleLog['level']) { + case 'error': + level = JavaScriptLogLevel.error; + break; + case 'warning': + level = JavaScriptLogLevel.warning; + break; + case 'debug': + level = JavaScriptLogLevel.debug; + break; + case 'info': + level = JavaScriptLogLevel.info; + break; + case 'log': + default: + level = JavaScriptLogLevel.log; + break; + } + + _onConsoleMessageCallback!( + JavaScriptConsoleMessage( + level: level, + message: consoleLog['message']! as String, + ), + ); + }); + + addJavaScriptChannel(channelParams); + return _injectConsoleOverride(); + } + + Future _injectConsoleOverride() { + const WKUserScript overrideScript = WKUserScript( + ''' +function log(type, args) { + var message = Object.values(args) + .map(v => typeof(v) === "undefined" ? "undefined" : typeof(v) === "object" ? JSON.stringify(v) : v.toString()) + .map(v => v.substring(0, 3000)) // Limit msg to 3000 chars + .join(", "); + + var log = { + level: type, + message: message + }; + + window.webkit.messageHandlers.fltConsoleMessage.postMessage(JSON.stringify(log)); +} + +let originalLog = console.log; +let originalInfo = console.info; +let originalWarn = console.warn; +let originalError = console.error; +let originalDebug = console.debug; + +console.log = function() { log("log", arguments); originalLog.apply(null, arguments) }; +console.info = function() { log("info", arguments); originalInfo.apply(null, arguments) }; +console.warn = function() { log("warning", arguments); originalWarn.apply(null, arguments) }; +console.error = function() { log("error", arguments); originalError.apply(null, arguments) }; +console.debug = function() { log("debug", arguments); originalDebug.apply(null, arguments) }; + +window.addEventListener("error", function(e) { + log("error", e.message + " at " + e.filename + ":" + e.lineno + ":" + e.colno); +}); + ''', + WKUserScriptInjectionTime.atDocumentStart, + isMainFrameOnly: true, + ); + + return _webView.configuration.userContentController + .addUserScript(overrideScript); + } + // WKWebView does not support removing a single user script, so all user // scripts and all message handlers are removed instead. And the JavaScript // channels that shouldn't be removed are re-registered. Note that this @@ -537,6 +704,9 @@ class WebKitWebViewController extends PlatformWebViewController { // Zoom is disabled with a WKUserScript, so this adds it back if it was // removed above. if (!_zoomEnabled) _disableZoom(), + // Console logs are forwarded with a WKUserScript, so this adds it back + // if a console callback was registered with [setOnConsoleMessage]. + if (_onConsoleMessageCallback != null) _injectConsoleOverride(), ]); } @@ -547,6 +717,30 @@ class WebKitWebViewController extends PlatformWebViewController { _onPermissionRequestCallback = onPermissionRequest; } + @override + Future setOnScrollPositionChange( + void Function(ScrollPositionChange scrollPositionChange)? + onScrollPositionChange) async { + _onScrollPositionChangeCallback = onScrollPositionChange; + + if (onScrollPositionChange != null) { + final WeakReference weakThis = + WeakReference(this); + _uiScrollViewDelegate = + _webKitParams.webKitProxy.createUIScrollViewDelegate( + scrollViewDidScroll: (UIScrollView uiScrollView, double x, double y) { + weakThis.target?._onScrollPositionChangeCallback?.call( + ScrollPositionChange(x, y), + ); + }, + ); + return _webView.scrollView.setDelegate(_uiScrollViewDelegate); + } else { + _uiScrollViewDelegate = null; + return _webView.scrollView.setDelegate(null); + } + } + /// Whether to enable tools for debugging the current WKWebView content. /// /// It needs to be activated in each WKWebView where you want to enable it. @@ -558,6 +752,41 @@ class WebKitWebViewController extends PlatformWebViewController { Future setInspectable(bool inspectable) { return _webView.setInspectable(inspectable); } + + @override + Future getUserAgent() async { + final String? customUserAgent = await _webView.getCustomUserAgent(); + // Despite the official documentation of `WKWebView.customUserAgent`, the + // default value seems to be an empty String and not null. It's possible it + // could depend on the iOS version, so this checks for both. + if (customUserAgent != null && customUserAgent.isNotEmpty) { + return customUserAgent; + } + + return (await _webView.evaluateJavaScript('navigator.userAgent;') + as String?)!; + } + + @override + Future setOnJavaScriptAlertDialog( + Future Function(JavaScriptAlertDialogRequest request) + onJavaScriptAlertDialog) async { + _onJavaScriptAlertDialog = onJavaScriptAlertDialog; + } + + @override + Future setOnJavaScriptConfirmDialog( + Future Function(JavaScriptConfirmDialogRequest request) + onJavaScriptConfirmDialog) async { + _onJavaScriptConfirmDialog = onJavaScriptConfirmDialog; + } + + @override + Future setOnJavaScriptTextInputDialog( + Future Function(JavaScriptTextInputDialogRequest request) + onJavaScriptTextInputDialog) async { + _onJavaScriptTextInputDialog = onJavaScriptTextInputDialog; + } } /// An implementation of [JavaScriptChannelParams] with the WebKit api. @@ -824,6 +1053,54 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ); } }, + didReceiveAuthenticationChallenge: ( + WKWebView webView, + NSUrlAuthenticationChallenge challenge, + void Function( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ) completionHandler, + ) { + if (challenge.protectionSpace.authenticationMethod == + NSUrlAuthenticationMethod.httpBasic) { + final void Function(HttpAuthRequest)? callback = + weakThis.target?._onHttpAuthRequest; + final String? host = challenge.protectionSpace.host; + final String? realm = challenge.protectionSpace.realm; + + if (callback != null && host != null) { + callback( + HttpAuthRequest( + onProceed: (WebViewCredential credential) { + completionHandler( + NSUrlSessionAuthChallengeDisposition.useCredential, + NSUrlCredential.withUser( + user: credential.user, + password: credential.password, + persistence: NSUrlCredentialPersistence.session, + ), + ); + }, + onCancel: () { + completionHandler( + NSUrlSessionAuthChallengeDisposition + .cancelAuthenticationChallenge, + null, + ); + }, + host: host, + realm: realm, + ), + ); + return; + } + } + + completionHandler( + NSUrlSessionAuthChallengeDisposition.performDefaultHandling, + null, + ); + }, ); } @@ -836,6 +1113,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { WebResourceErrorCallback? _onWebResourceError; NavigationRequestCallback? _onNavigationRequest; UrlChangeCallback? _onUrlChange; + HttpAuthRequestCallback? _onHttpAuthRequest; @override Future setOnPageFinished(PageEventCallback onPageFinished) async { @@ -870,6 +1148,13 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { Future setOnUrlChange(UrlChangeCallback onUrlChange) async { _onUrlChange = onUrlChange; } + + @override + Future setOnHttpAuthRequest( + HttpAuthRequestCallback onHttpAuthRequest, + ) async { + _onHttpAuthRequest = onHttpAuthRequest; + } } /// WebKit implementation of [PlatformWebViewPermissionRequest]. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart index f54fb73bcda31b607d6b220c3b567c199bc47b73..01dbb61babe8436185ee6702a1caf679e04bf5a1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -library webview_flutter_wkwebview; - export 'src/webkit_webview_controller.dart'; export 'src/webkit_webview_cookie_manager.dart'; export 'src/webkit_webview_platform.dart'; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart index dea5080e556ad383da4e7b6703f595c59e22d0d5..5b0ea12db516c111a9f844bffd23a2f771efa16a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -258,6 +258,58 @@ class WKMediaCaptureTypeData { late WKMediaCaptureType value; } +/// Responses to an authentication challenge. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition?language=objc. +enum NSUrlSessionAuthChallengeDisposition { + /// Use the specified credential, which may be nil. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeusecredential?language=objc. + useCredential, + + /// Use the default handling for the challenge as though this delegate method + /// were not implemented. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengeperformdefaulthandling?language=objc. + performDefaultHandling, + + /// Cancel the entire request. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengecancelauthenticationchallenge?language=objc. + cancelAuthenticationChallenge, + + /// Reject this challenge, and call the authentication delegate method again + /// with the next authentication protection space. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlsessionauthchallengedisposition/nsurlsessionauthchallengerejectprotectionspace?language=objc. + rejectProtectionSpace, +} + +/// Specifies how long a credential will be kept. +enum NSUrlCredentialPersistence { + /// The credential should not be stored. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencenone?language=objc. + none, + + /// The credential should be stored only for this session. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistenceforsession?language=objc. + session, + + /// The credential should be stored in the keychain. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencepermanent?language=objc. + permanent, + + /// The credential should be stored permanently in the keychain, and in + /// addition should be distributed to other devices based on the owning Apple + /// ID. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlcredentialpersistence/nsurlcredentialpersistencesynchronizable?language=objc. + synchronizable, +} + /// Mirror of NSURLRequest. /// /// See https://developer.apple.com/documentation/foundation/nsurlrequest?language=objc. @@ -291,6 +343,7 @@ class WKNavigationActionData { /// See https://developer.apple.com/documentation/webkit/wkframeinfo?language=objc. class WKFrameInfoData { late bool isMainFrame; + late NSUrlRequestData request; } /// Mirror of NSError. @@ -343,6 +396,11 @@ class ObjectOrIdentifier { late bool isIdentifier; } +class AuthenticationChallengeResponse { + late NSUrlSessionAuthChallengeDisposition disposition; + late int? credentialIdentifier; +} + /// Mirror of WKWebsiteDataStore. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @@ -398,6 +456,10 @@ abstract class UIScrollViewHostApi { @ObjCSelector('setContentOffsetForScrollViewWithIdentifier:toX:y:') void setContentOffset(int identifier, double x, double y); + + @ObjCSelector( + 'setDelegateForScrollViewWithIdentifier:uiScrollViewDelegateIdentifier:') + void setDelegate(int identifier, int? uiScrollViewDelegateIdentifier); } /// Mirror of WKWebViewConfiguration. @@ -582,6 +644,16 @@ abstract class WKNavigationDelegateFlutterApi { int identifier, int webViewIdentifier, ); + + @async + @ObjCSelector( + 'didReceiveAuthenticationChallengeForDelegateWithIdentifier:webViewIdentifier:challengeIdentifier:', + ) + AuthenticationChallengeResponse didReceiveAuthenticationChallenge( + int identifier, + int webViewIdentifier, + int challengeIdentifier, + ); } /// Mirror of NSObject. @@ -688,7 +760,7 @@ abstract class WKWebViewHostApi { @ObjCSelector('setAllowsBackForwardForWebViewWithIdentifier:isAllowed:') void setAllowsBackForwardNavigationGestures(int identifier, bool allow); - @ObjCSelector('setUserAgentForWebViewWithIdentifier:userAgent:') + @ObjCSelector('setCustomUserAgentForWebViewWithIdentifier:userAgent:') void setCustomUserAgent(int identifier, String? userAgent); @ObjCSelector('evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:') @@ -697,6 +769,9 @@ abstract class WKWebViewHostApi { @ObjCSelector('setInspectableForWebViewWithIdentifier:inspectable:') void setInspectable(int identifier, bool inspectable); + + @ObjCSelector('customUserAgentForWebViewWithIdentifier:') + String? getCustomUserAgent(int identifier); } /// Mirror of WKUIDelegate. @@ -735,6 +810,40 @@ abstract class WKUIDelegateFlutterApi { WKFrameInfoData frame, WKMediaCaptureTypeData type, ); + + /// Callback to Dart function `WKUIDelegate.runJavaScriptAlertPanel`. + @ObjCSelector( + 'runJavaScriptAlertPanelForDelegateWithIdentifier:message:frame:', + ) + @async + void runJavaScriptAlertPanel( + int identifier, + String message, + WKFrameInfoData frame, + ); + + /// Callback to Dart function `WKUIDelegate.runJavaScriptConfirmPanel`. + @ObjCSelector( + 'runJavaScriptConfirmPanelForDelegateWithIdentifier:message:frame:', + ) + @async + bool runJavaScriptConfirmPanel( + int identifier, + String message, + WKFrameInfoData frame, + ); + + /// Callback to Dart function `WKUIDelegate.runJavaScriptTextInputPanel`. + @ObjCSelector( + 'runJavaScriptTextInputPanelForDelegateWithIdentifier:prompt:defaultText:frame:', + ) + @async + String runJavaScriptTextInputPanel( + int identifier, + String prompt, + String defaultText, + WKFrameInfoData frame, + ); } /// Mirror of WKHttpCookieStore. @@ -778,3 +887,86 @@ abstract class NSUrlFlutterApi { @ObjCSelector('createWithIdentifier:') void create(int identifier); } + +/// Host API for `UIScrollViewDelegate`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +@HostApi(dartHostTestHandler: 'TestUIScrollViewDelegateHostApi') +abstract class UIScrollViewDelegateHostApi { + @ObjCSelector('createWithIdentifier:') + void create(int identifier); +} + +/// Flutter API for `UIScrollViewDelegate`. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +@FlutterApi() +abstract class UIScrollViewDelegateFlutterApi { + @ObjCSelector( + 'scrollViewDidScrollWithIdentifier:UIScrollViewIdentifier:x:y:', + ) + void scrollViewDidScroll( + int identifier, + int uiScrollViewIdentifier, + double x, + double y, + ); +} + +/// Host API for `NSUrlCredential`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlcredential?language=objc. +@HostApi(dartHostTestHandler: 'TestNSUrlCredentialHostApi') +abstract class NSUrlCredentialHostApi { + /// Create a new native instance and add it to the `InstanceManager`. + @ObjCSelector( + 'createWithUserWithIdentifier:user:password:persistence:', + ) + void createWithUser( + int identifier, + String user, + String password, + NSUrlCredentialPersistence persistence, + ); +} + +/// Flutter API for `NSUrlProtectionSpace`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlprotectionspace?language=objc. +@FlutterApi() +abstract class NSUrlProtectionSpaceFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + @ObjCSelector('createWithIdentifier:host:realm:authenticationMethod:') + void create( + int identifier, + String? host, + String? realm, + String? authenticationMethod, + ); +} + +/// Flutter API for `NSUrlAuthenticationChallenge`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlauthenticationchallenge?language=objc. +@FlutterApi() +abstract class NSUrlAuthenticationChallengeFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + @ObjCSelector('createWithIdentifier:protectionSpaceIdentifier:') + void create(int identifier, int protectionSpaceIdentifier); +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 2c888669fa10c80d23978813833011f99e3357f6..8b138b05b277ce2db248f7bd0dd55d0630e316cc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.7.4 +version: 3.12.0 environment: sdk: ">=2.19.0 <4.0.0" @@ -20,14 +20,17 @@ dependencies: flutter: sdk: flutter path: ^1.8.0 - webview_flutter_platform_interface: ^2.4.0 + webview_flutter_platform_interface: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/webview_flutter/webview_flutter_platform_interface dev_dependencies: build_runner: ^2.1.5 flutter_test: sdk: flutter - mockito: 5.4.1 - pigeon: ^10.1.4 + mockito: 5.4.4 + pigeon: ^13.0.0 topics: - html diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart index b88d686b205dbae4e6ddd736fde2921434499b70..fe13a87048e5506050b78f983565328addc85f52 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -61,6 +63,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i2.WKHttpCookieStore copy() => (super.noSuchMethod( Invocation.method( @@ -75,6 +78,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { ), ), ) as _i2.WKHttpCookieStore); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -93,6 +97,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { @@ -127,6 +132,7 @@ class MockWKWebsiteDataStore extends _i1.Mock Invocation.getter(#httpCookieStore), ), ) as _i2.WKHttpCookieStore); + @override _i3.Future removeDataOfTypes( Set<_i2.WKWebsiteDataType>? dataTypes, @@ -142,6 +148,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), returnValue: _i3.Future.value(false), ) as _i3.Future); + @override _i2.WKWebsiteDataStore copy() => (super.noSuchMethod( Invocation.method( @@ -156,6 +163,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), ), ) as _i2.WKWebsiteDataStore); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -174,6 +182,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart index ebeb3d922b3603af72ada09d7848fa8d69c837fe..8c421193d1876939f43ea0999654dcbe1010e334 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart @@ -148,7 +148,7 @@ void main() { mockWebViewConfiguration, const WKNavigationAction( request: request, - targetFrame: WKFrameInfo(isMainFrame: false), + targetFrame: WKFrameInfo(isMainFrame: false, request: request), navigationType: WKNavigationType.linkActivated, ), ); @@ -1166,7 +1166,9 @@ void main() { mockWebView, const WKNavigationAction( request: NSUrlRequest(url: 'https://google.com'), - targetFrame: WKFrameInfo(isMainFrame: false), + targetFrame: WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com')), navigationType: WKNavigationType.linkActivated, ), ), diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index 3c4210e8419bbb493e9b9bc34cb35b4bb6f8ce8d..411002e479eecff87ed2e2d465eff3c5265150f3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. // Do not manually edit this file. @@ -25,6 +25,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -172,6 +174,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { ), )), ) as _i5.Future<_i2.Point>); + @override _i5.Future scrollBy(_i2.Point? offset) => (super.noSuchMethod( Invocation.method( @@ -181,6 +184,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setContentOffset(_i2.Point? offset) => (super.noSuchMethod( @@ -191,6 +195,18 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setDelegate(_i3.UIScrollViewDelegate? delegate) => + (super.noSuchMethod( + Invocation.method( + #setDelegate, + [delegate], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i3.UIScrollView copy() => (super.noSuchMethod( Invocation.method( @@ -205,6 +221,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { ), ), ) as _i3.UIScrollView); + @override _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( Invocation.method( @@ -214,6 +231,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( @@ -223,6 +241,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -241,6 +260,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -281,6 +301,7 @@ class MockWKNavigationDelegate extends _i1.Mock ), ), ) as _i4.WKNavigationDelegate); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -299,6 +320,7 @@ class MockWKNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -333,6 +355,7 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i4.WKPreferences copy() => (super.noSuchMethod( Invocation.method( @@ -347,6 +370,7 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { ), ), ) as _i4.WKPreferences); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -365,6 +389,7 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -405,6 +430,7 @@ class MockWKScriptMessageHandler extends _i1.Mock _i4.WKUserContentController, _i4.WKScriptMessage, )); + @override _i4.WKScriptMessageHandler copy() => (super.noSuchMethod( Invocation.method( @@ -419,6 +445,7 @@ class MockWKScriptMessageHandler extends _i1.Mock ), ), ) as _i4.WKScriptMessageHandler); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -437,6 +464,7 @@ class MockWKScriptMessageHandler extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -470,6 +498,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { Invocation.getter(#configuration), ), ) as _i4.WKWebViewConfiguration); + @override _i3.UIScrollView get scrollView => (super.noSuchMethod( Invocation.getter(#scrollView), @@ -478,6 +507,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { Invocation.getter(#scrollView), ), ) as _i3.UIScrollView); + @override _i5.Future setUIDelegate(_i4.WKUIDelegate? delegate) => (super.noSuchMethod( @@ -488,6 +518,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setNavigationDelegate(_i4.WKNavigationDelegate? delegate) => (super.noSuchMethod( @@ -498,6 +529,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -506,6 +538,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getEstimatedProgress() => (super.noSuchMethod( Invocation.method( @@ -514,6 +547,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(0.0), ) as _i5.Future); + @override _i5.Future loadRequest(_i7.NSUrlRequest? request) => (super.noSuchMethod( @@ -524,6 +558,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadHtmlString( String? string, { @@ -538,6 +573,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadFileUrl( String? url, { @@ -552,6 +588,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -561,6 +598,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -569,6 +607,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -577,6 +616,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -586,6 +626,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -595,6 +636,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -604,6 +646,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -612,6 +655,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( @@ -622,6 +666,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -631,6 +676,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( @@ -640,6 +686,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setInspectable(bool? inspectable) => (super.noSuchMethod( Invocation.method( @@ -649,6 +696,16 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future getCustomUserAgent() => (super.noSuchMethod( + Invocation.method( + #getCustomUserAgent, + [], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override _i4.WKWebView copy() => (super.noSuchMethod( Invocation.method( @@ -663,6 +720,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), ), ) as _i4.WKWebView); + @override _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( Invocation.method( @@ -672,6 +730,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( @@ -681,6 +740,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -699,6 +759,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -733,6 +794,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#userContentController), ), ) as _i4.WKUserContentController); + @override _i4.WKPreferences get preferences => (super.noSuchMethod( Invocation.getter(#preferences), @@ -741,6 +803,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#preferences), ), ) as _i4.WKPreferences); + @override _i4.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod( Invocation.getter(#websiteDataStore), @@ -749,6 +812,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#websiteDataStore), ), ) as _i4.WKWebsiteDataStore); + @override _i5.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( @@ -759,6 +823,18 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => + (super.noSuchMethod( + Invocation.method( + #setLimitsNavigationsToAppBoundDomains, + [limit], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future setMediaTypesRequiringUserActionForPlayback( Set<_i4.WKAudiovisualMediaType>? types) => @@ -770,6 +846,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i4.WKWebViewConfiguration copy() => (super.noSuchMethod( Invocation.method( @@ -784,6 +861,7 @@ class MockWKWebViewConfiguration extends _i1.Mock ), ), ) as _i4.WKWebViewConfiguration); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -802,6 +880,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -836,6 +915,7 @@ class MockWKWebsiteDataStore extends _i1.Mock Invocation.getter(#httpCookieStore), ), ) as _i4.WKHttpCookieStore); + @override _i5.Future removeDataOfTypes( Set<_i4.WKWebsiteDataType>? dataTypes, @@ -851,6 +931,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i4.WKWebsiteDataStore copy() => (super.noSuchMethod( Invocation.method( @@ -865,6 +946,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), ), ) as _i4.WKWebsiteDataStore); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -883,6 +965,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -922,6 +1005,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i4.WKUIDelegate { ), ), ) as _i4.WKUIDelegate); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -940,6 +1024,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i4.WKUIDelegate { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -982,6 +1067,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( @@ -992,6 +1078,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( Invocation.method( @@ -1001,6 +1088,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addUserScript(_i4.WKUserScript? userScript) => (super.noSuchMethod( @@ -1011,6 +1099,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeAllUserScripts() => (super.noSuchMethod( Invocation.method( @@ -1020,6 +1109,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i4.WKUserContentController copy() => (super.noSuchMethod( Invocation.method( @@ -1034,6 +1124,7 @@ class MockWKUserContentController extends _i1.Mock ), ), ) as _i4.WKUserContentController); + @override _i5.Future addObserver( _i7.NSObject? observer, { @@ -1052,6 +1143,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObserver( _i7.NSObject? observer, { @@ -1082,6 +1174,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock Invocation.getter(#channels), returnValue: {}, ) as Map); + @override void onJavascriptChannelMessage( String? channel, @@ -1097,6 +1190,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void updateJavascriptChannelsFromSet(Set<_i9.JavascriptChannel>? channels) => super.noSuchMethod( @@ -1133,6 +1227,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.FutureOr); + @override void onPageStarted(String? url) => super.noSuchMethod( Invocation.method( @@ -1141,6 +1236,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onPageFinished(String? url) => super.noSuchMethod( Invocation.method( @@ -1149,6 +1245,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onProgress(int? progress) => super.noSuchMethod( Invocation.method( @@ -1157,6 +1254,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void onWebResourceError(_i10.WebResourceError? error) => super.noSuchMethod( Invocation.method( @@ -1200,6 +1298,7 @@ class MockWebViewWidgetProxy extends _i1.Mock ), ), ) as _i4.WKWebView); + @override _i4.WKScriptMessageHandler createScriptMessageHandler( {required void Function( @@ -1221,6 +1320,7 @@ class MockWebViewWidgetProxy extends _i1.Mock ), ), ) as _i4.WKScriptMessageHandler); + @override _i4.WKUIDelegate createUIDelgate( {void Function( @@ -1243,6 +1343,7 @@ class MockWebViewWidgetProxy extends _i1.Mock ), ), ) as _i4.WKUIDelegate); + @override _i4.WKNavigationDelegate createNavigationDelegate({ void Function( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart index ee9065ea6689b2cb5de899229f793cae28492bb9..82f754af224eb9ef8d49b7ae6138364da3d6f152 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 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. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports @@ -78,9 +78,16 @@ abstract class TestWKWebsiteDataStoreHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -102,8 +109,15 @@ abstract class TestWKWebsiteDataStoreHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); - api.createDefaultDataStore(arg_identifier!); - return []; + try { + api.createDefaultDataStore(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -133,9 +147,16 @@ abstract class TestWKWebsiteDataStoreHostApi { (args[2] as double?); assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, - arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); - return [output]; + try { + final bool output = await api.removeDataOfTypes(arg_identifier!, + arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -175,8 +196,15 @@ abstract class TestUIViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); - api.setBackgroundColor(arg_identifier!, arg_value); - return []; + try { + api.setBackgroundColor(arg_identifier!, arg_value); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -201,8 +229,15 @@ abstract class TestUIViewHostApi { final bool? arg_opaque = (args[1] as bool?); assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setOpaque was null, expected non-null bool.'); - api.setOpaque(arg_identifier!, arg_opaque!); - return []; + try { + api.setOpaque(arg_identifier!, arg_opaque!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -225,6 +260,8 @@ abstract class TestUIScrollViewHostApi { void setContentOffset(int identifier, double x, double y); + void setDelegate(int identifier, int? uiScrollViewDelegateIdentifier); + static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -248,8 +285,15 @@ abstract class TestUIScrollViewHostApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); - api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return []; + try { + api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -271,8 +315,15 @@ abstract class TestUIScrollViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); - final List output = api.getContentOffset(arg_identifier!); - return [output]; + try { + final List output = api.getContentOffset(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -300,8 +351,15 @@ abstract class TestUIScrollViewHostApi { final double? arg_y = (args[2] as double?); assert(arg_y != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); - api.scrollBy(arg_identifier!, arg_x!, arg_y!); - return []; + try { + api.scrollBy(arg_identifier!, arg_x!, arg_y!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -329,8 +387,47 @@ abstract class TestUIScrollViewHostApi { final double? arg_y = (args[2] as double?); assert(arg_y != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); - api.setContentOffset(arg_identifier!, arg_x!, arg_y!); - return []; + try { + api.setContentOffset(arg_identifier!, arg_x!, arg_y!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setDelegate', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setDelegate was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setDelegate was null, expected non-null int.'); + final int? arg_uiScrollViewDelegateIdentifier = (args[1] as int?); + try { + api.setDelegate( + arg_identifier!, arg_uiScrollViewDelegateIdentifier); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -400,8 +497,15 @@ abstract class TestWKWebViewConfigurationHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -426,8 +530,15 @@ abstract class TestWKWebViewConfigurationHostApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); - api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return []; + try { + api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -452,8 +563,15 @@ abstract class TestWKWebViewConfigurationHostApi { final bool? arg_allow = (args[1] as bool?); assert(arg_allow != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); - api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); - return []; + try { + api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -478,9 +596,16 @@ abstract class TestWKWebViewConfigurationHostApi { final bool? arg_limit = (args[1] as bool?); assert(arg_limit != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setLimitsNavigationsToAppBoundDomains was null, expected non-null bool.'); - api.setLimitsNavigationsToAppBoundDomains( - arg_identifier!, arg_limit!); - return []; + try { + api.setLimitsNavigationsToAppBoundDomains( + arg_identifier!, arg_limit!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -507,9 +632,16 @@ abstract class TestWKWebViewConfigurationHostApi { ?.cast(); assert(arg_types != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_identifier!, arg_types!); - return []; + try { + api.setMediaTypesRequiringUserActionForPlayback( + arg_identifier!, arg_types!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -590,9 +722,16 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -620,9 +759,16 @@ abstract class TestWKUserContentControllerHostApi { final String? arg_name = (args[2] as String?); assert(arg_name != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_identifier!, arg_handlerIdentifier!, arg_name!); - return []; + try { + api.addScriptMessageHandler( + arg_identifier!, arg_handlerIdentifier!, arg_name!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -647,8 +793,15 @@ abstract class TestWKUserContentControllerHostApi { final String? arg_name = (args[1] as String?); assert(arg_name != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); - api.removeScriptMessageHandler(arg_identifier!, arg_name!); - return []; + try { + api.removeScriptMessageHandler(arg_identifier!, arg_name!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -670,8 +823,15 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); - api.removeAllScriptMessageHandlers(arg_identifier!); - return []; + try { + api.removeAllScriptMessageHandlers(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -697,8 +857,15 @@ abstract class TestWKUserContentControllerHostApi { (args[1] as WKUserScriptData?); assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); - api.addUserScript(arg_identifier!, arg_userScript!); - return []; + try { + api.addUserScript(arg_identifier!, arg_userScript!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -720,8 +887,15 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); - api.removeAllUserScripts(arg_identifier!); - return []; + try { + api.removeAllUserScripts(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -764,9 +938,16 @@ abstract class TestWKPreferencesHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -791,8 +972,15 @@ abstract class TestWKPreferencesHostApi { final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); - api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); - return []; + try { + api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -829,8 +1017,15 @@ abstract class TestWKScriptMessageHandlerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -867,8 +1062,15 @@ abstract class TestWKNavigationDelegateHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -933,8 +1135,15 @@ abstract class TestNSObjectHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.dispose was null, expected non-null int.'); - api.dispose(arg_identifier!); - return []; + try { + api.dispose(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -967,9 +1176,16 @@ abstract class TestNSObjectHostApi { ?.cast(); assert(arg_options != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, - arg_keyPath!, arg_options!); - return []; + try { + api.addObserver(arg_identifier!, arg_observerIdentifier!, + arg_keyPath!, arg_options!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -997,9 +1213,16 @@ abstract class TestNSObjectHostApi { final String? arg_keyPath = (args[2] as String?); assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_identifier!, arg_observerIdentifier!, arg_keyPath!); - return []; + try { + api.removeObserver( + arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1010,60 +1233,63 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { const _TestWKWebViewHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NSErrorData) { + if (value is AuthenticationChallengeResponse) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else if (value is NSErrorData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookieData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is ObjectOrIdentifier) { + } else if (value is NSUrlRequestData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is ObjectOrIdentifier) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKMediaCaptureTypeData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else if (value is WKMediaCaptureTypeData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKPermissionDecisionData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else if (value is WKPermissionDecisionData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is WKSecurityOriginData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else if (value is WKSecurityOriginData) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptData) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(145); writeValue(buffer, value.encode()); + } else if (value is WKWebsiteDataTypeEnumData) { + buffer.putUint8(146); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1073,40 +1299,42 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return NSErrorData.decode(readValue(buffer)!); + return AuthenticationChallengeResponse.decode(readValue(buffer)!); case 129: - return NSHttpCookieData.decode(readValue(buffer)!); + return NSErrorData.decode(readValue(buffer)!); case 130: - return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); + return NSHttpCookieData.decode(readValue(buffer)!); case 131: - return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); + return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); case 132: - return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); + return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); case 133: - return NSUrlRequestData.decode(readValue(buffer)!); + return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); case 134: - return ObjectOrIdentifier.decode(readValue(buffer)!); + return NSUrlRequestData.decode(readValue(buffer)!); case 135: - return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); + return ObjectOrIdentifier.decode(readValue(buffer)!); case 136: - return WKFrameInfoData.decode(readValue(buffer)!); + return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); case 137: - return WKMediaCaptureTypeData.decode(readValue(buffer)!); + return WKFrameInfoData.decode(readValue(buffer)!); case 138: - return WKNavigationActionData.decode(readValue(buffer)!); + return WKMediaCaptureTypeData.decode(readValue(buffer)!); case 139: - return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); + return WKNavigationActionData.decode(readValue(buffer)!); case 140: - return WKPermissionDecisionData.decode(readValue(buffer)!); + return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); case 141: - return WKScriptMessageData.decode(readValue(buffer)!); + return WKPermissionDecisionData.decode(readValue(buffer)!); case 142: - return WKSecurityOriginData.decode(readValue(buffer)!); + return WKScriptMessageData.decode(readValue(buffer)!); case 143: - return WKUserScriptData.decode(readValue(buffer)!); + return WKSecurityOriginData.decode(readValue(buffer)!); case 144: - return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); + return WKUserScriptData.decode(readValue(buffer)!); case 145: + return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); + case 146: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1160,6 +1388,8 @@ abstract class TestWKWebViewHostApi { void setInspectable(int identifier, bool inspectable); + String? getCustomUserAgent(int identifier); + static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1183,8 +1413,15 @@ abstract class TestWKWebViewHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.create(arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1207,8 +1444,15 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); - api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); - return []; + try { + api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1231,9 +1475,16 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate( - arg_identifier!, arg_navigationDelegateIdentifier); - return []; + try { + api.setNavigationDelegate( + arg_identifier!, arg_navigationDelegateIdentifier); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1255,8 +1506,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getUrl was null, expected non-null int.'); - final String? output = api.getUrl(arg_identifier!); - return [output]; + try { + final String? output = api.getUrl(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1278,8 +1536,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); - final double output = api.getEstimatedProgress(arg_identifier!); - return [output]; + try { + final double output = api.getEstimatedProgress(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1304,8 +1569,15 @@ abstract class TestWKWebViewHostApi { final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); - api.loadRequest(arg_identifier!, arg_request!); - return []; + try { + api.loadRequest(arg_identifier!, arg_request!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1331,8 +1603,15 @@ abstract class TestWKWebViewHostApi { assert(arg_string != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); - api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); - return []; + try { + api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1360,8 +1639,15 @@ abstract class TestWKWebViewHostApi { final String? arg_readAccessUrl = (args[2] as String?); assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); - api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); - return []; + try { + api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1386,8 +1672,15 @@ abstract class TestWKWebViewHostApi { final String? arg_key = (args[1] as String?); assert(arg_key != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); - api.loadFlutterAsset(arg_identifier!, arg_key!); - return []; + try { + api.loadFlutterAsset(arg_identifier!, arg_key!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1409,8 +1702,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoBack was null, expected non-null int.'); - final bool output = api.canGoBack(arg_identifier!); - return [output]; + try { + final bool output = api.canGoBack(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1432,8 +1732,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoForward was null, expected non-null int.'); - final bool output = api.canGoForward(arg_identifier!); - return [output]; + try { + final bool output = api.canGoForward(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1455,8 +1762,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goBack was null, expected non-null int.'); - api.goBack(arg_identifier!); - return []; + try { + api.goBack(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1478,8 +1792,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goForward was null, expected non-null int.'); - api.goForward(arg_identifier!); - return []; + try { + api.goForward(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1501,8 +1822,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.reload was null, expected non-null int.'); - api.reload(arg_identifier!); - return []; + try { + api.reload(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1524,8 +1852,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getTitle was null, expected non-null int.'); - final String? output = api.getTitle(arg_identifier!); - return [output]; + try { + final String? output = api.getTitle(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1550,9 +1885,16 @@ abstract class TestWKWebViewHostApi { final bool? arg_allow = (args[1] as bool?); assert(arg_allow != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_identifier!, arg_allow!); - return []; + try { + api.setAllowsBackForwardNavigationGestures( + arg_identifier!, arg_allow!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1575,8 +1917,15 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); - api.setCustomUserAgent(arg_identifier!, arg_userAgent); - return []; + try { + api.setCustomUserAgent(arg_identifier!, arg_userAgent); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1601,9 +1950,16 @@ abstract class TestWKWebViewHostApi { final String? arg_javaScriptString = (args[1] as String?); assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_identifier!, arg_javaScriptString!); - return [output]; + try { + final Object? output = await api.evaluateJavaScript( + arg_identifier!, arg_javaScriptString!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1628,8 +1984,45 @@ abstract class TestWKWebViewHostApi { final bool? arg_inspectable = (args[1] as bool?); assert(arg_inspectable != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setInspectable was null, expected non-null bool.'); - api.setInspectable(arg_identifier!, arg_inspectable!); - return []; + try { + api.setInspectable(arg_identifier!, arg_inspectable!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent was null, expected non-null int.'); + try { + final String? output = api.getCustomUserAgent(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1666,8 +2059,15 @@ abstract class TestWKUIDelegateHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1739,9 +2139,16 @@ abstract class TestWKHttpCookieStoreHostApi { final int? arg_websiteDataStoreIdentifier = (args[1] as int?); assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_identifier!, arg_websiteDataStoreIdentifier!); - return []; + try { + api.createFromWebsiteDataStore( + arg_identifier!, arg_websiteDataStoreIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1766,8 +2173,15 @@ abstract class TestWKHttpCookieStoreHostApi { final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); - await api.setCookie(arg_identifier!, arg_cookie!); - return []; + try { + await api.setCookie(arg_identifier!, arg_cookie!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1807,8 +2221,127 @@ abstract class TestNSUrlHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlHostApi.getAbsoluteString was null, expected non-null int.'); - final String? output = api.getAbsoluteString(arg_identifier!); - return [output]; + try { + final String? output = api.getAbsoluteString(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + +/// Host API for `UIScrollViewDelegate`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc. +abstract class TestUIScrollViewDelegateHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + void create(int identifier); + + static void setup(TestUIScrollViewDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateHostApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateHostApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegateHostApi.create was null, expected non-null int.'); + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + +/// Host API for `NSUrlCredential`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlcredential?language=objc. +abstract class TestNSUrlCredentialHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + void createWithUser(int identifier, String user, String password, + NSUrlCredentialPersistence persistence); + + static void setup(TestNSUrlCredentialHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser was null, expected non-null int.'); + final String? arg_user = (args[1] as String?); + assert(arg_user != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser was null, expected non-null String.'); + final String? arg_password = (args[2] as String?); + assert(arg_password != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser was null, expected non-null String.'); + final NSUrlCredentialPersistence? arg_persistence = args[3] == null + ? null + : NSUrlCredentialPersistence.values[args[3]! as int]; + assert(arg_persistence != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlCredentialHostApi.createWithUser was null, expected non-null NSUrlCredentialPersistence.'); + try { + api.createWithUser( + arg_identifier!, arg_user!, arg_password!, arg_persistence!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart index ea2e37e2cdad226b1794f16c3e70e5d58757d8ae..345c6fad6776a0418afe3bf2efad99f8b80b9642 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart @@ -17,6 +17,7 @@ import 'foundation_test.mocks.dart'; @GenerateMocks([ TestNSObjectHostApi, + TestNSUrlCredentialHostApi, TestNSUrlHostApi, ]) void main() { @@ -245,6 +246,102 @@ void main() { expect(instanceManager.getInstanceWithWeakReference(0), isA()); }); }); + + group('NSUrlCredential', () { + tearDown(() { + TestNSUrlCredentialHostApi.setup(null); + }); + + test('HostApi createWithUser', () { + final MockTestNSUrlCredentialHostApi mockApi = + MockTestNSUrlCredentialHostApi(); + TestNSUrlCredentialHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const String user = 'testString'; + const String password = 'testString2'; + + const NSUrlCredentialPersistence persistence = + NSUrlCredentialPersistence.permanent; + + final NSUrlCredential instance = NSUrlCredential.withUser( + user: user, + password: password, + persistence: persistence, + instanceManager: instanceManager, + ); + + verify(mockApi.createWithUser( + instanceManager.getIdentifier(instance), + user, + password, + persistence, + )); + }); + }); + + group('NSUrlProtectionSpace', () { + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final NSUrlProtectionSpaceFlutterApiImpl api = + NSUrlProtectionSpaceFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + api.create( + instanceIdentifier, + 'testString', + 'testString', + 'testAuthenticationMethod', + ); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); + + group('NSUrlAuthenticationChallenge', () { + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final NSUrlAuthenticationChallengeFlutterApiImpl api = + NSUrlAuthenticationChallengeFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + const int protectionSpaceIdentifier = 1; + instanceManager.addHostCreatedInstance( + NSUrlProtectionSpace.detached( + host: null, + realm: null, + authenticationMethod: null, + instanceManager: instanceManager, + ), + protectionSpaceIdentifier, + ); + + api.create(instanceIdentifier, protectionSpaceIdentifier); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); }); test('NSError', () { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart index a648fc65a4dc8054befa3e4666c2e70cc7d6f26d..df4e12e6082f9d1d023558c623bc27c0b6267562 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/src/foundation/foundation_test.dart. // Do not manually edit this file. @@ -12,6 +12,8 @@ import '../common/test_web_kit.g.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -36,6 +38,7 @@ class MockTestNSObjectHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void addObserver( int? identifier, @@ -55,6 +58,7 @@ class MockTestNSObjectHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeObserver( int? identifier, @@ -74,6 +78,36 @@ class MockTestNSObjectHostApi extends _i1.Mock ); } +/// A class which mocks [TestNSUrlCredentialHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestNSUrlCredentialHostApi extends _i1.Mock + implements _i2.TestNSUrlCredentialHostApi { + MockTestNSUrlCredentialHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void createWithUser( + int? identifier, + String? user, + String? password, + _i3.NSUrlCredentialPersistence? persistence, + ) => + super.noSuchMethod( + Invocation.method( + #createWithUser, + [ + identifier, + user, + password, + persistence, + ], + ), + returnValueForMissingStub: null, + ); +} + /// A class which mocks [TestNSUrlHostApi]. /// /// See the documentation for Mockito's code generation for more information. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart index f6295668363ffa88c868112f61ddaf4de3cd9585..576d0404693f9c1227f6989b6adc0248e5ba0f54 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart @@ -9,7 +9,9 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:webview_flutter_wkwebview/src/common/instance_manager.dart'; +import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart'; import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart'; +import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit_api_impls.dart'; import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart'; import '../common/test_web_kit.g.dart'; @@ -19,6 +21,7 @@ import 'ui_kit_test.mocks.dart'; TestWKWebViewConfigurationHostApi, TestWKWebViewHostApi, TestUIScrollViewHostApi, + TestUIScrollViewDelegateHostApi, TestUIViewHostApi, ]) void main() { @@ -85,6 +88,58 @@ void main() { 10.0, )); }); + + test('setDelegate', () async { + final UIScrollViewDelegate delegate = UIScrollViewDelegate.detached( + instanceManager: instanceManager, + ); + const int delegateIdentifier = 10; + instanceManager.addHostCreatedInstance(delegate, delegateIdentifier); + await scrollView.setDelegate(delegate); + verify(mockPlatformHostApi.setDelegate( + scrollViewInstanceId, + delegateIdentifier, + )); + }); + }); + + group('UIScrollViewDelegate', () { + // Ensure the test host api is removed after each test run. + tearDown(() => TestUIScrollViewDelegateHostApi.setup(null)); + + test('Host API create', () { + final MockTestUIScrollViewDelegateHostApi mockApi = + MockTestUIScrollViewDelegateHostApi(); + TestUIScrollViewDelegateHostApi.setup(mockApi); + + UIScrollViewDelegate(instanceManager: instanceManager); + verify(mockApi.create(0)); + }); + + test('scrollViewDidScroll', () { + final UIScrollViewDelegateFlutterApi flutterApi = + UIScrollViewDelegateFlutterApiImpl( + instanceManager: instanceManager, + ); + + final UIScrollView scrollView = UIScrollView.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(scrollView, 0); + + List? args; + final UIScrollViewDelegate scrollViewDelegate = + UIScrollViewDelegate.detached( + scrollViewDidScroll: (UIScrollView scrollView, double x, double y) { + args = [scrollView, x, y]; + }, + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(scrollViewDelegate, 1); + + flutterApi.scrollViewDidScroll(1, 0, 5, 6); + expect(args, [scrollView, 5, 6]); + }); }); group('UIView', () { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index 65fdc41b275f55a0ccdad2470871f31bcd9cb095..66bbc7275e69e8355c831911a2911944fcd98569 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import '../common/test_web_kit.g.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -38,6 +40,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void createFromWebView( int? identifier, @@ -53,6 +56,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setAllowsInlineMediaPlayback( int? identifier, @@ -68,6 +72,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setLimitsNavigationsToAppBoundDomains( int? identifier, @@ -83,6 +88,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setMediaTypesRequiringUserActionForPlayback( int? identifier, @@ -124,6 +130,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setUIDelegate( int? identifier, @@ -139,6 +146,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setNavigationDelegate( int? identifier, @@ -154,11 +162,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override String? getUrl(int? identifier) => (super.noSuchMethod(Invocation.method( #getUrl, [identifier], )) as String?); + @override double getEstimatedProgress(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -167,6 +177,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: 0.0, ) as double); + @override void loadRequest( int? identifier, @@ -182,6 +193,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadHtmlString( int? identifier, @@ -199,6 +211,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadFileUrl( int? identifier, @@ -216,6 +229,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadFlutterAsset( int? identifier, @@ -231,6 +245,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override bool canGoBack(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -239,6 +254,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override bool canGoForward(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -247,6 +263,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override void goBack(int? identifier) => super.noSuchMethod( Invocation.method( @@ -255,6 +272,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void goForward(int? identifier) => super.noSuchMethod( Invocation.method( @@ -263,6 +281,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void reload(int? identifier) => super.noSuchMethod( Invocation.method( @@ -271,11 +290,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override String? getTitle(int? identifier) => (super.noSuchMethod(Invocation.method( #getTitle, [identifier], )) as String?); + @override void setAllowsBackForwardNavigationGestures( int? identifier, @@ -291,6 +312,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setCustomUserAgent( int? identifier, @@ -306,6 +328,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i4.Future evaluateJavaScript( int? identifier, @@ -321,6 +344,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: _i4.Future.value(), ) as _i4.Future); + @override void setInspectable( int? identifier, @@ -336,6 +360,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + + @override + String? getCustomUserAgent(int? identifier) => + (super.noSuchMethod(Invocation.method( + #getCustomUserAgent, + [identifier], + )) as String?); } /// A class which mocks [TestUIScrollViewHostApi]. @@ -362,6 +393,7 @@ class MockTestUIScrollViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override List getContentOffset(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -370,6 +402,7 @@ class MockTestUIScrollViewHostApi extends _i1.Mock ), returnValue: [], ) as List); + @override void scrollBy( int? identifier, @@ -387,6 +420,7 @@ class MockTestUIScrollViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setContentOffset( int? identifier, @@ -404,6 +438,41 @@ class MockTestUIScrollViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + + @override + void setDelegate( + int? identifier, + int? uiScrollViewDelegateIdentifier, + ) => + super.noSuchMethod( + Invocation.method( + #setDelegate, + [ + identifier, + uiScrollViewDelegateIdentifier, + ], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [TestUIScrollViewDelegateHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestUIScrollViewDelegateHostApi extends _i1.Mock + implements _i2.TestUIScrollViewDelegateHostApi { + MockTestUIScrollViewDelegateHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void create(int? identifier) => super.noSuchMethod( + Invocation.method( + #create, + [identifier], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestUIViewHostApi]. @@ -429,6 +498,7 @@ class MockTestUIViewHostApi extends _i1.Mock implements _i2.TestUIViewHostApi { ), returnValueForMissingStub: null, ); + @override void setOpaque( int? identifier, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart index 055f342ab786d5480357a88bf1b7b935e5ae52fc..e0eeb941cce998565e2a48ac26002e616cfdb039 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart @@ -585,7 +585,12 @@ void main() { url: 'url', allHttpHeaderFields: {}, ), - targetFrame: WKFrameInfoData(isMainFrame: false), + targetFrame: WKFrameInfoData( + isMainFrame: false, + request: NSUrlRequestData( + url: 'url', + allHttpHeaderFields: {}, + )), navigationType: WKNavigationType.linkActivated, ), ); @@ -683,6 +688,63 @@ void main() { expect(argsCompleter.future, completion([webView])); }); + + test('didReceiveAuthenticationChallenge', () async { + WebKitFlutterApis.instance = WebKitFlutterApis( + instanceManager: instanceManager, + ); + + const int credentialIdentifier = 3; + final NSUrlCredential credential = NSUrlCredential.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance( + credential, + credentialIdentifier, + ); + + navigationDelegate = WKNavigationDelegate( + instanceManager: instanceManager, + didReceiveAuthenticationChallenge: ( + WKWebView webView, + NSUrlAuthenticationChallenge challenge, + void Function( + NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential, + ) completionHandler, + ) { + completionHandler( + NSUrlSessionAuthChallengeDisposition.useCredential, + credential, + ); + }, + ); + + const int challengeIdentifier = 27; + instanceManager.addHostCreatedInstance( + NSUrlAuthenticationChallenge.detached( + protectionSpace: NSUrlProtectionSpace.detached( + host: null, + realm: null, + authenticationMethod: null, + ), + instanceManager: instanceManager, + ), + challengeIdentifier, + ); + + final AuthenticationChallengeResponse response = await WebKitFlutterApis + .instance.navigationDelegate + .didReceiveAuthenticationChallenge( + instanceManager.getIdentifier(navigationDelegate)!, + instanceManager.getIdentifier(webView)!, + challengeIdentifier, + ); + + expect(response.disposition, + NSUrlSessionAuthChallengeDisposition.useCredential); + expect(response.credentialIdentifier, credentialIdentifier); + }); }); group('WKWebView', () { @@ -833,7 +895,7 @@ void main() { )); }); - test('customUserAgent', () { + test('setCustomUserAgent', () { webView.setCustomUserAgent('hello'); verify(mockPlatformHostApi.setCustomUserAgent( webViewInstanceId, @@ -841,6 +903,14 @@ void main() { )); }); + test('getCustomUserAgent', () { + const String userAgent = 'str'; + when( + mockPlatformHostApi.getCustomUserAgent(webViewInstanceId), + ).thenReturn(userAgent); + expect(webView.getCustomUserAgent(), completion(userAgent)); + }); + test('evaluateJavaScript', () { when(mockPlatformHostApi.evaluateJavaScript(webViewInstanceId, 'gogo')) .thenAnswer((_) => Future.value('stopstop')); @@ -939,7 +1009,12 @@ void main() { url: 'url', allHttpHeaderFields: {}, ), - targetFrame: WKFrameInfoData(isMainFrame: false), + targetFrame: WKFrameInfoData( + isMainFrame: false, + request: NSUrlRequestData( + url: 'url', + allHttpHeaderFields: {}, + )), navigationType: WKNavigationType.linkActivated, ), ); @@ -998,7 +1073,8 @@ void main() { const WKSecurityOrigin origin = WKSecurityOrigin(host: 'host', port: 12, protocol: 'protocol'); - const WKFrameInfo frame = WKFrameInfo(isMainFrame: false); + const WKFrameInfo frame = + WKFrameInfo(isMainFrame: false, request: NSUrlRequest(url: 'url')); const WKMediaCaptureType type = WKMediaCaptureType.microphone; flutterApi.requestMediaCapturePermission( @@ -1009,7 +1085,10 @@ void main() { port: origin.port, protocol: origin.protocol, ), - WKFrameInfoData(isMainFrame: frame.isMainFrame), + WKFrameInfoData( + isMainFrame: frame.isMainFrame, + request: NSUrlRequestData( + url: 'url', allHttpHeaderFields: {})), WKMediaCaptureTypeData(value: type), ); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index e92132bdeb24ae9646b43a117e88e2e310033d36..d9a0ed01d50d46d9d195881b5d77c6c5f3374901 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import '../common/test_web_kit.g.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -45,6 +47,7 @@ class MockTestWKHttpCookieStoreHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i3.Future setCookie( int? identifier, @@ -106,6 +109,7 @@ class MockTestWKPreferencesHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setJavaScriptEnabled( int? identifier, @@ -185,6 +189,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void addScriptMessageHandler( int? identifier, @@ -202,6 +207,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeScriptMessageHandler( int? identifier, @@ -217,6 +223,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeAllScriptMessageHandlers(int? identifier) => super.noSuchMethod( Invocation.method( @@ -225,6 +232,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void addUserScript( int? identifier, @@ -240,6 +248,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeAllUserScripts(int? identifier) => super.noSuchMethod( Invocation.method( @@ -267,6 +276,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void createFromWebView( int? identifier, @@ -282,6 +292,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setAllowsInlineMediaPlayback( int? identifier, @@ -297,6 +308,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setLimitsNavigationsToAppBoundDomains( int? identifier, @@ -312,6 +324,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setMediaTypesRequiringUserActionForPlayback( int? identifier, @@ -353,6 +366,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setUIDelegate( int? identifier, @@ -368,6 +382,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setNavigationDelegate( int? identifier, @@ -383,11 +398,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override String? getUrl(int? identifier) => (super.noSuchMethod(Invocation.method( #getUrl, [identifier], )) as String?); + @override double getEstimatedProgress(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -396,6 +413,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: 0.0, ) as double); + @override void loadRequest( int? identifier, @@ -411,6 +429,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadHtmlString( int? identifier, @@ -428,6 +447,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadFileUrl( int? identifier, @@ -445,6 +465,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void loadFlutterAsset( int? identifier, @@ -460,6 +481,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override bool canGoBack(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -468,6 +490,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override bool canGoForward(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -476,6 +499,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override void goBack(int? identifier) => super.noSuchMethod( Invocation.method( @@ -484,6 +508,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void goForward(int? identifier) => super.noSuchMethod( Invocation.method( @@ -492,6 +517,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void reload(int? identifier) => super.noSuchMethod( Invocation.method( @@ -500,11 +526,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override String? getTitle(int? identifier) => (super.noSuchMethod(Invocation.method( #getTitle, [identifier], )) as String?); + @override void setAllowsBackForwardNavigationGestures( int? identifier, @@ -520,6 +548,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setCustomUserAgent( int? identifier, @@ -535,6 +564,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i3.Future evaluateJavaScript( int? identifier, @@ -550,6 +580,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValue: _i3.Future.value(), ) as _i3.Future); + @override void setInspectable( int? identifier, @@ -565,6 +596,13 @@ class MockTestWKWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + + @override + String? getCustomUserAgent(int? identifier) => + (super.noSuchMethod(Invocation.method( + #getCustomUserAgent, + [identifier], + )) as String?); } /// A class which mocks [TestWKWebsiteDataStoreHostApi]. @@ -591,6 +629,7 @@ class MockTestWKWebsiteDataStoreHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void createDefaultDataStore(int? identifier) => super.noSuchMethod( Invocation.method( @@ -599,6 +638,7 @@ class MockTestWKWebsiteDataStoreHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i3.Future removeDataOfTypes( int? identifier, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart index 4581c92b788f580521918c714c1e6f99902da76e..171e4056feed1c47305b673c3b934634829f0b19 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; +import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart'; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart'; import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart'; import 'package:webview_flutter_wkwebview/src/webkit_proxy.dart'; @@ -204,7 +205,9 @@ void main() { WKWebView.detached(), const WKNavigationAction( request: NSUrlRequest(url: 'https://www.google.com'), - targetFrame: WKFrameInfo(isMainFrame: false), + targetFrame: WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com')), navigationType: WKNavigationType.linkActivated, ), ), @@ -214,6 +217,44 @@ void main() { expect(callbackRequest.url, 'https://www.google.com'); expect(callbackRequest.isMainFrame, isFalse); }); + + test('onHttpBasicAuthRequest emits host and realm', () { + final WebKitNavigationDelegate iosNavigationDelegate = + WebKitNavigationDelegate( + const WebKitNavigationDelegateCreationParams( + webKitProxy: WebKitProxy( + createNavigationDelegate: CapturingNavigationDelegate.new, + ), + ), + ); + + String? callbackHost; + String? callbackRealm; + + iosNavigationDelegate.setOnHttpAuthRequest((HttpAuthRequest request) { + callbackHost = request.host; + callbackRealm = request.realm; + }); + + const String expectedHost = 'expectedHost'; + const String expectedRealm = 'expectedRealm'; + + CapturingNavigationDelegate + .lastCreatedDelegate.didReceiveAuthenticationChallenge!( + WKWebView.detached(), + NSUrlAuthenticationChallenge.detached( + protectionSpace: NSUrlProtectionSpace.detached( + host: expectedHost, + realm: expectedRealm, + authenticationMethod: NSUrlAuthenticationMethod.httpBasic, + ), + ), + (NSUrlSessionAuthChallengeDisposition disposition, + NSUrlCredential? credential) {}); + + expect(callbackHost, expectedHost); + expect(callbackRealm, expectedRealm); + }); }); } @@ -226,6 +267,7 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { super.didFailProvisionalNavigation, super.decidePolicyForNavigationAction, super.webViewWebContentProcessDidTerminate, + super.didReceiveAuthenticationChallenge, }) : super.detached() { lastCreatedDelegate = this; } @@ -238,6 +280,9 @@ class CapturingUIDelegate extends WKUIDelegate { CapturingUIDelegate({ super.onCreateWebView, super.requestMediaCapturePermission, + super.runJavaScriptAlertDialog, + super.runJavaScriptConfirmDialog, + super.runJavaScriptTextInputDialog, super.instanceManager, }) : super.detached() { lastCreatedDelegate = this; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart index 2cd20e0f6889c60e5a926d5e082818fcf0698f23..a23eef8d8fbd41742ad56f7ea8a2dd8fb134e587 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart @@ -23,11 +23,13 @@ import 'webkit_webview_controller_test.mocks.dart'; @GenerateMocks([ NSUrl, UIScrollView, + UIScrollViewDelegate, WKPreferences, WKUserContentController, WKWebsiteDataStore, WKWebView, WKWebViewConfiguration, + WKScriptMessageHandler, ]) void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -35,6 +37,7 @@ void main() { group('WebKitWebViewController', () { WebKitWebViewController createControllerWithMocks({ MockUIScrollView? mockScrollView, + UIScrollViewDelegate? scrollViewDelegate, MockWKPreferences? mockPreferences, WKUIDelegate? uiDelegate, MockWKUserContentController? mockUserContentController, @@ -90,12 +93,37 @@ void main() { WKFrameInfo frame, WKMediaCaptureType type, )? requestMediaCapturePermission, + Future Function( + String message, + WKFrameInfo frame, + )? runJavaScriptAlertDialog, + Future Function( + String message, + WKFrameInfo frame, + )? runJavaScriptConfirmDialog, + Future Function( + String prompt, + String defaultText, + WKFrameInfo frame, + )? runJavaScriptTextInputDialog, InstanceManager? instanceManager, }) { return uiDelegate ?? CapturingUIDelegate( - onCreateWebView: onCreateWebView, - requestMediaCapturePermission: requestMediaCapturePermission, + onCreateWebView: onCreateWebView, + requestMediaCapturePermission: + requestMediaCapturePermission, + runJavaScriptAlertDialog: runJavaScriptAlertDialog, + runJavaScriptConfirmDialog: runJavaScriptConfirmDialog, + runJavaScriptTextInputDialog: runJavaScriptTextInputDialog); + }, + createScriptMessageHandler: WKScriptMessageHandler.detached, + createUIScrollViewDelegate: ({ + void Function(UIScrollView, double, double)? scrollViewDidScroll, + }) { + return scrollViewDelegate ?? + CapturingUIScrollViewDelegate( + scrollViewDidScroll: scrollViewDidScroll, ); }, ), @@ -158,6 +186,25 @@ void main() { ); }); + test( + 'limitsNavigationsToAppBoundDomains is not called if it uses default value (false)', + () { + final MockWKWebViewConfiguration mockConfiguration = + MockWKWebViewConfiguration(); + + WebKitWebViewControllerCreationParams( + webKitProxy: WebKitProxy( + createWebViewConfiguration: ({InstanceManager? instanceManager}) { + return mockConfiguration; + }, + ), + ); + + verifyNever( + mockConfiguration.setLimitsNavigationsToAppBoundDomains(any), + ); + }); + test('mediaTypesRequiringUserAction', () { final MockWKWebViewConfiguration mockConfiguration = MockWKWebViewConfiguration(); @@ -735,6 +782,45 @@ void main() { ); }); + test('addJavaScriptChannel requires channel with a unique name', () async { + final WebKitProxy webKitProxy = WebKitProxy( + createScriptMessageHandler: ({ + required void Function( + WKUserContentController userContentController, + WKScriptMessage message, + ) didReceiveScriptMessage, + }) { + return WKScriptMessageHandler.detached( + didReceiveScriptMessage: didReceiveScriptMessage, + ); + }, + ); + final MockWKUserContentController mockUserContentController = + MockWKUserContentController(); + final WebKitWebViewController controller = createControllerWithMocks( + mockUserContentController: mockUserContentController, + ); + + const String nonUniqueName = 'name'; + final WebKitJavaScriptChannelParams javaScriptChannelParams = + WebKitJavaScriptChannelParams( + name: nonUniqueName, + onMessageReceived: (JavaScriptMessage message) {}, + webKitProxy: webKitProxy, + ); + await controller.addJavaScriptChannel(javaScriptChannelParams); + + expect( + () => controller.addJavaScriptChannel( + JavaScriptChannelParams( + name: nonUniqueName, + onMessageReceived: (_) {}, + ), + ), + throwsArgumentError, + ); + }); + test('removeJavaScriptChannel', () async { final WebKitProxy webKitProxy = WebKitProxy( createScriptMessageHandler: ({ @@ -823,6 +909,21 @@ void main() { ); }); + test('getUserAgent', () { + final MockWKWebView mockWebView = MockWKWebView(); + + final WebKitWebViewController controller = createControllerWithMocks( + createMockWebView: (_, {dynamic observeValue}) => mockWebView, + ); + + const String userAgent = 'str'; + + when(mockWebView.getCustomUserAgent()).thenAnswer( + (_) => Future.value(userAgent), + ); + expect(controller.getUserAgent(), completion(userAgent)); + }); + test('setPlatformNavigationDelegate', () { final MockWKWebView mockWebView = MockWKWebView(); @@ -924,7 +1025,9 @@ void main() { WKWebViewConfiguration.detached(), const WKNavigationAction( request: request, - targetFrame: WKFrameInfo(isMainFrame: false), + targetFrame: WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com')), navigationType: WKNavigationType.linkActivated, ), ); @@ -1143,7 +1246,9 @@ void main() { CapturingUIDelegate.lastCreatedDelegate, WKWebView.detached(), const WKSecurityOrigin(host: '', port: 0, protocol: ''), - const WKFrameInfo(isMainFrame: false), + const WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com')), WKMediaCaptureType.microphone, ); @@ -1153,6 +1258,84 @@ void main() { expect(decision, WKPermissionDecision.grant); }); + group('JavaScript Dialog', () { + test('setOnJavaScriptAlertDialog', () async { + final WebKitWebViewController controller = createControllerWithMocks(); + late final String message; + await controller.setOnJavaScriptAlertDialog( + (JavaScriptAlertDialogRequest request) async { + message = request.message; + return; + }); + + const String callbackMessage = 'Message'; + final Future Function(String message, WKFrameInfo frame) + onJavaScriptAlertDialog = + CapturingUIDelegate.lastCreatedDelegate.runJavaScriptAlertDialog!; + await onJavaScriptAlertDialog( + callbackMessage, + const WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com'))); + + expect(message, callbackMessage); + }); + + test('setOnJavaScriptConfirmDialog', () async { + final WebKitWebViewController controller = createControllerWithMocks(); + late final String message; + const bool callbackReturnValue = true; + await controller.setOnJavaScriptConfirmDialog( + (JavaScriptConfirmDialogRequest request) async { + message = request.message; + return callbackReturnValue; + }); + + const String callbackMessage = 'Message'; + final Future Function(String message, WKFrameInfo frame) + onJavaScriptConfirmDialog = + CapturingUIDelegate.lastCreatedDelegate.runJavaScriptConfirmDialog!; + final bool returnValue = await onJavaScriptConfirmDialog( + callbackMessage, + const WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com'))); + + expect(message, callbackMessage); + expect(returnValue, callbackReturnValue); + }); + + test('setOnJavaScriptTextInputDialog', () async { + final WebKitWebViewController controller = createControllerWithMocks(); + late final String message; + late final String? defaultText; + const String callbackReturnValue = 'Return Value'; + await controller.setOnJavaScriptTextInputDialog( + (JavaScriptTextInputDialogRequest request) async { + message = request.message; + defaultText = request.defaultText; + return callbackReturnValue; + }); + + const String callbackMessage = 'Message'; + const String callbackDefaultText = 'Default Text'; + final Future Function( + String prompt, String defaultText, WKFrameInfo frame) + onJavaScriptTextInputDialog = CapturingUIDelegate + .lastCreatedDelegate.runJavaScriptTextInputDialog!; + final String returnValue = await onJavaScriptTextInputDialog( + callbackMessage, + callbackDefaultText, + const WKFrameInfo( + isMainFrame: false, + request: NSUrlRequest(url: 'https://google.com'))); + + expect(message, callbackMessage); + expect(defaultText, callbackDefaultText); + expect(returnValue, callbackReturnValue); + }); + }); + test('inspectable', () async { final MockWKWebView mockWebView = MockWKWebView(); @@ -1163,6 +1346,151 @@ void main() { await controller.setInspectable(true); verify(mockWebView.setInspectable(true)); }); + + group('Console logging', () { + test('setConsoleLogCallback should inject the correct JavaScript', + () async { + final MockWKUserContentController mockUserContentController = + MockWKUserContentController(); + final WebKitWebViewController controller = createControllerWithMocks( + mockUserContentController: mockUserContentController, + ); + + await controller + .setOnConsoleMessage((JavaScriptConsoleMessage message) {}); + + final List capturedScripts = + verify(mockUserContentController.addUserScript(captureAny)) + .captured + .toList(); + final WKUserScript messageHandlerScript = + capturedScripts[0] as WKUserScript; + final WKUserScript overrideConsoleScript = + capturedScripts[1] as WKUserScript; + + expect(messageHandlerScript.isMainFrameOnly, isFalse); + expect(messageHandlerScript.injectionTime, + WKUserScriptInjectionTime.atDocumentStart); + expect(messageHandlerScript.source, + 'window.fltConsoleMessage = webkit.messageHandlers.fltConsoleMessage;'); + + expect(overrideConsoleScript.isMainFrameOnly, isTrue); + expect(overrideConsoleScript.injectionTime, + WKUserScriptInjectionTime.atDocumentStart); + expect(overrideConsoleScript.source, ''' +function log(type, args) { + var message = Object.values(args) + .map(v => typeof(v) === "undefined" ? "undefined" : typeof(v) === "object" ? JSON.stringify(v) : v.toString()) + .map(v => v.substring(0, 3000)) // Limit msg to 3000 chars + .join(", "); + + var log = { + level: type, + message: message + }; + + window.webkit.messageHandlers.fltConsoleMessage.postMessage(JSON.stringify(log)); +} + +let originalLog = console.log; +let originalInfo = console.info; +let originalWarn = console.warn; +let originalError = console.error; +let originalDebug = console.debug; + +console.log = function() { log("log", arguments); originalLog.apply(null, arguments) }; +console.info = function() { log("info", arguments); originalInfo.apply(null, arguments) }; +console.warn = function() { log("warning", arguments); originalWarn.apply(null, arguments) }; +console.error = function() { log("error", arguments); originalError.apply(null, arguments) }; +console.debug = function() { log("debug", arguments); originalDebug.apply(null, arguments) }; + +window.addEventListener("error", function(e) { + log("error", e.message + " at " + e.filename + ":" + e.lineno + ":" + e.colno); +}); + '''); + }); + + test('setConsoleLogCallback should parse levels correctly', () async { + final MockWKUserContentController mockUserContentController = + MockWKUserContentController(); + final WebKitWebViewController controller = createControllerWithMocks( + mockUserContentController: mockUserContentController, + ); + + final Map logs = + {}; + await controller.setOnConsoleMessage( + (JavaScriptConsoleMessage message) => + logs[message.level] = message.message); + + final List capturedParameters = verify( + mockUserContentController.addScriptMessageHandler( + captureAny, any)) + .captured + .toList(); + final WKScriptMessageHandler scriptMessageHandler = + capturedParameters[0] as WKScriptMessageHandler; + + scriptMessageHandler.didReceiveScriptMessage( + mockUserContentController, + const WKScriptMessage( + name: 'test', + body: '{"level": "debug", "message": "Debug message"}')); + scriptMessageHandler.didReceiveScriptMessage( + mockUserContentController, + const WKScriptMessage( + name: 'test', + body: '{"level": "error", "message": "Error message"}')); + scriptMessageHandler.didReceiveScriptMessage( + mockUserContentController, + const WKScriptMessage( + name: 'test', + body: '{"level": "info", "message": "Info message"}')); + scriptMessageHandler.didReceiveScriptMessage( + mockUserContentController, + const WKScriptMessage( + name: 'test', + body: '{"level": "log", "message": "Log message"}')); + scriptMessageHandler.didReceiveScriptMessage( + mockUserContentController, + const WKScriptMessage( + name: 'test', + body: '{"level": "warning", "message": "Warning message"}')); + + expect(logs.length, 5); + expect(logs[JavaScriptLogLevel.debug], 'Debug message'); + expect(logs[JavaScriptLogLevel.error], 'Error message'); + expect(logs[JavaScriptLogLevel.info], 'Info message'); + expect(logs[JavaScriptLogLevel.log], 'Log message'); + expect(logs[JavaScriptLogLevel.warning], 'Warning message'); + }); + }); + + test('setOnScrollPositionChange', () async { + final WebKitWebViewController controller = createControllerWithMocks(); + + final Completer changeCompleter = + Completer(); + await controller.setOnScrollPositionChange( + (ScrollPositionChange change) { + changeCompleter.complete(change); + }, + ); + + final void Function( + UIScrollView scrollView, + double, + double, + ) onScrollViewDidScroll = CapturingUIScrollViewDelegate + .lastCreatedDelegate.scrollViewDidScroll!; + + final MockUIScrollView mockUIScrollView = MockUIScrollView(); + onScrollViewDidScroll(mockUIScrollView, 1.0, 2.0); + + final ScrollPositionChange change = await changeCompleter.future; + expect(change.x, 1.0); + expect(change.y, 2.0); + }); }); group('WebKitJavaScriptChannelParams', () { @@ -1211,6 +1539,7 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { super.didFailProvisionalNavigation, super.decidePolicyForNavigationAction, super.webViewWebContentProcessDidTerminate, + super.didReceiveAuthenticationChallenge, }) : super.detached() { lastCreatedDelegate = this; } @@ -1224,6 +1553,9 @@ class CapturingUIDelegate extends WKUIDelegate { CapturingUIDelegate({ super.onCreateWebView, super.requestMediaCapturePermission, + super.runJavaScriptAlertDialog, + super.runJavaScriptConfirmDialog, + super.runJavaScriptTextInputDialog, super.instanceManager, }) : super.detached() { lastCreatedDelegate = this; @@ -1231,3 +1563,15 @@ class CapturingUIDelegate extends WKUIDelegate { static CapturingUIDelegate lastCreatedDelegate = CapturingUIDelegate(); } + +class CapturingUIScrollViewDelegate extends UIScrollViewDelegate { + CapturingUIScrollViewDelegate({ + super.scrollViewDidScroll, + super.instanceManager, + }) : super.detached() { + lastCreatedDelegate = this; + } + + static CapturingUIScrollViewDelegate lastCreatedDelegate = + CapturingUIScrollViewDelegate(); +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart index 84f1587f45a3e757a7cd0287f14559f98be9a4ce..cc7b6932f66f5f004d4a503a62773c4801eb8ba4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/webkit_webview_controller_test.dart. // Do not manually edit this file. @@ -17,6 +17,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -55,8 +57,9 @@ class _FakeUIScrollView_2 extends _i1.SmartFake implements _i4.UIScrollView { ); } -class _FakeWKPreferences_3 extends _i1.SmartFake implements _i5.WKPreferences { - _FakeWKPreferences_3( +class _FakeUIScrollViewDelegate_3 extends _i1.SmartFake + implements _i4.UIScrollViewDelegate { + _FakeUIScrollViewDelegate_3( Object parent, Invocation parentInvocation, ) : super( @@ -65,9 +68,19 @@ class _FakeWKPreferences_3 extends _i1.SmartFake implements _i5.WKPreferences { ); } -class _FakeWKUserContentController_4 extends _i1.SmartFake +class _FakeWKPreferences_4 extends _i1.SmartFake implements _i5.WKPreferences { + _FakeWKPreferences_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeWKUserContentController_5 extends _i1.SmartFake implements _i5.WKUserContentController { - _FakeWKUserContentController_4( + _FakeWKUserContentController_5( Object parent, Invocation parentInvocation, ) : super( @@ -76,9 +89,9 @@ class _FakeWKUserContentController_4 extends _i1.SmartFake ); } -class _FakeWKHttpCookieStore_5 extends _i1.SmartFake +class _FakeWKHttpCookieStore_6 extends _i1.SmartFake implements _i5.WKHttpCookieStore { - _FakeWKHttpCookieStore_5( + _FakeWKHttpCookieStore_6( Object parent, Invocation parentInvocation, ) : super( @@ -87,9 +100,9 @@ class _FakeWKHttpCookieStore_5 extends _i1.SmartFake ); } -class _FakeWKWebsiteDataStore_6 extends _i1.SmartFake +class _FakeWKWebsiteDataStore_7 extends _i1.SmartFake implements _i5.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_6( + _FakeWKWebsiteDataStore_7( Object parent, Invocation parentInvocation, ) : super( @@ -98,9 +111,9 @@ class _FakeWKWebsiteDataStore_6 extends _i1.SmartFake ); } -class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake +class _FakeWKWebViewConfiguration_8 extends _i1.SmartFake implements _i5.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_7( + _FakeWKWebViewConfiguration_8( Object parent, Invocation parentInvocation, ) : super( @@ -109,8 +122,19 @@ class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake ); } -class _FakeWKWebView_8 extends _i1.SmartFake implements _i5.WKWebView { - _FakeWKWebView_8( +class _FakeWKWebView_9 extends _i1.SmartFake implements _i5.WKWebView { + _FakeWKWebView_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeWKScriptMessageHandler_10 extends _i1.SmartFake + implements _i5.WKScriptMessageHandler { + _FakeWKScriptMessageHandler_10( Object parent, Invocation parentInvocation, ) : super( @@ -135,6 +159,7 @@ class MockNSUrl extends _i1.Mock implements _i2.NSUrl { ), returnValue: _i6.Future.value(), ) as _i6.Future); + @override _i2.NSObject copy() => (super.noSuchMethod( Invocation.method( @@ -149,6 +174,7 @@ class MockNSUrl extends _i1.Mock implements _i2.NSUrl { ), ), ) as _i2.NSObject); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -167,6 +193,7 @@ class MockNSUrl extends _i1.Mock implements _i2.NSUrl { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -206,6 +233,7 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { ), )), ) as _i6.Future<_i3.Point>); + @override _i6.Future scrollBy(_i3.Point? offset) => (super.noSuchMethod( Invocation.method( @@ -215,6 +243,7 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setContentOffset(_i3.Point? offset) => (super.noSuchMethod( @@ -225,6 +254,18 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + + @override + _i6.Future setDelegate(_i4.UIScrollViewDelegate? delegate) => + (super.noSuchMethod( + Invocation.method( + #setDelegate, + [delegate], + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + @override _i4.UIScrollView copy() => (super.noSuchMethod( Invocation.method( @@ -239,6 +280,7 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { ), ), ) as _i4.UIScrollView); + @override _i6.Future setBackgroundColor(_i7.Color? color) => (super.noSuchMethod( Invocation.method( @@ -248,6 +290,7 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( @@ -257,6 +300,67 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + + @override + _i6.Future addObserver( + _i2.NSObject? observer, { + required String? keyPath, + required Set<_i2.NSKeyValueObservingOptions>? options, + }) => + (super.noSuchMethod( + Invocation.method( + #addObserver, + [observer], + { + #keyPath: keyPath, + #options: options, + }, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + + @override + _i6.Future removeObserver( + _i2.NSObject? observer, { + required String? keyPath, + }) => + (super.noSuchMethod( + Invocation.method( + #removeObserver, + [observer], + {#keyPath: keyPath}, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); +} + +/// A class which mocks [UIScrollViewDelegate]. +/// +/// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable +class MockUIScrollViewDelegate extends _i1.Mock + implements _i4.UIScrollViewDelegate { + MockUIScrollViewDelegate() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.UIScrollViewDelegate copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeUIScrollViewDelegate_3( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i4.UIScrollViewDelegate); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -275,6 +379,7 @@ class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -309,13 +414,14 @@ class MockWKPreferences extends _i1.Mock implements _i5.WKPreferences { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i5.WKPreferences copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKPreferences_3( + returnValue: _FakeWKPreferences_4( this, Invocation.method( #copy, @@ -323,6 +429,7 @@ class MockWKPreferences extends _i1.Mock implements _i5.WKPreferences { ), ), ) as _i5.WKPreferences); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -341,6 +448,7 @@ class MockWKPreferences extends _i1.Mock implements _i5.WKPreferences { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -383,6 +491,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( @@ -393,6 +502,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( Invocation.method( @@ -402,6 +512,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future addUserScript(_i5.WKUserScript? userScript) => (super.noSuchMethod( @@ -412,6 +523,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeAllUserScripts() => (super.noSuchMethod( Invocation.method( @@ -421,13 +533,14 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i5.WKUserContentController copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKUserContentController_4( + returnValue: _FakeWKUserContentController_5( this, Invocation.method( #copy, @@ -435,6 +548,7 @@ class MockWKUserContentController extends _i1.Mock ), ), ) as _i5.WKUserContentController); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -453,6 +567,7 @@ class MockWKUserContentController extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -482,11 +597,12 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i5.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod( Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHttpCookieStore_5( + returnValue: _FakeWKHttpCookieStore_6( this, Invocation.getter(#httpCookieStore), ), ) as _i5.WKHttpCookieStore); + @override _i6.Future removeDataOfTypes( Set<_i5.WKWebsiteDataType>? dataTypes, @@ -502,13 +618,14 @@ class MockWKWebsiteDataStore extends _i1.Mock ), returnValue: _i6.Future.value(false), ) as _i6.Future); + @override _i5.WKWebsiteDataStore copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebsiteDataStore_6( + returnValue: _FakeWKWebsiteDataStore_7( this, Invocation.method( #copy, @@ -516,6 +633,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), ), ) as _i5.WKWebsiteDataStore); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -534,6 +652,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -562,11 +681,12 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { @override _i5.WKWebViewConfiguration get configuration => (super.noSuchMethod( Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_7( + returnValue: _FakeWKWebViewConfiguration_8( this, Invocation.getter(#configuration), ), ) as _i5.WKWebViewConfiguration); + @override _i4.UIScrollView get scrollView => (super.noSuchMethod( Invocation.getter(#scrollView), @@ -575,6 +695,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { Invocation.getter(#scrollView), ), ) as _i4.UIScrollView); + @override _i6.Future setUIDelegate(_i5.WKUIDelegate? delegate) => (super.noSuchMethod( @@ -585,6 +706,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setNavigationDelegate(_i5.WKNavigationDelegate? delegate) => (super.noSuchMethod( @@ -595,6 +717,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -603,6 +726,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future getEstimatedProgress() => (super.noSuchMethod( Invocation.method( @@ -611,6 +735,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(0.0), ) as _i6.Future); + @override _i6.Future loadRequest(_i2.NSUrlRequest? request) => (super.noSuchMethod( @@ -621,6 +746,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future loadHtmlString( String? string, { @@ -635,6 +761,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future loadFileUrl( String? url, { @@ -649,6 +776,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -658,6 +786,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -666,6 +795,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(false), ) as _i6.Future); + @override _i6.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -674,6 +804,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(false), ) as _i6.Future); + @override _i6.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -683,6 +814,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -692,6 +824,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future reload() => (super.noSuchMethod( Invocation.method( @@ -701,6 +834,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -709,6 +843,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( @@ -719,6 +854,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -728,6 +864,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( @@ -737,6 +874,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), returnValue: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setInspectable(bool? inspectable) => (super.noSuchMethod( Invocation.method( @@ -746,13 +884,23 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + + @override + _i6.Future getCustomUserAgent() => (super.noSuchMethod( + Invocation.method( + #getCustomUserAgent, + [], + ), + returnValue: _i6.Future.value(), + ) as _i6.Future); + @override _i5.WKWebView copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebView_8( + returnValue: _FakeWKWebView_9( this, Invocation.method( #copy, @@ -760,6 +908,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { ), ), ) as _i5.WKWebView); + @override _i6.Future setBackgroundColor(_i7.Color? color) => (super.noSuchMethod( Invocation.method( @@ -769,6 +918,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( @@ -778,6 +928,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -796,6 +947,7 @@ class MockWKWebView extends _i1.Mock implements _i5.WKWebView { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { @@ -825,27 +977,30 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i5.WKUserContentController get userContentController => (super.noSuchMethod( Invocation.getter(#userContentController), - returnValue: _FakeWKUserContentController_4( + returnValue: _FakeWKUserContentController_5( this, Invocation.getter(#userContentController), ), ) as _i5.WKUserContentController); + @override _i5.WKPreferences get preferences => (super.noSuchMethod( Invocation.getter(#preferences), - returnValue: _FakeWKPreferences_3( + returnValue: _FakeWKPreferences_4( this, Invocation.getter(#preferences), ), ) as _i5.WKPreferences); + @override _i5.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod( Invocation.getter(#websiteDataStore), - returnValue: _FakeWKWebsiteDataStore_6( + returnValue: _FakeWKWebsiteDataStore_7( this, Invocation.getter(#websiteDataStore), ), ) as _i5.WKWebsiteDataStore); + @override _i6.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( @@ -856,6 +1011,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( @@ -866,6 +1022,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future setMediaTypesRequiringUserActionForPlayback( Set<_i5.WKAudiovisualMediaType>? types) => @@ -877,13 +1034,14 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i5.WKWebViewConfiguration copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebViewConfiguration_7( + returnValue: _FakeWKWebViewConfiguration_8( this, Invocation.method( #copy, @@ -891,6 +1049,82 @@ class MockWKWebViewConfiguration extends _i1.Mock ), ), ) as _i5.WKWebViewConfiguration); + + @override + _i6.Future addObserver( + _i2.NSObject? observer, { + required String? keyPath, + required Set<_i2.NSKeyValueObservingOptions>? options, + }) => + (super.noSuchMethod( + Invocation.method( + #addObserver, + [observer], + { + #keyPath: keyPath, + #options: options, + }, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + + @override + _i6.Future removeObserver( + _i2.NSObject? observer, { + required String? keyPath, + }) => + (super.noSuchMethod( + Invocation.method( + #removeObserver, + [observer], + {#keyPath: keyPath}, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); +} + +/// A class which mocks [WKScriptMessageHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable +class MockWKScriptMessageHandler extends _i1.Mock + implements _i5.WKScriptMessageHandler { + MockWKScriptMessageHandler() { + _i1.throwOnMissingStub(this); + } + + @override + void Function( + _i5.WKUserContentController, + _i5.WKScriptMessage, + ) get didReceiveScriptMessage => (super.noSuchMethod( + Invocation.getter(#didReceiveScriptMessage), + returnValue: ( + _i5.WKUserContentController userContentController, + _i5.WKScriptMessage message, + ) {}, + ) as void Function( + _i5.WKUserContentController, + _i5.WKScriptMessage, + )); + + @override + _i5.WKScriptMessageHandler copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWKScriptMessageHandler_10( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i5.WKScriptMessageHandler); + @override _i6.Future addObserver( _i2.NSObject? observer, { @@ -909,6 +1143,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future removeObserver( _i2.NSObject? observer, { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart index 95818c3cefae6cbc5a1b9400016b512dd9626b48..bda15f7cec783f9e1a5ed09f838b3e2a552aed1d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -61,6 +63,7 @@ class MockWKWebsiteDataStore extends _i1.Mock Invocation.getter(#httpCookieStore), ), ) as _i2.WKHttpCookieStore); + @override _i3.Future removeDataOfTypes( Set<_i2.WKWebsiteDataType>? dataTypes, @@ -76,6 +79,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), returnValue: _i3.Future.value(false), ) as _i3.Future); + @override _i2.WKWebsiteDataStore copy() => (super.noSuchMethod( Invocation.method( @@ -90,6 +94,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ), ), ) as _i2.WKWebsiteDataStore); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -108,6 +113,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { @@ -142,6 +148,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i2.WKHttpCookieStore copy() => (super.noSuchMethod( Invocation.method( @@ -156,6 +163,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { ), ), ) as _i2.WKHttpCookieStore); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -174,6 +182,7 @@ class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart index f7bd373b35bbde2010bd63ea5db91b7f5f428924..ff7da8715218b1bd1017de72060caf81a692280f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart @@ -8,10 +8,12 @@ import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:webview_flutter_wkwebview/src/common/instance_manager.dart'; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart'; +import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart'; import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart'; import 'package:webview_flutter_wkwebview/src/webkit_proxy.dart'; import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; - +import 'webkit_webview_controller_test.mocks.dart' + show MockUIScrollViewDelegate; import 'webkit_webview_widget_test.mocks.dart'; @GenerateMocks([WKUIDelegate, WKWebViewConfiguration]) @@ -195,6 +197,9 @@ WebKitWebViewController createTestWebViewController( }, createUIDelegate: ({ dynamic onCreateWebView, dynamic requestMediaCapturePermission, + dynamic runJavaScriptAlertDialog, + dynamic runJavaScriptConfirmDialog, + dynamic runJavaScriptTextInputDialog, InstanceManager? instanceManager, }) { final MockWKUIDelegate mockWKUIDelegate = MockWKUIDelegate(); @@ -202,6 +207,16 @@ WebKitWebViewController createTestWebViewController( testInstanceManager.addDartCreatedInstance(mockWKUIDelegate); return mockWKUIDelegate; + }, createUIScrollViewDelegate: ({ + void Function(UIScrollView, double, double)? scrollViewDidScroll, + }) { + final MockUIScrollViewDelegate mockScrollViewDelegate = + MockUIScrollViewDelegate(); + when(mockScrollViewDelegate.copy()) + .thenReturn(MockUIScrollViewDelegate()); + + testInstanceManager.addDartCreatedInstance(mockScrollViewDelegate); + return mockScrollViewDelegate; }), ), ); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart index b171e28a3bfbd959311e5856ca3be6d02a13f028..2aff8e964b606ac8925a61eca5c4c08a86b22fd7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -97,6 +99,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { ), ), ) as _i2.WKUIDelegate); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -115,6 +118,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { @@ -149,6 +153,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#userContentController), ), ) as _i2.WKUserContentController); + @override _i2.WKPreferences get preferences => (super.noSuchMethod( Invocation.getter(#preferences), @@ -157,6 +162,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#preferences), ), ) as _i2.WKPreferences); + @override _i2.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod( Invocation.getter(#websiteDataStore), @@ -165,6 +171,7 @@ class MockWKWebViewConfiguration extends _i1.Mock Invocation.getter(#websiteDataStore), ), ) as _i2.WKWebsiteDataStore); + @override _i3.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( @@ -175,6 +182,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( @@ -185,6 +193,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future setMediaTypesRequiringUserActionForPlayback( Set<_i2.WKAudiovisualMediaType>? types) => @@ -196,6 +205,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i2.WKWebViewConfiguration copy() => (super.noSuchMethod( Invocation.method( @@ -210,6 +220,7 @@ class MockWKWebViewConfiguration extends _i1.Mock ), ), ) as _i2.WKWebViewConfiguration); + @override _i3.Future addObserver( _i4.NSObject? observer, { @@ -228,6 +239,7 @@ class MockWKWebViewConfiguration extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future removeObserver( _i4.NSObject? observer, { diff --git a/packages/webview_flutter_platform_interface-v2.10.0/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter_platform_interface-v2.10.0/webview_flutter_platform_interface/pubspec.yaml index f8f93d93d60cc27c0f8f16ede1ef4301884697ce..6c54f6a77ecb53879a8f3849077d29b12ae2f35a 100644 --- a/packages/webview_flutter_platform_interface-v2.10.0/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter_platform_interface-v2.10.0/webview_flutter_platform_interface/pubspec.yaml @@ -20,7 +20,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 2.10.0 environment: - sdk: ">=2.19.6 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.7.0" dependencies: