box-content-preview 3.123.0 → 3.125.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/index.js CHANGED
@@ -45,25 +45,26 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7__ from "react-do
45
45
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_179142b8__ from "react/jsx-runtime";
46
46
  import { default as __WEBPACK_EXTERNAL_MODULE_axios_default__ } from "axios";
47
47
  import { bdlBoxBlue as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__, bdlGray65 as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlGray65__, white as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_white__ } from "box-ui-elements/es/styles/variables";
48
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__ } from "@box/blueprint-web-assets/icons/Medium/VrGoggles";
48
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__ } from "@box/blueprint-web-assets/icons/Medium/XMark";
49
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__ } from "@box/blueprint-web-assets/icons/Medium/Comment";
50
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__ } from "@box/blueprint-web-assets/icons/Medium/PencilTip";
51
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__ } from "@box/blueprint-web-assets/icons/Medium/SquarePlus";
52
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__ } from "@box/blueprint-web-assets/icons/Medium/TCursorHighlight";
53
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__ } from "@box/blueprint-web-assets/icons/Medium/EllipsisVertical";
49
54
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize";
50
55
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize";
56
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__ } from "@box/blueprint-web-assets/icons/Medium/RotateLeft";
51
57
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__ } from "@box/blueprint-web-assets/icons/Medium/Minus";
52
58
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__ } from "@box/blueprint-web-assets/icons/Medium/Plus";
59
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronDown";
60
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronUp";
61
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__ } from "@box/blueprint-web-assets/icons/Medium/VrGoggles";
53
62
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_CheckmarkCircle_e8bd4624_default__ } from "@box/blueprint-web-assets/icons/Medium/CheckmarkCircle";
54
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__ } from "@box/blueprint-web-assets/icons/Medium/PencilTip";
55
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__ } from "@box/blueprint-web-assets/icons/Medium/SquarePlus";
56
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__ } from "@box/blueprint-web-assets/icons/Medium/TCursorHighlight";
57
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__ } from "@box/blueprint-web-assets/icons/Medium/Comment";
58
63
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_GridView_ac92b674_default__ } from "@box/blueprint-web-assets/icons/Medium/GridView";
59
64
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Nav_d41e959a_default__ } from "@box/blueprint-web-assets/icons/Medium/Nav";
60
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__ } from "@box/blueprint-web-assets/icons/Medium/RotateLeft";
61
65
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Search_ef3e4aba_default__ } from "@box/blueprint-web-assets/icons/Medium/Search";
62
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__ } from "@box/blueprint-web-assets/icons/Medium/XMark";
63
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__ } from "@box/blueprint-web-assets/icons/Medium/EllipsisVertical";
64
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronDown";
65
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronUp";
66
66
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Nav_ae6d790f_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Nav";
67
+ import { Search as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Fill_15c08185_Search__ } from "@box/blueprint-web-assets/icons/Fill";
67
68
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Pause_0cc1f701_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Pause";
68
69
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Play_ee47c078_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Play";
69
70
  import { PreviewLoading as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_PreviewLoading__, getIcon as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_getIcon__ } from "box-ui-elements/es/components/preview";
@@ -412,6 +413,118 @@ class PreviewError extends Error {
412
413
 
413
414
  /***/ },
414
415
 
416
+ /***/ 2459
417
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
418
+
419
+
420
+ // EXPORTS
421
+ __webpack_require__.d(__webpack_exports__, {
422
+ Ay: () => (/* binding */ TabularDigits),
423
+ k7: () => (/* binding */ renderTabularDigits)
424
+ });
425
+
426
+ // UNUSED EXPORTS: TABULAR_DIGITS_BOXES_CLASS, TABULAR_DIGITS_TEXT_CLASS, TABULAR_DIGIT_CLASS
427
+
428
+ // EXTERNAL MODULE: external "react"
429
+ var external_react_ = __webpack_require__(1649);
430
+ ;// ./src/lib/TabularDigits.scss
431
+ // extracted by mini-css-extract-plugin
432
+
433
+ ;// ./src/lib/TabularDigits.tsx
434
+
435
+
436
+
437
+ // The Inter subset served to the app has no tabular figures, so `font-variant-numeric: tabular-nums`
438
+ // has no effect. Wrapping each digit in a 1ch box keeps changing numbers, and whatever follows them,
439
+ // from shifting as they update.
440
+ const TABULAR_DIGIT_CLASS = 'bp-TabularDigit';
441
+ const TABULAR_DIGITS_BOXES_CLASS = 'bp-TabularDigits-boxes';
442
+ const TABULAR_DIGITS_TEXT_CLASS = 'bp-TabularDigits-text';
443
+ const isDigit = char => char >= '0' && char <= '9';
444
+ const isDigitNode = node => node.nodeType === Node.ELEMENT_NODE;
445
+
446
+ // Screen readers would read the boxed digits one by one, so the boxes are hidden from them and a visually
447
+ // hidden copy gives them the whole text
448
+ const getParts = el => {
449
+ const boxesEl = el.firstElementChild;
450
+ const textEl = el.lastElementChild;
451
+ if (el.childNodes.length === 2 && boxesEl?.classList.contains(TABULAR_DIGITS_BOXES_CLASS) && textEl?.classList.contains(TABULAR_DIGITS_TEXT_CLASS)) {
452
+ return {
453
+ boxesEl,
454
+ textEl
455
+ };
456
+ }
457
+ const newBoxesEl = document.createElement('span');
458
+ newBoxesEl.className = TABULAR_DIGITS_BOXES_CLASS;
459
+ newBoxesEl.setAttribute('aria-hidden', 'true');
460
+ const newTextEl = document.createElement('span');
461
+ newTextEl.className = TABULAR_DIGITS_TEXT_CLASS;
462
+ el.replaceChildren(newBoxesEl, newTextEl);
463
+ return {
464
+ boxesEl: newBoxesEl,
465
+ textEl: newTextEl
466
+ };
467
+ };
468
+
469
+ /**
470
+ * Writes `text` into `el` with each digit in a fixed-width box, plus a visually hidden copy of `text` for
471
+ * screen readers. For labels updated outside React, e.g. on animation frames. This replaces the children
472
+ * of `el`, so `el` must not hold other content. Unchanged characters are left in place, so a ticking clock
473
+ * only touches the digits that changed.
474
+ */
475
+ function renderTabularDigits(el, text) {
476
+ const {
477
+ boxesEl,
478
+ textEl
479
+ } = getParts(el);
480
+ if (textEl.textContent === text) {
481
+ return;
482
+ }
483
+ textEl.textContent = text;
484
+ const chars = Array.from(text);
485
+ const nodes = boxesEl.childNodes;
486
+ const canPatch = nodes.length === chars.length && chars.every((char, index) => isDigit(char) === isDigitNode(nodes[index]));
487
+ if (canPatch) {
488
+ chars.forEach((char, index) => {
489
+ if (nodes[index].textContent !== char) {
490
+ nodes[index].textContent = char;
491
+ }
492
+ });
493
+ return;
494
+ }
495
+ const fragment = document.createDocumentFragment();
496
+ chars.forEach(char => {
497
+ if (isDigit(char)) {
498
+ const digitEl = document.createElement('span');
499
+ digitEl.className = TABULAR_DIGIT_CLASS;
500
+ digitEl.textContent = char;
501
+ fragment.appendChild(digitEl);
502
+ } else {
503
+ fragment.appendChild(document.createTextNode(char));
504
+ }
505
+ });
506
+ boxesEl.replaceChildren(fragment);
507
+ }
508
+ /**
509
+ * Renders `children` with each digit in a fixed-width box. Place it inside the element that
510
+ * provides the typography, e.g. `<Text as="span"><TabularDigits>{label}</TabularDigits></Text>`.
511
+ */
512
+ function TabularDigits({
513
+ children
514
+ }) {
515
+ const elRef = external_react_["default"].useRef(null);
516
+ external_react_["default"].useLayoutEffect(() => {
517
+ if (elRef.current) {
518
+ renderTabularDigits(elRef.current, children);
519
+ }
520
+ }, [children]);
521
+ return /*#__PURE__*/external_react_["default"].createElement("span", {
522
+ ref: elRef
523
+ });
524
+ }
525
+
526
+ /***/ },
527
+
415
528
  /***/ 9130
416
529
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
417
530
 
@@ -1112,7 +1225,7 @@ const DEFAULT_LANGUAGE = 'en-US';
1112
1225
  const MESSAGE_KEY_PREFIX = 'bcp.';
1113
1226
 
1114
1227
  // Only the npm build defines __BCP_DEFAULT_MESSAGES__; the CDN build bakes strings in per locale.
1115
- const defaultStrings = (0,_isNpmBuild__WEBPACK_IMPORTED_MODULE_0__/* .isNpmBuild */ .w)() ? {"rotate_left":"Rotate left","zoom_current_scale":"Current zoom level","zoom_in":"Zoom in","zoom_out":"Zoom out","enter_fullscreen":"Enter fullscreen","exit_fullscreen":"Exit fullscreen","controls_more":"More options","controls_find":"Find","controls_rotate_document":"Rotate document","controls_zoom_scale":"Zoom: {1}","controls_view_as_grid":"View as grid","controls_show_thumbnails":"View thumbnails","controls_hide_thumbnails":"Hide thumbnails","controls_shortcut_ctrl":"Ctrl + {1}","drawing_comment":"Markup","region_comment":"Comment on Region","highlight_text":"Highlight and Comment","exit_annotations":"Exit Annotations","annotation_tools":"Comment and markup","drawing_color":"Drawing color","drawing_color_blue":"Blue","drawing_color_green":"Green","drawing_color_red":"Red","drawing_color_orange":"Orange","drawing_color_yellow":"Yellow","drawing_color_purple":"Purple","previous_page":"Previous page","enter_page_num":"Click to enter page number","next_page":"Next page","download":"Download","print":"Print","print_notification":"Please press the print button to get a printable version of this document.","print_loading":"Preparing to print...","print_ready":"Ready to print.","print_close":"Close print dialog","previous_file":"Previous file","logo":"Logo","next_file":"Next file","loading_preview":"Loading Preview...","download_file":"Download File","text_truncated":"This file has been truncated due to size limits. Please download to view the whole file.","toggle_findbar":"Toggle findbar","toggle_thumbnails":"Toggle thumbnails","gallery_view":"Gallery view","page_gallery":"Page gallery","page_gallery_tile":"Page {1}","has_x_refs":"This preview has references you cannot view. Open the file in its native application.","find_next":"Find next","find_previous":"Find previous","find_close":"Close","find_label":"Search input","thumbnail_label":"Page thumbnails","file_preview_label":"File preview","comparison_banner_current":"Current version","comparison_banner_previous":"Previous version","comparison_banner_version":"Version {1}","comparison_banner_actions":"More actions","comparison_banner_open_full_preview":"Open Full Preview","comparison_banner_close":"Close","comparison_banner_make_current":"Make Current","comparison_banner_delete":"Delete","error_generic":"This preview didn’t load. Please try to open or download the file to view.","error_unsupported":"This preview didn’t load because the file type is unsupported. Please try to open or download the file to view.","error_account":"This preview didn’t load because your account is unable to preview this file type. Please try to open or download the file to view.","error_permissions":"This preview didn’t load because you don’t have permission. Please ask the file owner to update permissions.","error_refresh":"This preview didn’t load. Please try to open or download the file to view.","error_rate_limit":"This preview didn’t load because your request was rate limited. Please try to open or download the file to view.","error_reupload":"This preview didn’t load. Please try to open or download the file to view.","error_browser_unsupported":"Your browser doesn’t support preview for {1}. Please try to open or download the file to view.","error_document":"This preview didn’t load because the document may be protected. Please try to open or download the file to view.","error_password_protected":"This preview didn’t load because the document is protected. Please try to open or download the file to view.","error_try_again_later":"This preview didn’t load. Please refresh the page or download file to view.","error_bad_file":"This preview didn’t load. Please try to open or download the file to view.","error_not_downloadable":"Something seems to be wrong with this file. Please refresh the page, and if the issue continues, try to upload a new version.","error_flash_not_enabled":"This preview didn’t load because Flash is not enabled on your browser. Please try to enable Flash or download the file to view.","error_internet_explorer_office_online":"This version of Internet Explorer is out of date and the experience may be degraded. Please try switching to a different browser for a better experience.","error_large_file":"File exceeds supported size for preview. Open or download the file to view.","error_too_many_operations":"The file is too complex to display in your browser. Please download it to view.","error_zero_byte_file":"Cannot preview 0 B file. Open or download the file to view.","filename":"Name","last_modified_date":"Modified","size":"Size","search":"Search","search_results":"Search Results","search_placeholder":"Search files and folders","search_clear":"Clear search","breadcrumb":"Breadcrumb","breadcrumb_truncated":"Show hidden folders","media_autoplay":"Autoplay","media_autoplay_disabled":"Disabled","media_autoplay_enabled":"Enabled","media_play_next":"Play next file","media_play_next_disabled":"Disabled","media_play_next_enabled":"Enabled","media_speed":"Speed","media_speed_normal":"Normal","media_quality":"Quality","media_quality_auto":"Auto","media_guides":"Guides","media_guides_off":"Off","media_guides_default":"Default","media_guides_widescreen_hd":"Widescreen HD","media_guides_vertical":"Vertical","media_guides_square":"Square","media_guides_social_portrait":"Social Portrait","media_guides_cinemascope":"Cinemascope","media_guides_univisium":"Univisium","media_guides_cinema_flat":"Cinema Flat","media_guides_scope":"Scope","media_guides_fullscreen":"Fullscreen","media_guides_ultrawide":"Ultrawide","media_volume_slider":"Volume Slider","media_generating_waveform":"Generating waveform","media_loading":"Loading","media_zoom":"Zoom","media_zoom_slider":"Zoom Slider","media_time_slider":"Media Slider","media_comment_marker":"Comment marker","media_range_comment":"Comment","media_range_clear":"Clear","media_shuttle_forward":"Scanning forward at {1}x","media_shuttle_reverse":"Scanning backward at {1}x","media_mute":"Mute","media_unmute":"Unmute","media_play":"Play","media_pause":"Pause","media_skip_forward":"Skip forward","media_skip_backward":"Skip backward","media_settings":"Settings","media_subtitles_cc":"Subtitles/Closed Captions","media_time_format":"Time format","media_time_format_standard":"Standard time","media_time_format_timecode":"Timecode","media_time_format_frames":"Frame numbers","volume":"Volume","of":"of","subtitles":"Subtitles","off":"Off","media_audio":"Audio","track":"Track","media_auto_generated_captions":"Auto-Generated Captions","auto_generated":"Auto-Generated","box3d_animation_clips":"Animation clips","box3d_camera_projection_perspective":"Perspective","box3d_camera_projection_orthographic":"Orthographic","box3d_reset":"Reset","box3d_toggle_animation":"Play/pause animation","box3d_toggle_vr":"Toggle VR display","box3d_render_mode_lit":"Lit","box3d_render_mode_unlit":"Unlit","box3d_render_mode_normals":"Normals","box3d_render_mode_shape":"Shape","box3d_render_mode_uv_overlay":"UV Overlay","box3d_settings":"Settings","box3d_settings_render_label":"Render mode","box3d_settings_grid_label":"Show grid","box3d_settings_wireframes_label":"Show wireframes","box3d_settings_skeletons_label":"Show skeletons","box3d_settings_projection_label":"Camera Projection","box3d_settings_rotate_label":"Rotate Model","box3d_settings_rotate_left":"Rotate left around {1} axis","box3d_settings_rotate_right":"Rotate right around {1} axis","document_label":"Document Viewer","annotation_add_comment_placeholder":"Add a comment here...","annotation_reply_placeholder":"Post a reply...","annotation_done":"Done","annotation_close":"Close","annotation_cancel":"Cancel","annotation_save":"Save","annotation_post":"Post","annotation_delete":"Delete","annotation_delete_confirmation_message":"Delete this annotation?","annotation_profile_alt":"Avatar","annotation_anonymous_user_name":"Some User","annotation_posting_message":"Posting...","annotation_point_toggle":"Point annotation mode","annotation_draw_toggle":"Drawing annotation mode","annotation_highlight_toggle":"Highlight text","annotation_highlight_comment":"Add comment to highlighted text","annotation_who_highlighted":"{1} highlighted","annotation_who_drew":"{1} drew","annotation_draw_save":"Save drawing","annotation_draw_delete":"Delete drawing","annotations_load_error":"Annotations could not be loaded for this file. Please refresh the page to try again.","annotations_create_error":"This annotation could not be created. Please try again.","annotations_delete_error":"This annotation could not be deleted. Please try again.","annotations_authorization_error":"Annotations could not be loaded for this file. You may not have permission to take this action.","notification_button_default_text":"Okay","notification_button_default_label":"Clear Notification","notification_annotation_point_mode":"Click anywhere to add a comment to the document","notification_annotation_draw_mode":"Press down and drag the pointer to draw on the document","notification_degraded_preview":"Your connection to {1} is being blocked. Please reach out to your network admin to adjust firewall settings.","notification_cannot_download":"This file could not be downloaded.","notification_cannot_download_due_to_policy":"The file could not be downloaded due to a security policy.","link_contact_us":"Contact Us","360_videos":"360-degree videos","360_images":"360-degree images","3d_models":"3D models","afrikaans":"Afrikaans","albanian":"Albanian","arabic":"Arabic","armenian":"Armenian","belarusian":"Belarusian","bengali":"Bengali","bosnian":"Bosnian","bulgarian":"Bulgarian","burmese":"Burmese","catalan":"Catalan","central_khmer":"Central Khmer","chinese":"Chinese","croatian":"Croatian","czech":"Czech","danish":"Danish","dutch":"Dutch","english":"English","estonian":"Estonian","filipino":"Filipino","finnish":"Finnish","french":"French","galician":"Galician","ganda":"Ganda","georgian":"Georgian","german":"German","haitian_creole":"Haitian Creole","hebrew":"Hebrew","hindi":"Hindi","hmong":"Hmong","hungarian":"Hungarian","icelandic":"Icelandic","indonesian":"Indonesian","irish":"Irish","italian":"Italian","japanese":"Japanese","kazakh":"Kazakh","korean":"Korean","kurdish":"Kurdish","lao":"Lao","latvian":"Latvian","lithuanian":"Lithuanian","luxembourgish":"Luxembourgish","malay_macrolanguage":"Malay","modern_greek_1453_":"Greek","mongolian":"Mongolian","norwegian":"Norwegian","persian":"Persian","polish":"Polish","portuguese":"Portuguese","romanian":"Romanian","russian":"Russian","serbian":"Serbian","sichuan_yi":"Sichuan Yi","sicilian":"Sicilian","slovak":"Slovak","slovenian":"Slovenian","somali":"Somali","spanish":"Spanish","swahili_macrolanguage":"Swahili","swedish":"Swedish","swiss_german":"Swiss German","tagalog":"Tagalog","telugu":"Telugu","thai":"Thai","tibetan":"Tibetan","turkish":"Turkish","ukrainian":"Ukrainian","uzbek":"Uzbek","vietnamese":"Vietnamese"} : {};
1228
+ const defaultStrings = (0,_isNpmBuild__WEBPACK_IMPORTED_MODULE_0__/* .isNpmBuild */ .w)() ? {"rotate_left":"Rotate left","zoom_current_scale":"Current zoom level","zoom_in":"Zoom in","zoom_out":"Zoom out","enter_fullscreen":"Enter fullscreen","exit_fullscreen":"Exit fullscreen","controls_more":"More options","controls_find":"Find","controls_rotate_document":"Rotate document","controls_rotate_image":"Rotate image","controls_zoom_scale":"Zoom: {1}","controls_view_as_grid":"View as grid","controls_show_thumbnails":"View thumbnails","controls_hide_thumbnails":"Hide thumbnails","controls_shortcut_ctrl":"Ctrl + {1}","drawing_comment":"Markup","region_comment":"Comment on Region","highlight_text":"Highlight and Comment","exit_annotations":"Exit Annotations","annotation_tools":"Comment and markup","drawing_color":"Drawing color","drawing_color_blue":"Blue","drawing_color_green":"Green","drawing_color_red":"Red","drawing_color_orange":"Orange","drawing_color_yellow":"Yellow","drawing_color_purple":"Purple","previous_page":"Previous page","enter_page_num":"Click to enter page number","next_page":"Next page","download":"Download","print":"Print","print_notification":"Please press the print button to get a printable version of this document.","print_loading":"Preparing to print...","print_ready":"Ready to print.","print_close":"Close print dialog","previous_file":"Previous file","logo":"Logo","next_file":"Next file","loading_preview":"Loading Preview...","download_file":"Download File","text_truncated":"This file has been truncated due to size limits. Please download to view the whole file.","toggle_findbar":"Toggle findbar","toggle_thumbnails":"Toggle thumbnails","gallery_view":"Gallery view","page_gallery":"Page gallery","page_gallery_tile":"Page {1}","has_x_refs":"This preview has references you cannot view. Open the file in its native application.","find_next":"Find next","find_previous":"Find previous","find_close":"Close","find_label":"Search input","find_placeholder":"Find in document","find_match_count":"{1} of {2}","thumbnail_label":"Page thumbnails","file_preview_label":"File preview","comparison_banner_current":"Current version","comparison_banner_previous":"Previous version","comparison_banner_version":"Version {1}","comparison_banner_actions":"More actions","comparison_banner_open_full_preview":"Open Full Preview","comparison_banner_close":"Close","comparison_banner_make_current":"Make Current","comparison_banner_delete":"Delete","error_generic":"This preview didn’t load. Please try to open or download the file to view.","error_unsupported":"This preview didn’t load because the file type is unsupported. Please try to open or download the file to view.","error_account":"This preview didn’t load because your account is unable to preview this file type. Please try to open or download the file to view.","error_permissions":"This preview didn’t load because you don’t have permission. Please ask the file owner to update permissions.","error_refresh":"This preview didn’t load. Please try to open or download the file to view.","error_rate_limit":"This preview didn’t load because your request was rate limited. Please try to open or download the file to view.","error_reupload":"This preview didn’t load. Please try to open or download the file to view.","error_browser_unsupported":"Your browser doesn’t support preview for {1}. Please try to open or download the file to view.","error_document":"This preview didn’t load because the document may be protected. Please try to open or download the file to view.","error_password_protected":"This preview didn’t load because the document is protected. Please try to open or download the file to view.","error_try_again_later":"This preview didn’t load. Please refresh the page or download file to view.","error_bad_file":"This preview didn’t load. Please try to open or download the file to view.","error_not_downloadable":"Something seems to be wrong with this file. Please refresh the page, and if the issue continues, try to upload a new version.","error_flash_not_enabled":"This preview didn’t load because Flash is not enabled on your browser. Please try to enable Flash or download the file to view.","error_internet_explorer_office_online":"This version of Internet Explorer is out of date and the experience may be degraded. Please try switching to a different browser for a better experience.","error_large_file":"File exceeds supported size for preview. Open or download the file to view.","error_too_many_operations":"The file is too complex to display in your browser. Please download it to view.","error_zero_byte_file":"Cannot preview 0 B file. Open or download the file to view.","filename":"Name","last_modified_date":"Modified","size":"Size","search":"Search","search_results":"Search Results","search_placeholder":"Search files and folders","search_clear":"Clear search","breadcrumb":"Breadcrumb","breadcrumb_truncated":"Show hidden folders","media_autoplay":"Autoplay","media_autoplay_disabled":"Disabled","media_autoplay_enabled":"Enabled","media_play_next":"Play next file","media_play_next_disabled":"Disabled","media_play_next_enabled":"Enabled","media_speed":"Speed","media_speed_normal":"Normal","media_quality":"Quality","media_quality_auto":"Auto","media_guides":"Guides","media_guides_off":"Off","media_guides_default":"Default","media_guides_widescreen_hd":"Widescreen HD","media_guides_vertical":"Vertical","media_guides_square":"Square","media_guides_social_portrait":"Social Portrait","media_guides_cinemascope":"Cinemascope","media_guides_univisium":"Univisium","media_guides_cinema_flat":"Cinema Flat","media_guides_scope":"Scope","media_guides_fullscreen":"Fullscreen","media_guides_ultrawide":"Ultrawide","media_volume_slider":"Volume Slider","media_generating_waveform":"Generating waveform","media_loading":"Loading","media_zoom":"Zoom","media_zoom_slider":"Zoom Slider","media_time_slider":"Media Slider","media_comment_marker":"Comment marker","media_range_comment":"Comment","media_range_clear":"Clear","media_shuttle_forward":"Scanning forward at {1}x","media_shuttle_reverse":"Scanning backward at {1}x","media_mute":"Mute","media_unmute":"Unmute","media_play":"Play","media_pause":"Pause","media_skip_forward":"Skip forward","media_skip_backward":"Skip backward","media_settings":"Settings","media_subtitles_cc":"Subtitles/Closed Captions","media_time_format":"Time format","media_time_format_standard":"Standard time","media_time_format_timecode":"Timecode","media_time_format_frames":"Frame numbers","volume":"Volume","of":"of","subtitles":"Subtitles","off":"Off","media_audio":"Audio","track":"Track","media_auto_generated_captions":"Auto-Generated Captions","auto_generated":"Auto-Generated","box3d_animation_clips":"Animation clips","box3d_camera_projection_perspective":"Perspective","box3d_camera_projection_orthographic":"Orthographic","box3d_reset":"Reset","box3d_toggle_animation":"Play/pause animation","box3d_toggle_vr":"Toggle VR display","box3d_render_mode_lit":"Lit","box3d_render_mode_unlit":"Unlit","box3d_render_mode_normals":"Normals","box3d_render_mode_shape":"Shape","box3d_render_mode_uv_overlay":"UV Overlay","box3d_settings":"Settings","box3d_settings_render_label":"Render mode","box3d_settings_grid_label":"Show grid","box3d_settings_wireframes_label":"Show wireframes","box3d_settings_skeletons_label":"Show skeletons","box3d_settings_projection_label":"Camera Projection","box3d_settings_rotate_label":"Rotate Model","box3d_settings_rotate_left":"Rotate left around {1} axis","box3d_settings_rotate_right":"Rotate right around {1} axis","document_label":"Document Viewer","annotation_add_comment_placeholder":"Add a comment here...","annotation_reply_placeholder":"Post a reply...","annotation_done":"Done","annotation_close":"Close","annotation_cancel":"Cancel","annotation_save":"Save","annotation_post":"Post","annotation_delete":"Delete","annotation_delete_confirmation_message":"Delete this annotation?","annotation_profile_alt":"Avatar","annotation_anonymous_user_name":"Some User","annotation_posting_message":"Posting...","annotation_point_toggle":"Point annotation mode","annotation_draw_toggle":"Drawing annotation mode","annotation_highlight_toggle":"Highlight text","annotation_highlight_comment":"Add comment to highlighted text","annotation_who_highlighted":"{1} highlighted","annotation_who_drew":"{1} drew","annotation_draw_save":"Save drawing","annotation_draw_delete":"Delete drawing","annotations_load_error":"Annotations could not be loaded for this file. Please refresh the page to try again.","annotations_create_error":"This annotation could not be created. Please try again.","annotations_delete_error":"This annotation could not be deleted. Please try again.","annotations_authorization_error":"Annotations could not be loaded for this file. You may not have permission to take this action.","notification_button_default_text":"Okay","notification_button_default_label":"Clear Notification","notification_annotation_point_mode":"Click anywhere to add a comment to the document","notification_annotation_draw_mode":"Press down and drag the pointer to draw on the document","notification_degraded_preview":"Your connection to {1} is being blocked. Please reach out to your network admin to adjust firewall settings.","notification_cannot_download":"This file could not be downloaded.","notification_cannot_download_due_to_policy":"The file could not be downloaded due to a security policy.","link_contact_us":"Contact Us","360_videos":"360-degree videos","360_images":"360-degree images","3d_models":"3D models","afrikaans":"Afrikaans","albanian":"Albanian","arabic":"Arabic","armenian":"Armenian","belarusian":"Belarusian","bengali":"Bengali","bosnian":"Bosnian","bulgarian":"Bulgarian","burmese":"Burmese","catalan":"Catalan","central_khmer":"Central Khmer","chinese":"Chinese","croatian":"Croatian","czech":"Czech","danish":"Danish","dutch":"Dutch","english":"English","estonian":"Estonian","filipino":"Filipino","finnish":"Finnish","french":"French","galician":"Galician","ganda":"Ganda","georgian":"Georgian","german":"German","haitian_creole":"Haitian Creole","hebrew":"Hebrew","hindi":"Hindi","hmong":"Hmong","hungarian":"Hungarian","icelandic":"Icelandic","indonesian":"Indonesian","irish":"Irish","italian":"Italian","japanese":"Japanese","kazakh":"Kazakh","korean":"Korean","kurdish":"Kurdish","lao":"Lao","latvian":"Latvian","lithuanian":"Lithuanian","luxembourgish":"Luxembourgish","malay_macrolanguage":"Malay","modern_greek_1453_":"Greek","mongolian":"Mongolian","norwegian":"Norwegian","persian":"Persian","polish":"Polish","portuguese":"Portuguese","romanian":"Romanian","russian":"Russian","serbian":"Serbian","sichuan_yi":"Sichuan Yi","sicilian":"Sicilian","slovak":"Slovak","slovenian":"Slovenian","somali":"Somali","spanish":"Spanish","swahili_macrolanguage":"Swahili","swedish":"Swedish","swiss_german":"Swiss German","tagalog":"Tagalog","telugu":"Telugu","thai":"Thai","tibetan":"Tibetan","turkish":"Turkish","ukrainian":"Ukrainian","uzbek":"Uzbek","vietnamese":"Vietnamese"} : {};
1116
1229
  let language = true ? "en-US" : 0;
1117
1230
  let strings = defaultStrings;
1118
1231
  function getLanguage() {
@@ -1215,7 +1328,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
1215
1328
  const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
1216
1329
  const CLIENT_NAME_KEY = 'box_client_name';
1217
1330
  const CLIENT_VERSION_KEY = 'box_client_version';
1218
- const CLIENT_VERSION = "3.123.0"; // eslint-disable-line no-undef
1331
+ const CLIENT_VERSION = "3.125.0"; // eslint-disable-line no-undef
1219
1332
  const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
1220
1333
  const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
1221
1334
  const PROMISE_MAP = {};
@@ -6996,7 +7109,7 @@ function SkipButton({
6996
7109
 
6997
7110
  /***/ },
6998
7111
 
6999
- /***/ 3308
7112
+ /***/ 3904
7000
7113
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7001
7114
 
7002
7115
 
@@ -7028,71 +7141,8 @@ var IconChevronDownMedium24 = __webpack_require__(8668);
7028
7141
  var IconChevronUpMedium24 = __webpack_require__(2155);
7029
7142
  // EXTERNAL MODULE: ./src/lib/viewers/controls/hooks/useClickOutside.ts
7030
7143
  var useClickOutside = __webpack_require__(2959);
7031
- ;// ./src/lib/TabularDigits.scss
7032
- // extracted by mini-css-extract-plugin
7033
-
7034
- ;// ./src/lib/TabularDigits.tsx
7035
- /* unused harmony import specifier */ var React;
7036
-
7037
-
7038
-
7039
- // The Inter subset served to the app has no tabular figures, so `font-variant-numeric: tabular-nums`
7040
- // has no effect. Wrapping each digit in a 1ch box keeps changing numbers, and whatever follows them,
7041
- // from shifting as they update.
7042
- const TABULAR_DIGIT_CLASS = 'bp-TabularDigit';
7043
- const isDigit = char => char >= '0' && char <= '9';
7044
- const isDigitNode = node => node.nodeType === Node.ELEMENT_NODE;
7045
-
7046
- /**
7047
- * Writes `text` into `el` with each digit in a fixed-width box. For labels updated outside React,
7048
- * e.g. on animation frames. Unchanged characters are left in place, so a ticking clock only touches
7049
- * the digits that changed.
7050
- */
7051
- function renderTabularDigits(el, text) {
7052
- if (el.textContent === text) {
7053
- return;
7054
- }
7055
- const chars = Array.from(text);
7056
- const nodes = el.childNodes;
7057
- const canPatch = nodes.length === chars.length && chars.every((char, index) => isDigit(char) === isDigitNode(nodes[index]));
7058
- if (canPatch) {
7059
- chars.forEach((char, index) => {
7060
- if (nodes[index].textContent !== char) {
7061
- nodes[index].textContent = char;
7062
- }
7063
- });
7064
- return;
7065
- }
7066
- const fragment = document.createDocumentFragment();
7067
- chars.forEach(char => {
7068
- if (isDigit(char)) {
7069
- const digitEl = document.createElement('span');
7070
- digitEl.className = TABULAR_DIGIT_CLASS;
7071
- digitEl.textContent = char;
7072
- fragment.appendChild(digitEl);
7073
- } else {
7074
- fragment.appendChild(document.createTextNode(char));
7075
- }
7076
- });
7077
- el.replaceChildren(fragment);
7078
- }
7079
- /**
7080
- * Renders `children` with each digit in a fixed-width box. Place it inside the element that
7081
- * provides the typography, e.g. `<Text as="span"><TabularDigits>{label}</TabularDigits></Text>`.
7082
- */
7083
- function TabularDigits({
7084
- children
7085
- }) {
7086
- const elRef = React.useRef(null);
7087
- React.useLayoutEffect(() => {
7088
- if (elRef.current) {
7089
- renderTabularDigits(elRef.current, children);
7090
- }
7091
- }, [children]);
7092
- return /*#__PURE__*/React.createElement("span", {
7093
- ref: elRef
7094
- });
7095
- }
7144
+ // EXTERNAL MODULE: ./src/lib/TabularDigits.tsx + 1 modules
7145
+ var TabularDigits = __webpack_require__(2459);
7096
7146
  // EXTERNAL MODULE: ./src/lib/viewers/media/videoFps.ts
7097
7147
  var videoFps = __webpack_require__(3234);
7098
7148
  // EXTERNAL MODULE: ./src/lib/BlueprintProviders.tsx
@@ -7197,7 +7247,7 @@ function TimestampControl({
7197
7247
  if (currentElRef.current && mediaEl) {
7198
7248
  const label = formatLabel(mediaEl.currentTime, format, fps);
7199
7249
  if (isBlueprintEnabled) {
7200
- renderTabularDigits(currentElRef.current, label);
7250
+ (0,TabularDigits/* renderTabularDigits */.k7)(currentElRef.current, label);
7201
7251
  } else {
7202
7252
  currentElRef.current.textContent = label;
7203
7253
  }
@@ -7227,13 +7277,13 @@ function TimestampControl({
7227
7277
  // The animation frame loop owns the label while a frame-accurate format is playing.
7228
7278
  const isFrameLoopRunning = format !== TimeFormat.STANDARD && mediaEl?.paused === false;
7229
7279
  if (isBlueprintEnabled && currentElRef.current && !isFrameLoopRunning) {
7230
- renderTabularDigits(currentElRef.current, currentLabel);
7280
+ (0,TabularDigits/* renderTabularDigits */.k7)(currentElRef.current, currentLabel);
7231
7281
  }
7232
7282
  }, [currentLabel, format, isBlueprintEnabled, mediaEl]);
7233
7283
  const durationLabel = formatLabel(durationTime, format, fps);
7234
7284
  external_react_["default"].useLayoutEffect(() => {
7235
7285
  if (isBlueprintEnabled && durationElRef.current) {
7236
- renderTabularDigits(durationElRef.current, durationLabel);
7286
+ (0,TabularDigits/* renderTabularDigits */.k7)(durationElRef.current, durationLabel);
7237
7287
  }
7238
7288
  }, [durationLabel, isBlueprintEnabled, isNarrowWidth]);
7239
7289
  const handleKeyDown = event => {
@@ -9365,8 +9415,8 @@ var MediaSettingsV2 = __webpack_require__(4027);
9365
9415
  var PlayOverlayIcon = __webpack_require__(2048);
9366
9416
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseToggle.tsx + 1 modules
9367
9417
  var PlayPauseToggle = __webpack_require__(6321);
9368
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
9369
- var TimestampControl = __webpack_require__(3308);
9418
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
9419
+ var TimestampControl = __webpack_require__(3904);
9370
9420
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
9371
9421
  var utils = __webpack_require__(5346);
9372
9422
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/VolumeControls.tsx + 8 modules
@@ -21633,7 +21683,7 @@ var x = (y) => {
21633
21683
  var x = {}; __webpack_require__.d(x, y); return x
21634
21684
  }
21635
21685
  var y = (x) => (() => (x))
21636
- module.exports = x({ ["Component"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.Component), ["createElement"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createElement), ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_react__["default"]), ["forwardRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.forwardRef), ["useCallback"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useCallback), ["useEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useEffect), ["useId"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useId), ["useImperativeHandle"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle), ["useLayoutEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect), ["useMemo"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useMemo), ["useReducer"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useReducer), ["useRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef), ["useState"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useState) });
21686
+ module.exports = x({ ["Component"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.Component), ["createElement"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createElement), ["createRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createRef), ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_react__["default"]), ["forwardRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.forwardRef), ["useCallback"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useCallback), ["useEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useEffect), ["useId"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useId), ["useImperativeHandle"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle), ["useLayoutEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect), ["useMemo"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useMemo), ["useReducer"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useReducer), ["useRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef), ["useState"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useState) });
21637
21687
 
21638
21688
  /***/ },
21639
21689
 
@@ -37254,7 +37304,7 @@ var isNpmBuild = __webpack_require__(8080);
37254
37304
  ;// ./src/lib/Logger.js
37255
37305
  /* eslint-disable no-undef */
37256
37306
  const CLIENT_NAME = "box-content-preview";
37257
- const CLIENT_VERSION = "3.123.0";
37307
+ const CLIENT_VERSION = "3.125.0";
37258
37308
  /* eslint-enable no-undef */
37259
37309
 
37260
37310
  class Logger {
@@ -39900,6 +39950,7 @@ var BlueprintProviders = __webpack_require__(2758);
39900
39950
 
39901
39951
 
39902
39952
  /* harmony default export */ const ControlsLayerContext = (/*#__PURE__*/external_react_["default"].createContext({
39953
+ setIsEditing: (noop_default()),
39903
39954
  setIsForced: (noop_default())
39904
39955
  }));
39905
39956
  ;// ./src/lib/viewers/controls/controls-layer/ControlsLayer.scss
@@ -39922,7 +39973,9 @@ function ControlsLayer({
39922
39973
  const [isShown, setIsShown] = external_react_["default"].useState(false);
39923
39974
  const hasFocusRef = external_react_["default"].useRef(false);
39924
39975
  const hasCursorRef = external_react_["default"].useRef(false);
39976
+ const isEditingRef = external_react_["default"].useRef(false);
39925
39977
  const hideTimeoutRef = external_react_["default"].useRef();
39978
+ const layerElRef = external_react_["default"].useRef(null);
39926
39979
 
39927
39980
  // Visibility helpers
39928
39981
  const helpersRef = external_react_["default"].useRef({
@@ -39966,7 +40019,7 @@ function ControlsLayer({
39966
40019
  const handleMouseLeave = event => {
39967
40020
  hasCursorRef.current = false;
39968
40021
  const layerEl = event.currentTarget;
39969
- if (document.activeElement && layerEl.contains(document.activeElement)) {
40022
+ if (!isEditingRef.current && document.activeElement && layerEl.contains(document.activeElement)) {
39970
40023
  document.activeElement.blur();
39971
40024
  }
39972
40025
  helpersRef.current.hide();
@@ -39988,12 +40041,26 @@ function ControlsLayer({
39988
40041
  helpersRef.current.reset();
39989
40042
  setIsForced(value);
39990
40043
  }, []);
40044
+ const setIsEditing = external_react_["default"].useCallback(value => {
40045
+ const wasEditing = isEditingRef.current;
40046
+ isEditingRef.current = value;
40047
+
40048
+ // Ending an edit can remove the focused field without a blur, so check where focus is now and hide
40049
+ // once neither focus nor the cursor is on the layer. The layer is already gone if the edit ended
40050
+ // because the controls unmounted.
40051
+ if (wasEditing && !value && layerElRef.current) {
40052
+ hasFocusRef.current = !!layerElRef.current?.contains(document.activeElement);
40053
+ helpersRef.current.hide();
40054
+ }
40055
+ }, []);
39991
40056
  const contextValue = external_react_["default"].useMemo(() => ({
40057
+ setIsEditing,
39992
40058
  setIsForced: setIsForcedWithReset
39993
- }), [setIsForcedWithReset]);
40059
+ }), [setIsEditing, setIsForcedWithReset]);
39994
40060
  return /*#__PURE__*/external_react_["default"].createElement(ControlsLayerContext.Provider, {
39995
40061
  value: contextValue
39996
40062
  }, /*#__PURE__*/external_react_["default"].createElement("div", {
40063
+ ref: layerElRef,
39997
40064
  className: `bp-ControlsLayer ${isShown || isForced ? SHOW_CLASSNAME : ''}`,
39998
40065
  "data-testid": "bp-ControlsLayer",
39999
40066
  onBlur: handleFocusOut,
@@ -40589,7 +40656,7 @@ class ImageBaseViewer extends viewers_BaseViewer {
40589
40656
  this.zoomOut();
40590
40657
  return true;
40591
40658
  }
40592
- return false;
40659
+ return this.handleFullscreenKey(key);
40593
40660
  }
40594
40661
 
40595
40662
  /**
@@ -41405,266 +41472,1364 @@ function ImageControls({
41405
41472
  onAnnotationColorChange: onAnnotationColorChange
41406
41473
  })));
41407
41474
  }
41408
- ;// ./src/lib/viewers/image/Image.scss
41475
+ // EXTERNAL MODULE: external "@box/blueprint-web"
41476
+ var blueprint_web_ = __webpack_require__(8912);
41477
+ ;// external "@box/blueprint-web-assets/icons/Medium/XMark"
41478
+
41479
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.scss
41409
41480
  // extracted by mini-css-extract-plugin
41410
41481
 
41411
- ;// ./src/lib/viewers/image/ImageViewer.js
41482
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.tsx
41483
+ /* provided dependency */ var AnnotationsExitButtonV2_ = __webpack_require__(441)["Tl"];
41412
41484
 
41413
41485
 
41414
41486
 
41415
41487
 
41488
+ function AnnotationsExitButtonV2({
41489
+ onClick
41490
+ }) {
41491
+ return /*#__PURE__*/external_react_["default"].createElement("span", {
41492
+ className: "bp-AnnotationsControls-exitBtn"
41493
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
41494
+ content: AnnotationsExitButtonV2_('exit_annotations')
41495
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
41496
+ "aria-label": AnnotationsExitButtonV2_('exit_annotations'),
41497
+ "data-resin-target": "exit",
41498
+ "data-testid": "bp-annotations-controls-exit-btn",
41499
+ onClick: onClick
41500
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
41501
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__
41502
+ }))));
41503
+ }
41504
+ ;// external "@box/blueprint-web-assets/icons/Medium/Comment"
41416
41505
 
41506
+ ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.scss
41507
+ // extracted by mini-css-extract-plugin
41417
41508
 
41509
+ ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.tsx
41418
41510
 
41419
41511
 
41420
41512
 
41421
- const CSS_CLASS_IMAGE = 'bp-image';
41422
- const IMAGE_PADDING = 15;
41423
- const IMAGE_ZOOM_SCALE = 1.2;
41424
- class ImageViewer extends image_ImageBaseViewer {
41425
- /** @inheritdoc */
41426
- constructor(options) {
41427
- super(options);
41428
- this.api = options.api;
41513
+ // Blueprint's Tooltip writes its own data-state onto the element it wraps, which overwrites the
41514
+ // data-state Toolbar.ToggleItem uses for its selected styling, so the tooltip gets its own element.
41515
+ function ToggleTooltipV2({
41516
+ children,
41517
+ content,
41518
+ side
41519
+ }) {
41520
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
41521
+ content: content,
41522
+ side: side
41523
+ }, /*#__PURE__*/external_react_["default"].createElement("span", {
41524
+ className: "bp-ToggleTooltipV2"
41525
+ }, children));
41526
+ }
41527
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsToggleV2.tsx
41528
+ /* provided dependency */ var AnnotationsToggleV2_ = __webpack_require__(441)["Tl"];
41529
+ function AnnotationsToggleV2_extends() { return AnnotationsToggleV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, AnnotationsToggleV2_extends.apply(null, arguments); }
41429
41530
 
41430
- // Bind context for callbacks
41431
- this.applyCursorFtux = this.applyCursorFtux.bind(this);
41432
- this.finishLoading = this.finishLoading.bind(this);
41433
- this.getViewportDimensions = this.getViewportDimensions.bind(this);
41434
- this.handleAnnotationColorChange = this.handleAnnotationColorChange.bind(this);
41435
- this.handleAnnotationControlsClick = this.handleAnnotationControlsClick.bind(this);
41436
- this.handleAnnotationCreateEvent = this.handleAnnotationCreateEvent.bind(this);
41437
- this.handleAssetAndRepLoad = this.handleAssetAndRepLoad.bind(this);
41438
- this.handleImageDownloadError = this.handleImageDownloadError.bind(this);
41439
- this.handleZoomEvent = this.handleZoomEvent.bind(this);
41440
- this.rotateLeft = this.rotateLeft.bind(this);
41441
- this.updateDiscoverabilityResinTag = this.updateDiscoverabilityResinTag.bind(this);
41442
- this.updateExperiences = this.updateExperiences.bind(this);
41443
- this.updatePannability = this.updatePannability.bind(this);
41444
- this.annotationControlsFSM = new AnnotationControlsFSM(this.isDiscoverabilityEnabled() ? AnnotationState.REGION_TEMP : AnnotationState.NONE);
41445
- this.annotationControlsFSM.subscribe(this.applyCursorFtux);
41446
- this.annotationControlsFSM.subscribe(this.updateDiscoverabilityResinTag);
41447
- if (this.isMobile) {
41448
- this.handleOrientationChange = this.handleOrientationChange.bind(this);
41449
- }
41450
- }
41451
41531
 
41452
- /**
41453
- * [destructor]
41454
- *
41455
- * @return {void}
41456
- */
41457
- destroy() {
41458
- if (this.isDiscoverabilityEnabled()) {
41459
- this.removeListener('zoom', this.handleZoomEvent);
41460
- }
41461
41532
 
41462
- // Blob URLs stay allocated until revoked.
41463
- if (this.imageEl && this.imageEl.src && this.imageEl.src.startsWith('blob:')) {
41464
- URL.revokeObjectURL(this.imageEl.src);
41465
- }
41466
- super.destroy();
41467
- }
41468
41533
 
41469
- /**
41470
- * @inheritdoc
41471
- */
41472
- setup() {
41473
- if (this.isSetup) {
41474
- return;
41475
- }
41476
41534
 
41477
- // Call super() to set up common layout
41478
- super.setup();
41479
- this.wrapperEl = this.createViewer(document.createElement('div'));
41480
- this.wrapperEl.classList.add(CSS_CLASS_IMAGE);
41481
- this.imageEl = this.wrapperEl.appendChild(document.createElement('img'));
41482
- this.imageEl.setAttribute('data-page-number', 1);
41483
41535
 
41484
- // hides image tag until content is loaded
41485
- this.imageEl.classList.add(constants/* CLASS_INVISIBLE */.Zb);
41486
- this.currentRotationAngle = 0;
41487
- const fileName = get_default()(this.options, 'file.name');
41488
- this.imageEl.setAttribute('alt', fileName);
41489
- if (this.isDiscoverabilityEnabled()) {
41490
- this.addListener('zoom', this.handleZoomEvent);
41536
+
41537
+ // The toolbar parts throw outside a Toolbar.Root, so surfaces without one (the media bar) use a standalone button.
41538
+
41539
+ const TOGGLE_VALUE = 'annotations';
41540
+ function AnnotationsToggleV2(props, ref) {
41541
+ const {
41542
+ annotationMode = AnnotationMode.NONE,
41543
+ isExpanded,
41544
+ modes,
41545
+ onAnnotationModeClick = (noop_default()),
41546
+ onAnnotationModeEscape = (noop_default()),
41547
+ tooltipSide
41548
+ } = props;
41549
+ const [lastMode, setLastMode] = external_react_["default"].useState(null);
41550
+ const isActive = annotationMode !== AnnotationMode.NONE;
41551
+ const resumeMode = lastMode && modes.includes(lastMode) ? lastMode : modes[0];
41552
+ external_react_["default"].useEffect(() => {
41553
+ if (annotationMode !== AnnotationMode.NONE) {
41554
+ setLastMode(annotationMode);
41491
41555
  }
41492
- this.updateDiscoverabilityResinTag();
41493
- }
41556
+ }, [annotationMode]);
41494
41557
 
41495
- /**
41496
- * Loads an Image.
41497
- *
41498
- * @return {Promise}
41499
- */
41500
- load() {
41501
- super.load();
41502
- const {
41503
- representation,
41504
- viewer
41505
- } = this.options;
41506
- const template = representation.content.url_template;
41507
- this.bindDOMListeners();
41508
- const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
41509
- return this.getRepStatus().getPromise().then(() => {
41510
- this.startLoadTimer();
41511
- return this.fetchContentAsBlobUrl(contentUrl);
41512
- }).then(blobUrl => {
41513
- if (this.isDestroyed()) {
41514
- URL.revokeObjectURL(blobUrl);
41558
+ // Global event handlers
41559
+ external_react_["default"].useEffect(() => {
41560
+ const handleKeyDown = event => {
41561
+ if (event.key !== 'Escape') {
41515
41562
  return;
41516
41563
  }
41517
- this.imageEl.src = blobUrl;
41518
- if (this.imageEl.complete) {
41519
- this.finishLoading();
41520
- }
41521
- super.handleAssetAndRepLoad();
41522
- }).catch(this.handleAssetError);
41523
- }
41524
-
41525
- /**
41526
- * Loads the image to be viewed
41527
- *
41528
- * @override
41529
- * @return {void}
41530
- */
41531
- handleAssetAndRepLoad(downloadUrl) {
41532
- this.startLoadTimer();
41533
- this.imageEl.src = downloadUrl;
41534
- if (this.imageEl.complete) {
41535
- this.finishLoading();
41564
+ event.preventDefault();
41565
+ event.stopPropagation();
41566
+ onAnnotationModeEscape();
41567
+ };
41568
+ if (annotationMode !== AnnotationMode.NONE) {
41569
+ document.addEventListener('keydown', handleKeyDown);
41536
41570
  }
41537
- super.handleAssetAndRepLoad();
41538
- }
41539
- finishLoading() {
41540
- this.hidePreviewMask();
41541
- this.emitFirstRenderMetric();
41542
- return super.finishLoading();
41571
+ return () => {
41572
+ document.removeEventListener('keydown', handleKeyDown);
41573
+ };
41574
+ }, [annotationMode, onAnnotationModeEscape]);
41575
+ if (!resumeMode) {
41576
+ return null;
41543
41577
  }
41544
-
41545
- /**
41546
- * Emits first render time metric.
41547
- * Overrides base implementation to use BaseViewer's emitMetric(event, data) format.
41548
- *
41549
- * @protected
41550
- * @return {void}
41551
- */
41552
- emitFirstRenderMetric() {
41553
- if (this.isDestroyed() || this.firstRenderEmitted) {
41554
- return;
41555
- }
41578
+ const handleToggle = isPressed => {
41579
+ onAnnotationModeClick({
41580
+ mode: isPressed ? resumeMode : AnnotationMode.NONE
41581
+ });
41582
+ };
41583
+ const toggleProps = {
41584
+ ref,
41585
+ 'aria-expanded': isExpanded ?? isActive,
41586
+ 'aria-label': AnnotationsToggleV2_('annotation_tools'),
41587
+ 'data-resin-target': 'annotations',
41588
+ 'data-testid': 'bp-AnnotationsControls-toggleBtn',
41589
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__
41590
+ };
41591
+ const renderToggle = toggle => /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
41592
+ content: AnnotationsToggleV2_('annotation_tools'),
41593
+ side: tooltipSide
41594
+ }, toggle);
41595
+ if (props.buttonType === 'icon') {
41556
41596
  const {
41557
- file
41558
- } = this.options;
41559
- const tag = lib_Timer.createTag(file.id, lib_events/* FIRST_RENDER_METRIC */.VT);
41560
- const time = lib_Timer.stop(tag);
41561
- if (time && time.elapsed) {
41562
- this.emitMetric(lib_events/* LOAD_METRIC */.Yy.firstRenderTime, time.elapsed);
41563
- this.firstRenderEmitted = true;
41564
- }
41597
+ className,
41598
+ size,
41599
+ variant
41600
+ } = props;
41601
+ return renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconToggleButton, AnnotationsToggleV2_extends({}, toggleProps, {
41602
+ className: className,
41603
+ onPressedChange: handleToggle,
41604
+ pressed: isActive,
41605
+ size: size,
41606
+ variant: variant
41607
+ })));
41565
41608
  }
41609
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
41610
+ onValueChange: value => handleToggle(value.includes(TOGGLE_VALUE)),
41611
+ type: "multiple",
41612
+ value: isActive ? [TOGGLE_VALUE] : []
41613
+ }, renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, AnnotationsToggleV2_extends({}, toggleProps, {
41614
+ value: TOGGLE_VALUE
41615
+ }))));
41616
+ }
41617
+ /* harmony default export */ const annotations_AnnotationsToggleV2 = (/*#__PURE__*/external_react_["default"].forwardRef(AnnotationsToggleV2));
41618
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsControlsV2.tsx
41619
+ const AnnotationsControlsV2_excluded = ["onAnnotationModeClick"];
41620
+ function AnnotationsControlsV2_extends() { return AnnotationsControlsV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, AnnotationsControlsV2_extends.apply(null, arguments); }
41621
+ function AnnotationsControlsV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = AnnotationsControlsV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
41622
+ function AnnotationsControlsV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
41566
41623
 
41567
- /**
41568
- * Prefetches assets for an image.
41569
- *
41570
- * @param {boolean} [options.content] - Whether or not to prefetch rep content
41571
- * @return {void}
41572
- */
41573
- prefetch({
41574
- content = true,
41575
- preload = false
41576
- } = {}) {
41577
- const {
41578
- file,
41579
- representation,
41580
- viewer
41581
- } = this.options;
41582
- const isWatermarked = file && file.watermark_info && file.watermark_info.is_watermarked;
41583
- if ((content || preload) && !isWatermarked && this.isRepresentationReady(representation)) {
41584
- const template = representation.content.url_template;
41585
- const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
41586
- this.api.get(contentUrl, {
41587
- type: 'blob',
41588
- headers: this.appendAuthHeader()
41589
- }).catch(err => {
41590
- console.warn('Image prefetch failed', err); // eslint-disable-line no-console
41591
- });
41592
- }
41593
- }
41594
41624
 
41595
- /**
41596
- * Can the viewer currently be panned
41597
- *
41598
- * @private
41599
- * @return {void}
41600
- */
41601
- updatePannability() {
41602
- if (!this.imageEl) {
41603
- return;
41604
- }
41605
- if (this.isRotated()) {
41606
- this.isPannable = this.imageEl.height > this.wrapperEl.clientWidth || this.imageEl.width > this.wrapperEl.clientHeight;
41607
- } else {
41608
- this.isPannable = this.imageEl.width > this.wrapperEl.clientWidth || this.imageEl.height > this.wrapperEl.clientHeight;
41609
- }
41610
- this.didPan = false;
41611
- this.updateCursor();
41612
- }
41613
41625
 
41614
- /**
41615
- * Rotate image anti-clockwise by 90 degrees
41616
- *
41617
- * @return {void}
41618
- */
41619
- rotateLeft() {
41620
- this.currentRotationAngle = (this.currentRotationAngle - 90) % 3600 % 360;
41621
- this.imageEl.setAttribute('data-rotation-angle', this.currentRotationAngle);
41622
- this.imageEl.style.transform = `rotate(${this.currentRotationAngle}deg)`;
41623
- this.emit('rotate');
41624
41626
 
41625
- // Re-adjust image position after rotation
41626
- this.handleOrientationChange();
41627
- this.setScale(this.imageEl.offsetwidth, this.imageEl.offsetHeight);
41628
- }
41629
41627
 
41630
- // Annotation overrides
41631
- getInitialAnnotationMode() {
41632
- return this.isDiscoverabilityEnabled() ? AnnotationMode.REGION : AnnotationMode.NONE;
41633
- }
41628
+ // The markup controls at the end of a Blueprint controls bar
41629
+ function AnnotationsControlsV2(_ref) {
41630
+ let {
41631
+ onAnnotationModeClick
41632
+ } = _ref,
41633
+ rest = AnnotationsControlsV2_objectWithoutProperties(_ref, AnnotationsControlsV2_excluded);
41634
+ const toggleRef = external_react_["default"].useRef(null);
41635
+ const handleExit = () => {
41636
+ toggleRef.current?.focus();
41637
+ onAnnotationModeClick?.({
41638
+ mode: AnnotationMode.NONE
41639
+ });
41640
+ };
41641
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), /*#__PURE__*/external_react_["default"].createElement(AnnotationsExitButtonV2, {
41642
+ onClick: handleExit
41643
+ }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, AnnotationsControlsV2_extends({
41644
+ ref: toggleRef,
41645
+ onAnnotationModeClick: onAnnotationModeClick
41646
+ }, rest)));
41647
+ }
41648
+ ;// external "@box/blueprint-web-assets/icons/Medium/PencilTip"
41634
41649
 
41635
- /**
41636
- * Gets the width & height after the transforms are applied.
41637
- * When an image is rotated, the width & height of an image, e.g. offsetWidth & offsetHeight,
41638
- * are the values before transforms are applied, so if the image is rotated we need to swap the
41639
- * width & height
41640
- *
41641
- * @private
41642
- * @param {number} [width] - The width in px
41643
- * @param {number} [height] - The height in px
41644
- * @param {boolean} [isRotated] - if the image has a transform rotate applied to it
41645
- * @return {Object} the width & height of the image after tranformations
41646
- */
41647
- getTransformWidthAndHeight(width, height, isRotated) {
41648
- if (isRotated) {
41649
- return {
41650
- width: height,
41651
- height: width
41652
- };
41653
- }
41654
- return {
41655
- width,
41656
- height
41657
- };
41658
- }
41650
+ ;// external "@box/blueprint-web-assets/icons/Medium/SquarePlus"
41659
41651
 
41660
- /**
41661
- * Gets the viewport dimensions.
41662
- *
41663
- * @return {Object} the width & height of the viewport
41664
- */
41665
- getViewportDimensions() {
41666
- return {
41667
- width: this.wrapperEl.clientWidth - 2 * IMAGE_PADDING,
41652
+ ;// external "@box/blueprint-web-assets/icons/Medium/TCursorHighlight"
41653
+
41654
+ ;// ./src/lib/viewers/controls/annotations/annotationModeIcons.ts
41655
+
41656
+
41657
+
41658
+
41659
+ const ANNOTATION_MODE_ICONS = {
41660
+ [AnnotationMode.DRAWING]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__,
41661
+ [AnnotationMode.HIGHLIGHT]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__,
41662
+ [AnnotationMode.REGION]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__
41663
+ };
41664
+ /* harmony default export */ const annotationModeIcons = (ANNOTATION_MODE_ICONS);
41665
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.scss
41666
+ // extracted by mini-css-extract-plugin
41667
+
41668
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.tsx
41669
+ const ControlsBarV2_excluded = ["children", "size"];
41670
+ function ControlsBarV2_extends() { return ControlsBarV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsBarV2_extends.apply(null, arguments); }
41671
+ function ControlsBarV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsBarV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
41672
+ function ControlsBarV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
41673
+
41674
+
41675
+
41676
+ function ControlsBarV2(_ref, ref) {
41677
+ let {
41678
+ children,
41679
+ size = 'large'
41680
+ } = _ref,
41681
+ rest = ControlsBarV2_objectWithoutProperties(_ref, ControlsBarV2_excluded);
41682
+ if (!children) {
41683
+ return null;
41684
+ }
41685
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, ControlsBarV2_extends({
41686
+ ref: ref,
41687
+ className: `bp-ControlsBarV2 bp-ControlsBarV2--${size}`,
41688
+ colorScheme: "dark",
41689
+ "data-testid": "bp-ControlsBar"
41690
+ }, rest), children);
41691
+ }
41692
+ /* harmony default export */ const controls_bar_ControlsBarV2 = (/*#__PURE__*/external_react_["default"].forwardRef(ControlsBarV2));
41693
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.scss
41694
+ // extracted by mini-css-extract-plugin
41695
+
41696
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.tsx
41697
+ /* provided dependency */ var AnnotationsPaletteV2_ = __webpack_require__(441)["Tl"];
41698
+ function AnnotationsPaletteV2_extends() { return AnnotationsPaletteV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, AnnotationsPaletteV2_extends.apply(null, arguments); }
41699
+
41700
+
41701
+
41702
+
41703
+
41704
+
41705
+
41706
+
41707
+ function AnnotationsPaletteV2({
41708
+ children
41709
+ }) {
41710
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
41711
+ className: "bp-AnnotationsPaletteV2",
41712
+ "data-testid": "bp-AnnotationsPaletteV2"
41713
+ }, /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, {
41714
+ size: "small"
41715
+ }, children));
41716
+ }
41717
+ function Modes({
41718
+ annotationMode,
41719
+ children,
41720
+ onAnnotationModeClick = (noop_default())
41721
+ }) {
41722
+ // The single-select group reports an empty value when the active mode is clicked again. Exiting
41723
+ // is left to the trigger on the main bar, so the palette never closes under the cursor.
41724
+ const handleModeChange = mode => {
41725
+ if (!mode || mode === annotationMode) {
41726
+ return;
41727
+ }
41728
+ onAnnotationModeClick({
41729
+ mode: mode
41730
+ });
41731
+ };
41732
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
41733
+ "data-testid": "bp-annotations-controls",
41734
+ onValueChange: handleModeChange,
41735
+ type: "single",
41736
+ value: annotationMode
41737
+ }, children);
41738
+ }
41739
+ function Mode({
41740
+ value
41741
+ }) {
41742
+ const {
41743
+ label,
41744
+ resinTarget,
41745
+ testId
41746
+ } = {
41747
+ [AnnotationMode.DRAWING]: {
41748
+ label: AnnotationsPaletteV2_('drawing_comment'),
41749
+ resinTarget: 'draw',
41750
+ testId: 'bp-AnnotationsControls-drawBtn'
41751
+ },
41752
+ [AnnotationMode.HIGHLIGHT]: {
41753
+ label: AnnotationsPaletteV2_('highlight_text'),
41754
+ resinTarget: 'highlightText',
41755
+ testId: 'bp-AnnotationsControls-highlightBtn'
41756
+ },
41757
+ [AnnotationMode.REGION]: {
41758
+ label: AnnotationsPaletteV2_('region_comment'),
41759
+ resinTarget: 'highlightRegion',
41760
+ testId: 'bp-AnnotationsControls-regionBtn'
41761
+ }
41762
+ }[value];
41763
+ return /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
41764
+ content: label
41765
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
41766
+ "aria-label": label,
41767
+ "data-resin-target": resinTarget,
41768
+ "data-testid": testId,
41769
+ icon: annotationModeIcons[value],
41770
+ value: value
41771
+ }));
41772
+ }
41773
+ /* harmony default export */ const annotations_AnnotationsPaletteV2 = (AnnotationsPaletteV2_extends(AnnotationsPaletteV2, {
41774
+ Mode,
41775
+ Modes
41776
+ }));
41777
+ ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.scss
41778
+ // extracted by mini-css-extract-plugin
41779
+
41780
+ ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.tsx
41781
+ /* provided dependency */ var ColorPickerControlV2_ = __webpack_require__(441)["Tl"];
41782
+
41783
+
41784
+
41785
+
41786
+
41787
+ const getColorLabels = () => ({
41788
+ [AnnotationColor.BOX_BLUE]: ColorPickerControlV2_('drawing_color_blue'),
41789
+ [AnnotationColor.GREEN_LIGHT]: ColorPickerControlV2_('drawing_color_green'),
41790
+ [AnnotationColor.WATERMELON_RED]: ColorPickerControlV2_('drawing_color_red'),
41791
+ [AnnotationColor.YELLORANGE]: ColorPickerControlV2_('drawing_color_orange'),
41792
+ [AnnotationColor.YELLOW]: ColorPickerControlV2_('drawing_color_yellow'),
41793
+ [AnnotationColor.GRIMACE]: ColorPickerControlV2_('drawing_color_purple')
41794
+ });
41795
+ function ColorPickerControlV2({
41796
+ activeColor = __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__,
41797
+ colors,
41798
+ onColorSelect
41799
+ }) {
41800
+ const colorLabels = getColorLabels();
41801
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
41802
+ className: "bp-ColorPickerControlV2",
41803
+ "data-testid": "bp-color-picker-control"
41804
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Grid, {
41805
+ "aria-label": ColorPickerControlV2_('drawing_color'),
41806
+ columns: colors.length
41807
+ }, colors.map(color => /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Option.ColorCircle, {
41808
+ key: color,
41809
+ active: color === activeColor,
41810
+ "aria-label": colorLabels[color] || color,
41811
+ className: "bp-ColorPickerControlV2-swatch",
41812
+ color: color,
41813
+ "data-resin-target": "colorSelect",
41814
+ onClick: () => onColorSelect(color)
41815
+ }))));
41816
+ }
41817
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteControlsV2.tsx
41818
+
41819
+
41820
+
41821
+
41822
+
41823
+
41824
+ // The palette opened by the markup toggle, with the drawing colors while drawing
41825
+ function AnnotationsPaletteControlsV2({
41826
+ annotationColor,
41827
+ annotationMode,
41828
+ modes,
41829
+ onAnnotationColorChange,
41830
+ onAnnotationModeClick
41831
+ }) {
41832
+ if (annotationMode === AnnotationMode.NONE || !modes.length) {
41833
+ return null;
41834
+ }
41835
+ return /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2, null, /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Modes, {
41836
+ annotationMode: annotationMode,
41837
+ onAnnotationModeClick: onAnnotationModeClick
41838
+ }, modes.map(mode => /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Mode, {
41839
+ key: mode,
41840
+ value: mode
41841
+ }))), annotationMode === AnnotationMode.DRAWING && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), /*#__PURE__*/external_react_["default"].createElement(ColorPickerControlV2, {
41842
+ activeColor: annotationColor,
41843
+ colors: ANNOTATION_COLORS,
41844
+ onColorSelect: onAnnotationColorChange
41845
+ })));
41846
+ }
41847
+ ;// ./src/lib/viewers/controls/annotations/useAnnotationModes.ts
41848
+
41849
+
41850
+ // Listed in the palette's button order, which is also the order the toggle falls back to. Annotating is
41851
+ // unavailable in fullscreen, so no modes are offered there.
41852
+ function useAnnotationModes({
41853
+ hasDrawing,
41854
+ hasHighlight,
41855
+ hasRegion
41856
+ }) {
41857
+ const isFullscreen = useFullscreen();
41858
+ const modes = [];
41859
+ if (isFullscreen) {
41860
+ return modes;
41861
+ }
41862
+ if (hasRegion) {
41863
+ modes.push(AnnotationMode.REGION);
41864
+ }
41865
+ if (hasHighlight) {
41866
+ modes.push(AnnotationMode.HIGHLIGHT);
41867
+ }
41868
+ if (hasDrawing) {
41869
+ modes.push(AnnotationMode.DRAWING);
41870
+ }
41871
+ return modes;
41872
+ }
41873
+ ;// external "@box/blueprint-web-assets/icons/Medium/EllipsisVertical"
41874
+
41875
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/tooltip/MenuTriggerTooltipV2.tsx
41876
+ var MenuTriggerTooltipV2 = __webpack_require__(6014);
41877
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/settings/stopMenuKeyPropagation.ts
41878
+ var stopMenuKeyPropagation = __webpack_require__(9646);
41879
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.scss
41880
+ // extracted by mini-css-extract-plugin
41881
+
41882
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.tsx
41883
+ /* provided dependency */ var ControlsOverflowMenuV2_ = __webpack_require__(441)["Tl"];
41884
+ function ControlsOverflowMenuV2_extends() { return ControlsOverflowMenuV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsOverflowMenuV2_extends.apply(null, arguments); }
41885
+
41886
+
41887
+
41888
+
41889
+
41890
+
41891
+
41892
+
41893
+ // Handlers that return focus to the control that invoked them get the trigger, since the row unmounts with the menu
41894
+ const ControlsOverflowTriggerContext = /*#__PURE__*/external_react_["default"].createContext({
41895
+ current: null
41896
+ });
41897
+
41898
+ // The menu portals out of the controls root, so it carries the root's Resin attributes itself
41899
+ const getResinAttributes = element => {
41900
+ const resinComponent = element?.closest('[data-resin-component]');
41901
+ return resinComponent ? Object.fromEntries(Array.from(resinComponent.attributes).filter(({
41902
+ name
41903
+ }) => name.startsWith('data-resin-')).map(({
41904
+ name,
41905
+ value
41906
+ }) => [name, value])) : {};
41907
+ };
41908
+ function ControlsOverflowToggle(props, ref) {
41909
+ const isMenuOpen = props['aria-expanded'] === true || props['aria-expanded'] === 'true';
41910
+ return /*#__PURE__*/external_react_["default"].createElement(MenuTriggerTooltipV2/* default */.A, {
41911
+ content: ControlsOverflowMenuV2_('controls_more'),
41912
+ isMenuOpen: isMenuOpen
41913
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, ControlsOverflowMenuV2_extends({
41914
+ ref: ref,
41915
+ "aria-label": ControlsOverflowMenuV2_('controls_more'),
41916
+ "data-resin-target": "moreOptions",
41917
+ "data-testid": "bp-ControlsBar-overflowBtn"
41918
+ }, props), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
41919
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__
41920
+ })));
41921
+ }
41922
+ const ControlsOverflowToggleV2 = /*#__PURE__*/external_react_["default"].forwardRef(ControlsOverflowToggle);
41923
+ function ControlsOverflowMenuV2({
41924
+ items
41925
+ }) {
41926
+ const container = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n) ?? undefined;
41927
+ const {
41928
+ setIsForced
41929
+ } = external_react_["default"].useContext(ControlsLayerContext);
41930
+ const triggerRef = external_react_["default"].useRef(null);
41931
+ const [isOpen, setIsOpen] = external_react_["default"].useState(false);
41932
+ const [resinAttributes, setResinAttributes] = external_react_["default"].useState({});
41933
+ const handleOpenChange = open => {
41934
+ if (open) {
41935
+ setResinAttributes(getResinAttributes(triggerRef.current));
41936
+ }
41937
+ setIsOpen(open);
41938
+ };
41939
+
41940
+ // The menu sits outside the controls layer, which would otherwise hide the bar under the open menu
41941
+ external_react_["default"].useEffect(() => {
41942
+ if (!isOpen) {
41943
+ return undefined;
41944
+ }
41945
+ setIsForced(true);
41946
+ return () => setIsForced(false);
41947
+ }, [isOpen, setIsForced]);
41948
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, {
41949
+ modal: false,
41950
+ onOpenChange: handleOpenChange,
41951
+ open: isOpen
41952
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
41953
+ ref: triggerRef,
41954
+ asChild: true,
41955
+ "data-overflow-ids": items.map(({
41956
+ id
41957
+ }) => id).join(' '),
41958
+ "data-overflow-trigger": ""
41959
+ }, /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowToggleV2, null)), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, ControlsOverflowMenuV2_extends({
41960
+ align: "end",
41961
+ className: "bp-ControlsOverflowMenuV2",
41962
+ container: container,
41963
+ "data-testid": "bp-ControlsBar-overflowMenu",
41964
+ onEscapeKeyDown: stopMenuKeyPropagation/* stopEscapePropagation */.s,
41965
+ onKeyDown: stopMenuKeyPropagation/* stopKeyPropagation */.a,
41966
+ side: "top"
41967
+ }, resinAttributes), /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowTriggerContext.Provider, {
41968
+ value: triggerRef
41969
+ }, items.map(({
41970
+ id,
41971
+ menu
41972
+ }) => /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, {
41973
+ key: id
41974
+ }, menu)))));
41975
+ }
41976
+ ;// ./src/lib/viewers/controls/controls-bar/useControlsOverflow.ts
41977
+
41978
+
41979
+
41980
+ const ALWAYS_OVERFLOW = 0;
41981
+ // The space the mocks leave between the bar and the edges of the viewer
41982
+ const EDGE_MARGIN = 40;
41983
+ // One toolbar button, the estimate for a control or the overflow trigger before it has been measured
41984
+ const DEFAULT_WIDTH = 32;
41985
+ const isCollapsible = ({
41986
+ menu,
41987
+ priority
41988
+ }) => !!menu && priority !== undefined;
41989
+ function getOverflowIds(items, availableWidth, metrics) {
41990
+ const {
41991
+ chrome,
41992
+ gap,
41993
+ triggerWidth = DEFAULT_WIDTH,
41994
+ widths
41995
+ } = metrics;
41996
+ const overflowIds = new Set(items.filter(item => isCollapsible(item) && item.priority === ALWAYS_OVERFLOW).map(({
41997
+ id
41998
+ }) => id));
41999
+ const getBarWidth = () => {
42000
+ const slots = items.filter(({
42001
+ id
42002
+ }) => !overflowIds.has(id)).map(({
42003
+ id
42004
+ }) => widths.get(id) ?? DEFAULT_WIDTH);
42005
+ if (overflowIds.size) {
42006
+ slots.push(triggerWidth);
42007
+ }
42008
+ return chrome + slots.reduce((total, width) => total + width, 0) + gap * Math.max(slots.length - 1, 0);
42009
+ };
42010
+ const priorities = items.filter(item => isCollapsible(item) && item.priority !== ALWAYS_OVERFLOW).map(({
42011
+ priority
42012
+ }) => priority).sort((a, b) => a - b);
42013
+ Array.from(new Set(priorities)).every(priority => {
42014
+ if (getBarWidth() <= availableWidth) {
42015
+ return false;
42016
+ }
42017
+ items.filter(item => isCollapsible(item) && item.priority === priority).forEach(({
42018
+ id
42019
+ }) => overflowIds.add(id));
42020
+ return true;
42021
+ });
42022
+ return overflowIds;
42023
+ }
42024
+ const getStyleWidth = (style, properties) => properties.reduce((total, property) => total + (parseFloat(style.getPropertyValue(property)) || 0), 0);
42025
+ function useControlsOverflow(items) {
42026
+ const barRef = external_react_["default"].useRef(null);
42027
+ const metricsRef = external_react_["default"].useRef({
42028
+ chrome: 0,
42029
+ gap: 0,
42030
+ widths: new Map()
42031
+ });
42032
+ const portalContainer = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n);
42033
+ const [availableWidth, setAvailableWidth] = external_react_["default"].useState(Number.POSITIVE_INFINITY);
42034
+ const [, forceUpdate] = external_react_["default"].useReducer(count => count + 1, 0);
42035
+
42036
+ // A control can only be measured while it is on the bar, so each width is cached as it renders and
42037
+ // reused to decide whether that control would fit again
42038
+ external_react_["default"].useLayoutEffect(() => {
42039
+ const bar = barRef.current;
42040
+ if (!bar) {
42041
+ return;
42042
+ }
42043
+ const metrics = metricsRef.current;
42044
+ const style = window.getComputedStyle(bar);
42045
+ const chrome = getStyleWidth(style, ['padding-left', 'padding-right', 'border-left-width', 'border-right-width']);
42046
+ const gap = getStyleWidth(style, ['column-gap']);
42047
+ let hasChanged = chrome !== metrics.chrome || gap !== metrics.gap;
42048
+ metrics.chrome = chrome;
42049
+ metrics.gap = gap;
42050
+ Array.from(bar.children).forEach(child => {
42051
+ const {
42052
+ offsetWidth
42053
+ } = child;
42054
+ const {
42055
+ overflowId,
42056
+ overflowTrigger
42057
+ } = child.dataset;
42058
+ if (!offsetWidth) {
42059
+ return;
42060
+ }
42061
+ if (overflowId && metrics.widths.get(overflowId) !== offsetWidth) {
42062
+ metrics.widths.set(overflowId, offsetWidth);
42063
+ hasChanged = true;
42064
+ }
42065
+ if (overflowTrigger !== undefined && metrics.triggerWidth !== offsetWidth) {
42066
+ metrics.triggerWidth = offsetWidth;
42067
+ hasChanged = true;
42068
+ }
42069
+ });
42070
+ if (hasChanged) {
42071
+ forceUpdate();
42072
+ }
42073
+ });
42074
+
42075
+ // The bar renders nothing without items, so the viewer lookup reruns once it mounts
42076
+ const hasItems = items.length > 0;
42077
+
42078
+ // The controls root is centered and shrinks to fit the bar, so the space the bar can grow into is the
42079
+ // viewer's. Fullscreen resizes the viewer too, which the observer picks up.
42080
+ external_react_["default"].useLayoutEffect(() => {
42081
+ const container = portalContainer ?? barRef.current?.closest(`.${constants/* CLASS_BOX_PREVIEW_CONTENT */.SG}`) ?? null;
42082
+ if (!container) {
42083
+ return undefined;
42084
+ }
42085
+ const updateAvailableWidth = () => {
42086
+ const {
42087
+ clientWidth
42088
+ } = container;
42089
+
42090
+ // A container that has not been laid out yet measures zero, which would collapse everything
42091
+ setAvailableWidth(clientWidth > 0 ? clientWidth - EDGE_MARGIN : Number.POSITIVE_INFINITY);
42092
+ };
42093
+ updateAvailableWidth();
42094
+ if (typeof ResizeObserver === 'undefined') {
42095
+ return undefined;
42096
+ }
42097
+ const observer = new ResizeObserver(updateAvailableWidth);
42098
+ observer.observe(container);
42099
+ return () => observer.disconnect();
42100
+ }, [hasItems, portalContainer]);
42101
+ const overflowIds = getOverflowIds(items, availableWidth, metricsRef.current);
42102
+ return {
42103
+ barRef,
42104
+ overflowItems: items.filter(({
42105
+ id
42106
+ }) => overflowIds.has(id)),
42107
+ visibleItems: items.filter(({
42108
+ id
42109
+ }) => !overflowIds.has(id))
42110
+ };
42111
+ }
42112
+ ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.scss
42113
+ // extracted by mini-css-extract-plugin
42114
+
42115
+ ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.tsx
42116
+
42117
+
42118
+
42119
+
42120
+
42121
+ // Moves controls into an overflow menu as the viewer narrows. Bars that always show everything, like the
42122
+ // annotations palette, use ControlsBarV2 directly.
42123
+ function ResponsiveControlsBarV2({
42124
+ items
42125
+ }) {
42126
+ const {
42127
+ barRef,
42128
+ overflowItems,
42129
+ visibleItems
42130
+ } = useControlsOverflow(items);
42131
+ if (!items.length) {
42132
+ return null;
42133
+ }
42134
+ return /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, {
42135
+ ref: barRef
42136
+ }, visibleItems.map(({
42137
+ control,
42138
+ id
42139
+ }) => /*#__PURE__*/external_react_["default"].createElement("div", {
42140
+ key: id,
42141
+ className: "bp-ResponsiveControlsBarV2-item",
42142
+ "data-overflow-id": id
42143
+ }, control)), overflowItems.length > 0 && /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowMenuV2, {
42144
+ items: overflowItems
42145
+ }));
42146
+ }
42147
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize"
42148
+
42149
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize"
42150
+
42151
+ ;// ./src/lib/viewers/controls/fullscreen/FullscreenToggleV2.tsx
42152
+ /* provided dependency */ var FullscreenToggleV2_ = __webpack_require__(441)["Tl"];
42153
+ const FullscreenToggleV2_excluded = ["onFullscreenToggle"];
42154
+ function FullscreenToggleV2_extends() { return FullscreenToggleV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FullscreenToggleV2_extends.apply(null, arguments); }
42155
+ function FullscreenToggleV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = FullscreenToggleV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
42156
+ function FullscreenToggleV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
42157
+
42158
+
42159
+
42160
+
42161
+
42162
+ function FullscreenToggleV2(_ref) {
42163
+ let {
42164
+ onFullscreenToggle
42165
+ } = _ref,
42166
+ rest = FullscreenToggleV2_objectWithoutProperties(_ref, FullscreenToggleV2_excluded);
42167
+ const isFullscreen = useFullscreen();
42168
+ const icon = isFullscreen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__;
42169
+ const label = isFullscreen ? FullscreenToggleV2_('exit_fullscreen') : FullscreenToggleV2_('enter_fullscreen');
42170
+ const handleClick = ({
42171
+ currentTarget
42172
+ }) => {
42173
+ onFullscreenToggle(!isFullscreen, currentTarget);
42174
+ };
42175
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42176
+ content: label
42177
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, FullscreenToggleV2_extends({
42178
+ "aria-label": label,
42179
+ "data-resin-target": "fullscreen",
42180
+ onClick: handleClick
42181
+ }, rest), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42182
+ icon: icon
42183
+ })));
42184
+ }
42185
+ ;// ./src/lib/viewers/controls/controls-bar/shortcuts.ts
42186
+ /* provided dependency */ var shortcuts_ = __webpack_require__(441)["Tl"];
42187
+
42188
+ // iPads report a Mac user agent, and their keyboards have the command key too
42189
+ const isApplePlatform = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
42190
+
42191
+ // Preview binds its shortcuts to both Cmd and Ctrl, so each platform is shown the modifier its keyboard labels
42192
+ function getShortcut(key) {
42193
+ return isApplePlatform() ? {
42194
+ keys: `Meta+${key}`,
42195
+ label: `⌘ + ${key}`
42196
+ } : {
42197
+ keys: `Control+${key}`,
42198
+ label: (0,util/* replacePlaceholders */.Lb)(shortcuts_('controls_shortcut_ctrl'), [key])
42199
+ };
42200
+ }
42201
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.scss
42202
+ // extracted by mini-css-extract-plugin
42203
+
42204
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.tsx
42205
+ const ControlsMenuItemV2_excluded = ["bareKey", "icon", "keepOpen", "label", "onSelect", "shortcutKey"];
42206
+ function ControlsMenuItemV2_extends() { return ControlsMenuItemV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsMenuItemV2_extends.apply(null, arguments); }
42207
+ function ControlsMenuItemV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsMenuItemV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
42208
+ function ControlsMenuItemV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
42209
+
42210
+
42211
+
42212
+
42213
+
42214
+ // The menu form of a bar control. Toggles are plain rows whose label names the next action, since checkbox
42215
+ // rows reserve space for a checkmark that the mocks do not have.
42216
+ function ControlsMenuItemV2(_ref) {
42217
+ let {
42218
+ bareKey,
42219
+ icon,
42220
+ keepOpen,
42221
+ label,
42222
+ onSelect,
42223
+ shortcutKey
42224
+ } = _ref,
42225
+ rest = ControlsMenuItemV2_objectWithoutProperties(_ref, ControlsMenuItemV2_excluded);
42226
+ const triggerRef = external_react_["default"].useContext(ControlsOverflowTriggerContext);
42227
+ let shortcut = null;
42228
+ if (shortcutKey) {
42229
+ shortcut = getShortcut(shortcutKey);
42230
+ } else if (bareKey) {
42231
+ shortcut = {
42232
+ keys: bareKey,
42233
+ label: bareKey
42234
+ };
42235
+ }
42236
+ const handleSelect = event => {
42237
+ if (keepOpen) {
42238
+ event.preventDefault();
42239
+ }
42240
+ onSelect(triggerRef.current);
42241
+ };
42242
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, ControlsMenuItemV2_extends({
42243
+ "aria-keyshortcuts": shortcut?.keys,
42244
+ onSelect: handleSelect
42245
+ }, rest, {
42246
+ className: "bp-ControlsMenuItemV2"
42247
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
42248
+ icon: icon
42249
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
42250
+ label: label
42251
+ }), shortcut && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.EndElement, {
42252
+ "aria-hidden": true
42253
+ }, shortcut.label));
42254
+ }
42255
+ ;// ./src/lib/viewers/controls/fullscreen/FullscreenMenuItemV2.tsx
42256
+ /* provided dependency */ var FullscreenMenuItemV2_ = __webpack_require__(441)["Tl"];
42257
+
42258
+
42259
+
42260
+
42261
+
42262
+ // Viewers using this menu row bind F to fullscreen while the Blueprint controls bar is on
42263
+ function FullscreenMenuItemV2({
42264
+ onFullscreenToggle
42265
+ }) {
42266
+ const isFullscreen = useFullscreen();
42267
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42268
+ bareKey: "F",
42269
+ "data-resin-target": "fullscreen",
42270
+ icon: isFullscreen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__,
42271
+ label: isFullscreen ? FullscreenMenuItemV2_('exit_fullscreen') : FullscreenMenuItemV2_('enter_fullscreen'),
42272
+ onSelect: trigger => onFullscreenToggle(!isFullscreen, trigger)
42273
+ });
42274
+ }
42275
+ ;// external "@box/blueprint-web-assets/icons/Medium/RotateLeft"
42276
+
42277
+ ;// ./src/lib/viewers/controls/rotate/RotateControlV2.tsx
42278
+ /* provided dependency */ var RotateControlV2_ = __webpack_require__(441)["Tl"];
42279
+
42280
+
42281
+
42282
+ function RotateControlV2({
42283
+ onRotateLeft
42284
+ }) {
42285
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42286
+ content: RotateControlV2_('rotate_left')
42287
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42288
+ "aria-label": RotateControlV2_('rotate_left'),
42289
+ "data-resin-target": "rotate",
42290
+ onClick: onRotateLeft
42291
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42292
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__
42293
+ })));
42294
+ }
42295
+ ;// ./src/lib/viewers/controls/rotate/RotateMenuItemV2.tsx
42296
+
42297
+
42298
+
42299
+ // Viewers using this menu row bind R to rotate while the Blueprint controls bar is on
42300
+ function RotateMenuItemV2({
42301
+ label,
42302
+ onRotateLeft
42303
+ }) {
42304
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42305
+ bareKey: "R",
42306
+ "data-resin-target": "rotate",
42307
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__,
42308
+ label: label,
42309
+ onSelect: () => onRotateLeft()
42310
+ });
42311
+ }
42312
+ ;// external "@box/blueprint-web-assets/icons/Medium/Minus"
42313
+
42314
+ ;// external "@box/blueprint-web-assets/icons/Medium/Plus"
42315
+
42316
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsPillV2.scss
42317
+ // extracted by mini-css-extract-plugin
42318
+
42319
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsPillV2.tsx
42320
+
42321
+
42322
+ // Groups the parts of one control, like page or zoom, on a shared background. Buttons inside take the
42323
+ // bp-ControlsPillV2-button class, and a text button takes bp-ControlsPillV2-label.
42324
+ function ControlsPillV2({
42325
+ children
42326
+ }) {
42327
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
42328
+ className: "bp-ControlsPillV2",
42329
+ "data-testid": "bp-ControlsPill"
42330
+ }, children);
42331
+ }
42332
+ // EXTERNAL MODULE: ./src/lib/TabularDigits.tsx + 1 modules
42333
+ var TabularDigits = __webpack_require__(2459);
42334
+ ;// ./src/lib/viewers/controls/zoom/ZoomControlsV2.tsx
42335
+ /* provided dependency */ var ZoomControlsV2_ = __webpack_require__(441)["Tl"];
42336
+
42337
+
42338
+
42339
+
42340
+
42341
+
42342
+
42343
+
42344
+ function getZoomState({
42345
+ maxScale = MAX_SCALE,
42346
+ minScale = MIN_SCALE,
42347
+ scale = 1
42348
+ }) {
42349
+ const currentScale = Math.round((scale + Number.EPSILON) * 100) / 100;
42350
+ const maxScaleValue = isFinite_default()(maxScale) ? Math.min(maxScale, MAX_SCALE) : MAX_SCALE;
42351
+ const minScaleValue = isFinite_default()(minScale) ? Math.max(minScale, MIN_SCALE) : MIN_SCALE;
42352
+ return {
42353
+ canZoomIn: currentScale < maxScaleValue,
42354
+ canZoomOut: currentScale > minScaleValue,
42355
+ currentScale
42356
+ };
42357
+ }
42358
+ function ZoomControlsV2({
42359
+ maxScale,
42360
+ minScale,
42361
+ onZoomIn,
42362
+ onZoomOut,
42363
+ resinTargetZoomIn = 'zoomIn',
42364
+ resinTargetZoomOut = 'zoomOut',
42365
+ scale
42366
+ }) {
42367
+ const {
42368
+ canZoomIn,
42369
+ canZoomOut,
42370
+ currentScale
42371
+ } = getZoomState({
42372
+ maxScale,
42373
+ minScale,
42374
+ scale
42375
+ });
42376
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsPillV2, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42377
+ content: ZoomControlsV2_('zoom_out')
42378
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42379
+ className: "bp-ControlsPillV2-button",
42380
+ "aria-label": ZoomControlsV2_('zoom_out'),
42381
+ "data-resin-target": resinTargetZoomOut,
42382
+ "data-testid": "bp-ZoomControls-out",
42383
+ disabled: !canZoomOut,
42384
+ onClick: onZoomOut
42385
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42386
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__
42387
+ }))), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
42388
+ as: "span",
42389
+ className: "bp-ControlsPillV2-text",
42390
+ color: "textOnDarkDefault",
42391
+ "data-testid": "bp-ZoomControls-current",
42392
+ title: ZoomControlsV2_('zoom_current_scale'),
42393
+ variant: "bodyDefault"
42394
+ }, /*#__PURE__*/external_react_["default"].createElement(TabularDigits/* default */.Ay, null, `${Math.round(currentScale * 100)}%`)), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42395
+ content: ZoomControlsV2_('zoom_in')
42396
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42397
+ className: "bp-ControlsPillV2-button",
42398
+ "aria-label": ZoomControlsV2_('zoom_in'),
42399
+ "data-resin-target": resinTargetZoomIn,
42400
+ "data-testid": "bp-ZoomControls-in",
42401
+ disabled: !canZoomIn,
42402
+ onClick: onZoomIn
42403
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42404
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__
42405
+ }))));
42406
+ }
42407
+ ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.scss
42408
+ // extracted by mini-css-extract-plugin
42409
+
42410
+ ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.tsx
42411
+ /* provided dependency */ var ZoomMenuItemsV2_ = __webpack_require__(441)["Tl"];
42412
+
42413
+
42414
+
42415
+
42416
+
42417
+
42418
+
42419
+
42420
+
42421
+ // The overflow menu form of the zoom controls: the current scale, then zoom in and zoom out
42422
+ function ZoomMenuItemsV2({
42423
+ maxScale,
42424
+ minScale,
42425
+ onZoomIn,
42426
+ onZoomOut,
42427
+ resinTargetZoomIn = 'zoomIn',
42428
+ resinTargetZoomOut = 'zoomOut',
42429
+ scale
42430
+ }) {
42431
+ const {
42432
+ canZoomIn,
42433
+ canZoomOut,
42434
+ currentScale
42435
+ } = getZoomState({
42436
+ maxScale,
42437
+ minScale,
42438
+ scale
42439
+ });
42440
+ const scaleLabel = (0,util/* replacePlaceholders */.Lb)(ZoomMenuItemsV2_('controls_zoom_scale'), [`${Math.round(currentScale * 100)}%`]);
42441
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
42442
+ as: "div",
42443
+ className: "bp-ZoomMenuItemsV2-scale",
42444
+ color: "textOnLightSecondary",
42445
+ "data-testid": "bp-ZoomMenuItems-scale",
42446
+ variant: "caption"
42447
+ }, scaleLabel), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42448
+ "data-resin-target": resinTargetZoomIn,
42449
+ "data-testid": "bp-ZoomControls-in-menuItem",
42450
+ disabled: !canZoomIn,
42451
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__,
42452
+ keepOpen: true,
42453
+ label: ZoomMenuItemsV2_('zoom_in'),
42454
+ onSelect: () => onZoomIn()
42455
+ }), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42456
+ "data-resin-target": resinTargetZoomOut,
42457
+ "data-testid": "bp-ZoomControls-out-menuItem",
42458
+ disabled: !canZoomOut,
42459
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__,
42460
+ keepOpen: true,
42461
+ label: ZoomMenuItemsV2_('zoom_out'),
42462
+ onSelect: () => onZoomOut()
42463
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null));
42464
+ }
42465
+ ;// ./src/lib/viewers/image/ImageControlsV2.tsx
42466
+ /* provided dependency */ var ImageControlsV2_ = __webpack_require__(441)["Tl"];
42467
+
42468
+
42469
+
42470
+
42471
+
42472
+
42473
+
42474
+
42475
+
42476
+
42477
+
42478
+ // The same collapse order as documents: rotate, then fullscreen, then zoom. The markup trigger has no menu
42479
+ // form and never collapses.
42480
+ const PRIORITY = {
42481
+ fullscreen: 2,
42482
+ rotate: 1,
42483
+ zoom: 3
42484
+ };
42485
+ function ImageControlsV2({
42486
+ annotationColor,
42487
+ annotationMode = AnnotationMode.NONE,
42488
+ experiences,
42489
+ hasDrawing,
42490
+ hasHighlight,
42491
+ hasRegion,
42492
+ onAnnotationColorChange,
42493
+ onAnnotationModeClick = (noop_default()),
42494
+ onAnnotationModeEscape,
42495
+ onFullscreenToggle,
42496
+ onRotateLeft,
42497
+ onZoomIn,
42498
+ onZoomOut,
42499
+ scale
42500
+ }) {
42501
+ const annotationModes = useAnnotationModes({
42502
+ hasDrawing,
42503
+ hasHighlight,
42504
+ hasRegion
42505
+ });
42506
+ const hasAnnotations = annotationModes.length > 0;
42507
+ const zoomProps = {
42508
+ onZoomIn,
42509
+ onZoomOut,
42510
+ scale
42511
+ };
42512
+ const items = [{
42513
+ control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
42514
+ id: 'zoom',
42515
+ menu: /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
42516
+ priority: PRIORITY.zoom
42517
+ }, {
42518
+ control: /*#__PURE__*/external_react_["default"].createElement(RotateControlV2, {
42519
+ onRotateLeft: onRotateLeft
42520
+ }),
42521
+ id: 'rotate',
42522
+ menu: /*#__PURE__*/external_react_["default"].createElement(RotateMenuItemV2, {
42523
+ label: ImageControlsV2_('controls_rotate_image'),
42524
+ onRotateLeft: onRotateLeft
42525
+ }),
42526
+ priority: PRIORITY.rotate
42527
+ }, {
42528
+ control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
42529
+ onFullscreenToggle: onFullscreenToggle
42530
+ }),
42531
+ id: 'fullscreen',
42532
+ menu: /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
42533
+ onFullscreenToggle: onFullscreenToggle
42534
+ }),
42535
+ priority: PRIORITY.fullscreen
42536
+ }, hasAnnotations && {
42537
+ control: /*#__PURE__*/external_react_["default"].createElement(AnnotationsControlsV2, {
42538
+ annotationMode: annotationMode,
42539
+ modes: annotationModes,
42540
+ onAnnotationModeClick: onAnnotationModeClick,
42541
+ onAnnotationModeEscape: onAnnotationModeEscape
42542
+ }),
42543
+ id: 'annotations'
42544
+ }];
42545
+ return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
42546
+ experiences: experiences
42547
+ }, /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
42548
+ items: items.filter(item => !!item)
42549
+ }), hasAnnotations && /*#__PURE__*/external_react_["default"].createElement(AnnotationsPaletteControlsV2, {
42550
+ annotationColor: annotationColor,
42551
+ annotationMode: annotationMode,
42552
+ modes: annotationModes,
42553
+ onAnnotationColorChange: onAnnotationColorChange,
42554
+ onAnnotationModeClick: onAnnotationModeClick
42555
+ }));
42556
+ }
42557
+ ;// ./src/lib/viewers/image/Image.scss
42558
+ // extracted by mini-css-extract-plugin
42559
+
42560
+ ;// ./src/lib/viewers/image/ImageViewer.js
42561
+
42562
+
42563
+
42564
+
42565
+
42566
+
42567
+
42568
+
42569
+
42570
+
42571
+ const CSS_CLASS_IMAGE = 'bp-image';
42572
+ const IMAGE_PADDING = 15;
42573
+ const IMAGE_ZOOM_SCALE = 1.2;
42574
+ class ImageViewer extends image_ImageBaseViewer {
42575
+ /** @inheritdoc */
42576
+ constructor(options) {
42577
+ super(options);
42578
+ this.api = options.api;
42579
+
42580
+ // Bind context for callbacks
42581
+ this.applyCursorFtux = this.applyCursorFtux.bind(this);
42582
+ this.finishLoading = this.finishLoading.bind(this);
42583
+ this.getViewportDimensions = this.getViewportDimensions.bind(this);
42584
+ this.handleAnnotationColorChange = this.handleAnnotationColorChange.bind(this);
42585
+ this.handleAnnotationControlsClick = this.handleAnnotationControlsClick.bind(this);
42586
+ this.handleAnnotationCreateEvent = this.handleAnnotationCreateEvent.bind(this);
42587
+ this.handleAssetAndRepLoad = this.handleAssetAndRepLoad.bind(this);
42588
+ this.handleImageDownloadError = this.handleImageDownloadError.bind(this);
42589
+ this.handleZoomEvent = this.handleZoomEvent.bind(this);
42590
+ this.rotateLeft = this.rotateLeft.bind(this);
42591
+ this.updateDiscoverabilityResinTag = this.updateDiscoverabilityResinTag.bind(this);
42592
+ this.updateExperiences = this.updateExperiences.bind(this);
42593
+ this.updatePannability = this.updatePannability.bind(this);
42594
+ this.annotationControlsFSM = new AnnotationControlsFSM(this.isDiscoverabilityEnabled() ? AnnotationState.REGION_TEMP : AnnotationState.NONE);
42595
+ this.annotationControlsFSM.subscribe(this.applyCursorFtux);
42596
+ this.annotationControlsFSM.subscribe(this.updateDiscoverabilityResinTag);
42597
+ if (this.isMobile) {
42598
+ this.handleOrientationChange = this.handleOrientationChange.bind(this);
42599
+ }
42600
+ }
42601
+
42602
+ /**
42603
+ * [destructor]
42604
+ *
42605
+ * @return {void}
42606
+ */
42607
+ destroy() {
42608
+ if (this.isDiscoverabilityEnabled()) {
42609
+ this.removeListener('zoom', this.handleZoomEvent);
42610
+ }
42611
+
42612
+ // Blob URLs stay allocated until revoked.
42613
+ if (this.imageEl && this.imageEl.src && this.imageEl.src.startsWith('blob:')) {
42614
+ URL.revokeObjectURL(this.imageEl.src);
42615
+ }
42616
+ super.destroy();
42617
+ }
42618
+
42619
+ /**
42620
+ * @inheritdoc
42621
+ */
42622
+ setup() {
42623
+ if (this.isSetup) {
42624
+ return;
42625
+ }
42626
+
42627
+ // Call super() to set up common layout
42628
+ super.setup();
42629
+ this.wrapperEl = this.createViewer(document.createElement('div'));
42630
+ this.wrapperEl.classList.add(CSS_CLASS_IMAGE);
42631
+ this.imageEl = this.wrapperEl.appendChild(document.createElement('img'));
42632
+ this.imageEl.setAttribute('data-page-number', 1);
42633
+
42634
+ // hides image tag until content is loaded
42635
+ this.imageEl.classList.add(constants/* CLASS_INVISIBLE */.Zb);
42636
+ this.currentRotationAngle = 0;
42637
+ const fileName = get_default()(this.options, 'file.name');
42638
+ this.imageEl.setAttribute('alt', fileName);
42639
+ if (this.isDiscoverabilityEnabled()) {
42640
+ this.addListener('zoom', this.handleZoomEvent);
42641
+ }
42642
+ this.updateDiscoverabilityResinTag();
42643
+ }
42644
+
42645
+ /**
42646
+ * Loads an Image.
42647
+ *
42648
+ * @return {Promise}
42649
+ */
42650
+ load() {
42651
+ super.load();
42652
+ const {
42653
+ representation,
42654
+ viewer
42655
+ } = this.options;
42656
+ const template = representation.content.url_template;
42657
+ this.bindDOMListeners();
42658
+ const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
42659
+ return this.getRepStatus().getPromise().then(() => {
42660
+ this.startLoadTimer();
42661
+ return this.fetchContentAsBlobUrl(contentUrl);
42662
+ }).then(blobUrl => {
42663
+ if (this.isDestroyed()) {
42664
+ URL.revokeObjectURL(blobUrl);
42665
+ return;
42666
+ }
42667
+ this.imageEl.src = blobUrl;
42668
+ if (this.imageEl.complete) {
42669
+ this.finishLoading();
42670
+ }
42671
+ super.handleAssetAndRepLoad();
42672
+ }).catch(this.handleAssetError);
42673
+ }
42674
+
42675
+ /**
42676
+ * Loads the image to be viewed
42677
+ *
42678
+ * @override
42679
+ * @return {void}
42680
+ */
42681
+ handleAssetAndRepLoad(downloadUrl) {
42682
+ this.startLoadTimer();
42683
+ this.imageEl.src = downloadUrl;
42684
+ if (this.imageEl.complete) {
42685
+ this.finishLoading();
42686
+ }
42687
+ super.handleAssetAndRepLoad();
42688
+ }
42689
+ finishLoading() {
42690
+ this.hidePreviewMask();
42691
+ this.emitFirstRenderMetric();
42692
+ return super.finishLoading();
42693
+ }
42694
+
42695
+ /**
42696
+ * Emits first render time metric.
42697
+ * Overrides base implementation to use BaseViewer's emitMetric(event, data) format.
42698
+ *
42699
+ * @protected
42700
+ * @return {void}
42701
+ */
42702
+ emitFirstRenderMetric() {
42703
+ if (this.isDestroyed() || this.firstRenderEmitted) {
42704
+ return;
42705
+ }
42706
+ const {
42707
+ file
42708
+ } = this.options;
42709
+ const tag = lib_Timer.createTag(file.id, lib_events/* FIRST_RENDER_METRIC */.VT);
42710
+ const time = lib_Timer.stop(tag);
42711
+ if (time && time.elapsed) {
42712
+ this.emitMetric(lib_events/* LOAD_METRIC */.Yy.firstRenderTime, time.elapsed);
42713
+ this.firstRenderEmitted = true;
42714
+ }
42715
+ }
42716
+
42717
+ /**
42718
+ * Prefetches assets for an image.
42719
+ *
42720
+ * @param {boolean} [options.content] - Whether or not to prefetch rep content
42721
+ * @return {void}
42722
+ */
42723
+ prefetch({
42724
+ content = true,
42725
+ preload = false
42726
+ } = {}) {
42727
+ const {
42728
+ file,
42729
+ representation,
42730
+ viewer
42731
+ } = this.options;
42732
+ const isWatermarked = file && file.watermark_info && file.watermark_info.is_watermarked;
42733
+ if ((content || preload) && !isWatermarked && this.isRepresentationReady(representation)) {
42734
+ const template = representation.content.url_template;
42735
+ const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
42736
+ this.api.get(contentUrl, {
42737
+ type: 'blob',
42738
+ headers: this.appendAuthHeader()
42739
+ }).catch(err => {
42740
+ console.warn('Image prefetch failed', err); // eslint-disable-line no-console
42741
+ });
42742
+ }
42743
+ }
42744
+
42745
+ /**
42746
+ * Can the viewer currently be panned
42747
+ *
42748
+ * @private
42749
+ * @return {void}
42750
+ */
42751
+ updatePannability() {
42752
+ if (!this.imageEl) {
42753
+ return;
42754
+ }
42755
+ if (this.isRotated()) {
42756
+ this.isPannable = this.imageEl.height > this.wrapperEl.clientWidth || this.imageEl.width > this.wrapperEl.clientHeight;
42757
+ } else {
42758
+ this.isPannable = this.imageEl.width > this.wrapperEl.clientWidth || this.imageEl.height > this.wrapperEl.clientHeight;
42759
+ }
42760
+ this.didPan = false;
42761
+ this.updateCursor();
42762
+ }
42763
+
42764
+ /**
42765
+ * Rotate image anti-clockwise by 90 degrees
42766
+ *
42767
+ * @return {void}
42768
+ */
42769
+ rotateLeft() {
42770
+ this.currentRotationAngle = (this.currentRotationAngle - 90) % 3600 % 360;
42771
+ this.imageEl.setAttribute('data-rotation-angle', this.currentRotationAngle);
42772
+ this.imageEl.style.transform = `rotate(${this.currentRotationAngle}deg)`;
42773
+ this.emit('rotate');
42774
+
42775
+ // Re-adjust image position after rotation
42776
+ this.handleOrientationChange();
42777
+ this.setScale(this.imageEl.offsetwidth, this.imageEl.offsetHeight);
42778
+ }
42779
+
42780
+ /**
42781
+ * Handles keyboard events for the image
42782
+ *
42783
+ * @param {string} key - Keydown key
42784
+ * @return {boolean} Consumed or not
42785
+ */
42786
+ onKeydown(key) {
42787
+ // This bare key belongs to the Blueprint controls bar, whose menu lists it; the older bar has no such shortcut
42788
+ if (this.controls && (key === 'r' || key === 'R') && this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ)) {
42789
+ this.rotateLeft();
42790
+ return true;
42791
+ }
42792
+ return super.onKeydown(key);
42793
+ }
42794
+
42795
+ // Annotation overrides
42796
+ getInitialAnnotationMode() {
42797
+ return this.isDiscoverabilityEnabled() ? AnnotationMode.REGION : AnnotationMode.NONE;
42798
+ }
42799
+
42800
+ /**
42801
+ * Gets the width & height after the transforms are applied.
42802
+ * When an image is rotated, the width & height of an image, e.g. offsetWidth & offsetHeight,
42803
+ * are the values before transforms are applied, so if the image is rotated we need to swap the
42804
+ * width & height
42805
+ *
42806
+ * @private
42807
+ * @param {number} [width] - The width in px
42808
+ * @param {number} [height] - The height in px
42809
+ * @param {boolean} [isRotated] - if the image has a transform rotate applied to it
42810
+ * @return {Object} the width & height of the image after tranformations
42811
+ */
42812
+ getTransformWidthAndHeight(width, height, isRotated) {
42813
+ if (isRotated) {
42814
+ return {
42815
+ width: height,
42816
+ height: width
42817
+ };
42818
+ }
42819
+ return {
42820
+ width,
42821
+ height
42822
+ };
42823
+ }
42824
+
42825
+ /**
42826
+ * Gets the viewport dimensions.
42827
+ *
42828
+ * @return {Object} the width & height of the viewport
42829
+ */
42830
+ getViewportDimensions() {
42831
+ return {
42832
+ width: this.wrapperEl.clientWidth - 2 * IMAGE_PADDING,
41668
42833
  height: this.wrapperEl.clientHeight - 2 * IMAGE_PADDING
41669
42834
  };
41670
42835
  }
@@ -41820,7 +42985,8 @@ class ImageViewer extends image_ImageBaseViewer {
41820
42985
  }
41821
42986
  const canAnnotate = this.areNewAnnotationsEnabled() && this.hasAnnotationCreatePermission();
41822
42987
  const canDraw = canAnnotate && this.options.showAnnotationsDrawingCreate;
41823
- this.controls.render(/*#__PURE__*/external_react_["default"].createElement(ImageControls, {
42988
+ const Controls = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ) ? ImageControlsV2 : ImageControls;
42989
+ this.controls.render(/*#__PURE__*/external_react_["default"].createElement(Controls, {
41824
42990
  annotationColor: this.annotationModule.getColor(),
41825
42991
  annotationMode: this.annotationControlsFSM.getMode(),
41826
42992
  experiences: this.experiences,
@@ -42192,6 +43358,242 @@ function MultiImageControls({
42192
43358
  onFullscreenToggle: onFullscreenToggle
42193
43359
  })));
42194
43360
  }
43361
+ ;// external "@box/blueprint-web-assets/icons/Medium/ChevronDown"
43362
+
43363
+ ;// external "@box/blueprint-web-assets/icons/Medium/ChevronUp"
43364
+
43365
+ ;// ./src/lib/viewers/controls/page/PageControlsFormV2.scss
43366
+ // extracted by mini-css-extract-plugin
43367
+
43368
+ ;// ./src/lib/viewers/controls/page/PageControlsFormV2.tsx
43369
+ /* provided dependency */ var PageControlsFormV2_ = __webpack_require__(441)["Tl"];
43370
+
43371
+
43372
+
43373
+
43374
+
43375
+
43376
+
43377
+ function PageControlsFormV2({
43378
+ onPageSubmit,
43379
+ pageNumber,
43380
+ pageCount
43381
+ }) {
43382
+ const {
43383
+ setIsEditing
43384
+ } = external_react_["default"].useContext(ControlsLayerContext);
43385
+ const [isInputShown, setIsInputShown] = external_react_["default"].useState(false);
43386
+ // A string because Toolbar.Input only supports text types, so a parsed number would show "NaN" once cleared
43387
+ const [inputValue, setInputValue] = external_react_["default"].useState(pageNumber.toString());
43388
+ // The input takes the button's size, so the bar keeps its width and height while the page number is edited
43389
+ const [inputSize, setInputSize] = external_react_["default"].useState();
43390
+ const buttonElRef = external_react_["default"].useRef(null);
43391
+ const inputElRef = external_react_["default"].useRef(null);
43392
+ const isRetryRef = external_react_["default"].useRef(false);
43393
+ const setPage = (allowRetry = false) => {
43394
+ const newPageNumber = Number(inputValue);
43395
+ if (Number.isInteger(newPageNumber) && newPageNumber >= 1 && newPageNumber <= pageCount && newPageNumber !== pageNumber) {
43396
+ onPageSubmit(newPageNumber);
43397
+ } else {
43398
+ setInputValue(pageNumber.toString()); // Reset the invalid input value to the current page
43399
+
43400
+ if (allowRetry) {
43401
+ isRetryRef.current = true;
43402
+ }
43403
+ }
43404
+ setIsInputShown(false);
43405
+ };
43406
+ const handleButtonClick = () => {
43407
+ const rect = buttonElRef.current?.getBoundingClientRect();
43408
+ setInputSize(rect?.width ? {
43409
+ height: rect.height,
43410
+ width: rect.width
43411
+ } : undefined);
43412
+ setIsInputShown(true);
43413
+ };
43414
+ const handleNumInputChange = event => {
43415
+ setInputValue(event.target.value);
43416
+ };
43417
+ const handleNumInputBlur = () => {
43418
+ setPage();
43419
+ };
43420
+ const handleNumInputKeyDown = event => {
43421
+ const key = (0,util/* decodeKeydown */.wU)(event);
43422
+ switch (key) {
43423
+ case ENTER:
43424
+ event.stopPropagation();
43425
+ event.preventDefault();
43426
+ setPage(true);
43427
+ break;
43428
+ case ESCAPE:
43429
+ event.stopPropagation();
43430
+ event.preventDefault();
43431
+ isRetryRef.current = true;
43432
+ setIsInputShown(false);
43433
+ setInputValue(pageNumber.toString());
43434
+ break;
43435
+ default:
43436
+ break;
43437
+ }
43438
+ };
43439
+ external_react_["default"].useEffect(() => {
43440
+ setInputValue(pageNumber.toString()); // Keep internal state in sync with prop as it changes
43441
+ }, [pageNumber]);
43442
+
43443
+ // Keeps the bar and the input up while typing, even once the cursor leaves the bar
43444
+ external_react_["default"].useEffect(() => {
43445
+ setIsEditing(isInputShown);
43446
+ return () => setIsEditing(false);
43447
+ }, [isInputShown, setIsEditing]);
43448
+ external_react_["default"].useLayoutEffect(() => {
43449
+ if (inputElRef.current && isInputShown) {
43450
+ inputElRef.current.select();
43451
+ }
43452
+ if (buttonElRef.current && !isInputShown) {
43453
+ if (isRetryRef.current) {
43454
+ buttonElRef.current.focus();
43455
+ }
43456
+ isRetryRef.current = false;
43457
+ }
43458
+ }, [isInputShown]);
43459
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
43460
+ className: "bp-PageControlsFormV2",
43461
+ "data-testid": "bp-PageControlsForm"
43462
+ }, isInputShown ? /*#__PURE__*/external_react_["default"].createElement("div", {
43463
+ className: "bp-PageControlsFormV2-input",
43464
+ style: inputSize
43465
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Input, {
43466
+ ref: inputElRef,
43467
+ "aria-label": PageControlsFormV2_('enter_page_num'),
43468
+ "data-resin-target": "pageNumberInput",
43469
+ "data-testid": "bp-PageControlsForm-input",
43470
+ inputMode: "numeric",
43471
+ onBlur: handleNumInputBlur,
43472
+ onChange: handleNumInputChange,
43473
+ onKeyDown: handleNumInputKeyDown,
43474
+ pattern: "[0-9]*",
43475
+ size: 3,
43476
+ value: inputValue
43477
+ })) : /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43478
+ content: PageControlsFormV2_('enter_page_num')
43479
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43480
+ ref: buttonElRef,
43481
+ className: "bp-ControlsPillV2-label",
43482
+ "data-resin-target": "pageNumberOpen",
43483
+ "data-testid": "bp-PageControlsForm-button",
43484
+ disabled: pageCount <= 1,
43485
+ onClick: handleButtonClick
43486
+ }, /*#__PURE__*/external_react_["default"].createElement("span", {
43487
+ className: "bp-PageControlsFormV2-button-label",
43488
+ "data-testid": "bp-PageControlsForm-button-label"
43489
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
43490
+ as: "span",
43491
+ className: "bp-ControlsPillV2-text",
43492
+ color: "textOnDarkDefault",
43493
+ variant: "bodyDefaultSemibold"
43494
+ }, /*#__PURE__*/external_react_["default"].createElement(TabularDigits/* default */.Ay, null, `${pageNumber} / ${pageCount}`))))));
43495
+ }
43496
+ ;// ./src/lib/viewers/controls/page/PageControlsV2.tsx
43497
+ /* provided dependency */ var PageControlsV2_ = __webpack_require__(441)["Tl"];
43498
+
43499
+
43500
+
43501
+
43502
+
43503
+
43504
+ function PageControlsV2({
43505
+ onPageChange,
43506
+ onPageSubmit,
43507
+ pageCount,
43508
+ pageNumber
43509
+ }) {
43510
+ if (pageCount <= 1) {
43511
+ return null;
43512
+ }
43513
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsPillV2, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43514
+ content: PageControlsV2_('previous_page')
43515
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43516
+ className: "bp-ControlsPillV2-button",
43517
+ "aria-label": PageControlsV2_('previous_page'),
43518
+ "data-resin-target": "pagePrevious",
43519
+ "data-testid": "bp-PageControls-previous",
43520
+ disabled: pageNumber === 1,
43521
+ onClick: () => onPageChange(pageNumber - 1)
43522
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
43523
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__
43524
+ }))), /*#__PURE__*/external_react_["default"].createElement(PageControlsFormV2, {
43525
+ onPageSubmit: onPageSubmit,
43526
+ pageCount: pageCount,
43527
+ pageNumber: pageNumber
43528
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43529
+ content: PageControlsV2_('next_page')
43530
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43531
+ className: "bp-ControlsPillV2-button",
43532
+ "aria-label": PageControlsV2_('next_page'),
43533
+ "data-resin-target": "pageNext",
43534
+ "data-testid": "bp-PageControls-next",
43535
+ disabled: pageNumber === pageCount,
43536
+ onClick: () => onPageChange(pageNumber + 1)
43537
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
43538
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__
43539
+ }))));
43540
+ }
43541
+ ;// ./src/lib/viewers/image/MultiImageControlsV2.tsx
43542
+
43543
+
43544
+
43545
+
43546
+
43547
+ // The same collapse order as documents: fullscreen, then zoom. Page has no menu form and never collapses.
43548
+ const MultiImageControlsV2_PRIORITY = {
43549
+ fullscreen: 2,
43550
+ zoom: 3
43551
+ };
43552
+ function MultiImageControlsV2({
43553
+ onFullscreenToggle,
43554
+ onPageChange,
43555
+ onPageSubmit,
43556
+ onZoomIn,
43557
+ onZoomOut,
43558
+ pageCount,
43559
+ pageNumber,
43560
+ scale
43561
+ }) {
43562
+ const zoomProps = {
43563
+ onZoomIn,
43564
+ onZoomOut,
43565
+ scale
43566
+ };
43567
+
43568
+ // Page is gated here rather than only inside it, so the bar never reserves width for a control that
43569
+ // would render nothing
43570
+ const items = [pageCount > 1 && {
43571
+ control: /*#__PURE__*/external_react_["default"].createElement(PageControlsV2, {
43572
+ onPageChange: onPageChange,
43573
+ onPageSubmit: onPageSubmit,
43574
+ pageCount: pageCount,
43575
+ pageNumber: pageNumber
43576
+ }),
43577
+ id: 'page'
43578
+ }, {
43579
+ control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
43580
+ id: 'zoom',
43581
+ menu: /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
43582
+ priority: MultiImageControlsV2_PRIORITY.zoom
43583
+ }, {
43584
+ control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
43585
+ onFullscreenToggle: onFullscreenToggle
43586
+ }),
43587
+ id: 'fullscreen',
43588
+ menu: /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
43589
+ onFullscreenToggle: onFullscreenToggle
43590
+ }),
43591
+ priority: MultiImageControlsV2_PRIORITY.fullscreen
43592
+ }];
43593
+ return /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
43594
+ items: items.filter(item => !!item)
43595
+ });
43596
+ }
42195
43597
  ;// ./src/lib/viewers/image/MultiImage.scss
42196
43598
  // extracted by mini-css-extract-plugin
42197
43599
 
@@ -42205,6 +43607,7 @@ function MultiImageViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) re
42205
43607
 
42206
43608
 
42207
43609
 
43610
+
42208
43611
  const PADDING_BUFFER = 100;
42209
43612
  const MultiImageViewer_CSS_CLASS_IMAGE = 'bp-images';
42210
43613
  const CSS_CLASS_IMAGE_WRAPPER = 'bp-images-wrapper';
@@ -42471,7 +43874,8 @@ class MultiImageViewer extends image_ImageBaseViewer {
42471
43874
  if (!this.controls) {
42472
43875
  return;
42473
43876
  }
42474
- this.controls.render(/*#__PURE__*/external_react_["default"].createElement(MultiImageControls, {
43877
+ const Controls = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ) ? MultiImageControlsV2 : MultiImageControls;
43878
+ this.controls.render(/*#__PURE__*/external_react_["default"].createElement(Controls, {
42475
43879
  onFullscreenToggle: this.toggleFullscreen,
42476
43880
  onPageChange: this.setPage,
42477
43881
  onPageSubmit: this.handlePageSubmit,
@@ -44444,92 +45848,56 @@ function Image360Controls({
44444
45848
  onVrToggle: onVrToggle
44445
45849
  }));
44446
45850
  }
44447
- // EXTERNAL MODULE: external "@box/blueprint-web"
44448
- var blueprint_web_ = __webpack_require__(8912);
44449
45851
  ;// external "@box/blueprint-web-assets/icons/Medium/VrGoggles"
44450
45852
 
45853
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
45854
+ var utils = __webpack_require__(5346);
44451
45855
  ;// ./src/lib/viewers/controls/box3d/VrToggleControlV2.tsx
44452
45856
  /* provided dependency */ var VrToggleControlV2_ = __webpack_require__(441)["Tl"];
45857
+ const VrToggleControlV2_excluded = ["buttonType", "isVrShown", "onVrToggle"];
45858
+ function VrToggleControlV2_extends() { return VrToggleControlV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, VrToggleControlV2_extends.apply(null, arguments); }
45859
+ function VrToggleControlV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = VrToggleControlV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
45860
+ function VrToggleControlV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
44453
45861
 
44454
45862
 
44455
45863
 
44456
- function VrToggleControlV2({
44457
- isVrShown,
44458
- onVrToggle
44459
- }) {
44460
- if (!isVrShown) {
45864
+
45865
+
45866
+ // Toolbar.Button throws outside a Toolbar.Root, so surfaces without one (the media bar) use IconButton.
45867
+
45868
+ function VrToggleControlV2(props) {
45869
+ if (!props.isVrShown) {
44461
45870
  return null;
44462
45871
  }
45872
+ if (props.buttonType === 'icon') {
45873
+ const {
45874
+ buttonType,
45875
+ isVrShown,
45876
+ onVrToggle
45877
+ } = props,
45878
+ rest = VrToggleControlV2_objectWithoutProperties(props, VrToggleControlV2_excluded);
45879
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45880
+ content: VrToggleControlV2_('box3d_toggle_vr')
45881
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, VrToggleControlV2_extends({
45882
+ "data-target-id": "VrToggleControlV2-toggle",
45883
+ onKeyDown: utils/* stopActivationKeyPropagation */.My
45884
+ }, rest, {
45885
+ "aria-label": VrToggleControlV2_('box3d_toggle_vr'),
45886
+ "data-resin-target": "vrToggle",
45887
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__,
45888
+ onClick: onVrToggle
45889
+ })));
45890
+ }
44463
45891
  return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
44464
45892
  content: VrToggleControlV2_('box3d_toggle_vr')
44465
45893
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
44466
45894
  "aria-label": VrToggleControlV2_('box3d_toggle_vr'),
44467
45895
  "data-resin-target": "vrToggle",
44468
- onClick: onVrToggle
45896
+ onClick: props.onVrToggle
44469
45897
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
44470
45898
  icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__
44471
45899
  })));
44472
45900
  }
44473
- ;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.tsx
44474
- const ControlsBarV2_excluded = ["children"];
44475
- function ControlsBarV2_extends() { return ControlsBarV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsBarV2_extends.apply(null, arguments); }
44476
- function ControlsBarV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsBarV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
44477
- function ControlsBarV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
44478
-
44479
-
44480
- function ControlsBarV2(_ref, ref) {
44481
- let {
44482
- children
44483
- } = _ref,
44484
- rest = ControlsBarV2_objectWithoutProperties(_ref, ControlsBarV2_excluded);
44485
- if (!children) {
44486
- return null;
44487
- }
44488
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, ControlsBarV2_extends({
44489
- ref: ref,
44490
- colorScheme: "dark",
44491
- "data-testid": "bp-ControlsBar"
44492
- }, rest), children);
44493
- }
44494
- /* harmony default export */ const controls_bar_ControlsBarV2 = (/*#__PURE__*/external_react_["default"].forwardRef(ControlsBarV2));
44495
- ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize"
44496
-
44497
- ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize"
44498
-
44499
- ;// ./src/lib/viewers/controls/fullscreen/FullscreenToggleV2.tsx
44500
- /* provided dependency */ var FullscreenToggleV2_ = __webpack_require__(441)["Tl"];
44501
- const FullscreenToggleV2_excluded = ["onFullscreenToggle"];
44502
- function FullscreenToggleV2_extends() { return FullscreenToggleV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FullscreenToggleV2_extends.apply(null, arguments); }
44503
- function FullscreenToggleV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = FullscreenToggleV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
44504
- function FullscreenToggleV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
44505
-
44506
-
44507
-
44508
-
44509
-
44510
- function FullscreenToggleV2(_ref) {
44511
- let {
44512
- onFullscreenToggle
44513
- } = _ref,
44514
- rest = FullscreenToggleV2_objectWithoutProperties(_ref, FullscreenToggleV2_excluded);
44515
- const isFullscreen = useFullscreen();
44516
- const icon = isFullscreen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__;
44517
- const label = isFullscreen ? FullscreenToggleV2_('exit_fullscreen') : FullscreenToggleV2_('enter_fullscreen');
44518
- const handleClick = ({
44519
- currentTarget
44520
- }) => {
44521
- onFullscreenToggle(!isFullscreen, currentTarget);
44522
- };
44523
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
44524
- content: label
44525
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, FullscreenToggleV2_extends({
44526
- "aria-label": label,
44527
- "data-resin-target": "fullscreen",
44528
- onClick: handleClick
44529
- }, rest), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
44530
- icon: icon
44531
- })));
44532
- }
44533
45901
  ;// ./src/lib/viewers/box3d/image360/Image360ControlsV2.tsx
44534
45902
 
44535
45903
 
@@ -45266,78 +46634,6 @@ function TextControls({
45266
46634
  onFullscreenToggle: onFullscreenToggle
45267
46635
  })));
45268
46636
  }
45269
- ;// external "@box/blueprint-web-assets/icons/Medium/Minus"
45270
-
45271
- ;// external "@box/blueprint-web-assets/icons/Medium/Plus"
45272
-
45273
- ;// ./src/lib/viewers/controls/zoom/ZoomControlsV2.tsx
45274
- /* provided dependency */ var ZoomControlsV2_ = __webpack_require__(441)["Tl"];
45275
-
45276
-
45277
-
45278
-
45279
-
45280
-
45281
- function getZoomState({
45282
- maxScale = MAX_SCALE,
45283
- minScale = MIN_SCALE,
45284
- scale = 1
45285
- }) {
45286
- const currentScale = Math.round((scale + Number.EPSILON) * 100) / 100;
45287
- const maxScaleValue = isFinite_default()(maxScale) ? Math.min(maxScale, MAX_SCALE) : MAX_SCALE;
45288
- const minScaleValue = isFinite_default()(minScale) ? Math.max(minScale, MIN_SCALE) : MIN_SCALE;
45289
- return {
45290
- canZoomIn: currentScale < maxScaleValue,
45291
- canZoomOut: currentScale > minScaleValue,
45292
- currentScale
45293
- };
45294
- }
45295
- function ZoomControlsV2({
45296
- maxScale,
45297
- minScale,
45298
- onZoomIn,
45299
- onZoomOut,
45300
- resinTargetZoomIn = 'zoomIn',
45301
- resinTargetZoomOut = 'zoomOut',
45302
- scale
45303
- }) {
45304
- const {
45305
- canZoomIn,
45306
- canZoomOut,
45307
- currentScale
45308
- } = getZoomState({
45309
- maxScale,
45310
- minScale,
45311
- scale
45312
- });
45313
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45314
- content: ZoomControlsV2_('zoom_out')
45315
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
45316
- "aria-label": ZoomControlsV2_('zoom_out'),
45317
- "data-resin-target": resinTargetZoomOut,
45318
- "data-testid": "bp-ZoomControls-out",
45319
- disabled: !canZoomOut,
45320
- onClick: onZoomOut
45321
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
45322
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__
45323
- }))), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
45324
- as: "span",
45325
- color: "textOnDarkDefault",
45326
- "data-testid": "bp-ZoomControls-current",
45327
- title: ZoomControlsV2_('zoom_current_scale'),
45328
- variant: "bodyDefaultSemibold"
45329
- }, `${Math.round(currentScale * 100)}%`), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45330
- content: ZoomControlsV2_('zoom_in')
45331
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
45332
- "aria-label": ZoomControlsV2_('zoom_in'),
45333
- "data-resin-target": resinTargetZoomIn,
45334
- "data-testid": "bp-ZoomControls-in",
45335
- disabled: !canZoomIn,
45336
- onClick: onZoomIn
45337
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
45338
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__
45339
- }))));
45340
- }
45341
46637
  ;// ./src/lib/viewers/text/TextControlsV2.tsx
45342
46638
 
45343
46639
 
@@ -51976,8 +53272,45 @@ const arrow_curved_forward_24px_namespaceObject = "<svg width=\"24\" height=\"24
51976
53272
  var MediaLoadingIndicator = __webpack_require__(4301);
51977
53273
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayOverlayIcon.tsx
51978
53274
  var PlayOverlayIcon = __webpack_require__(2048);
51979
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
51980
- var utils = __webpack_require__(5346);
53275
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/SkipButton.tsx + 2 modules
53276
+ var SkipButton = __webpack_require__(2659);
53277
+ ;// ./src/lib/viewers/controls/media/VideoPlaySeekOverlay.scss
53278
+ // extracted by mini-css-extract-plugin
53279
+
53280
+ ;// ./src/lib/viewers/controls/media/VideoPlaySeekOverlay.tsx
53281
+ /* provided dependency */ var VideoPlaySeekOverlay_ = __webpack_require__(441)["Tl"];
53282
+
53283
+
53284
+
53285
+
53286
+
53287
+
53288
+ function VideoPlaySeekOverlay({
53289
+ movePlayback,
53290
+ onPlay
53291
+ }) {
53292
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(SkipButton/* default */.A, {
53293
+ direction: "backward",
53294
+ isBlueprintEnabled: true,
53295
+ movePlayback: movePlayback
53296
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
53297
+ content: VideoPlaySeekOverlay_('media_play')
53298
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
53299
+ "aria-label": VideoPlaySeekOverlay_('media_play'),
53300
+ className: "bp-VideoPlaySeekOverlay-play",
53301
+ "data-resin-target": "playOverlay",
53302
+ "data-target-id": "VideoPlaySeekOverlay-play",
53303
+ icon: PlayOverlayIcon/* default */.A,
53304
+ onClick: onPlay,
53305
+ onKeyDown: utils/* stopActivationKeyPropagation */.My,
53306
+ size: "large",
53307
+ variant: "on-dark"
53308
+ })), /*#__PURE__*/external_react_["default"].createElement(SkipButton/* default */.A, {
53309
+ direction: "forward",
53310
+ isBlueprintEnabled: true,
53311
+ movePlayback: movePlayback
53312
+ }));
53313
+ }
51981
53314
  ;// ./src/lib/viewers/media/fitFrameToViewport.js
51982
53315
  /**
51983
53316
  * Contain-fits a frame into the viewport (same model as object-fit: contain).
@@ -52594,11 +53927,14 @@ function VideoBaseViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) ret
52594
53927
 
52595
53928
 
52596
53929
 
53930
+
53931
+
52597
53932
  const MOUSE_MOVE_TIMEOUT_IN_MILLIS = 1000;
52598
53933
  const CLASS_PLAY_BUTTON = 'bp-media-play-button';
52599
53934
  const CLASS_PLAY_CONTAINER = 'bp-media-overlay-play-container';
52600
53935
  const CLASS_PLAY_CONTAINER_PLAY_BUTTON = 'bp-media-overlay-play-button';
52601
53936
  const CLASS_SEEK_BUTTON = 'bp-media-overlay-seek-button';
53937
+ const CLASS_PLAY_SEEK_OVERLAY = 'bp-VideoPlaySeekOverlay';
52602
53938
  const SMALL_VIDEO_WIDTH_THRESHOLD = 580;
52603
53939
  const SPINNER_HALF_SIZE = 40; // Half of the 80px spinner height (_mediaBase.scss and MediaLoadingIndicator.scss)
52604
53940
  const VIDEO_ANNOTATIONS_ENABLED = 'videoAnnotations.enabled';
@@ -52713,7 +54049,7 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52713
54049
  this.bufferingSpinnerEl = this.mediaContainerEl.appendChild(document.createElement('div'));
52714
54050
  this.bufferingSpinnerEl.classList.add(constants/* CLASS_HIDDEN */.zX);
52715
54051
  // Shift up by half the control bar + half the spinner to visually center above the controls
52716
- const spinnerMarginTop = this.useReactControls() && !this.isVideoPlayerV2 ? `-${constants/* VIDEO_PLAYER_CONTROL_BAR_HEIGHT */.qL / 2 + SPINNER_HALF_SIZE}px` : undefined;
54052
+ const spinnerMarginTop = this.useReactControls() && !this.isVideoControlsV2Enabled() ? `-${constants/* VIDEO_PLAYER_CONTROL_BAR_HEIGHT */.qL / 2 + SPINNER_HALF_SIZE}px` : undefined;
52717
54053
  if (this.isBlueprintMediaControlsEnabled()) {
52718
54054
  this.bufferingSpinnerRoot = (0,client_.createRoot)(this.bufferingSpinnerEl);
52719
54055
  this.bufferingSpinnerRoot.render(/*#__PURE__*/external_react_["default"].createElement(MediaLoadingIndicator/* default */.A, {
@@ -52739,6 +54075,16 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52739
54075
  return true;
52740
54076
  }
52741
54077
 
54078
+ /**
54079
+ * Whether to render the V2 React controls. Separate from the V2 layout so a viewer
54080
+ * can keep its own stage and still use the V2 controls.
54081
+ *
54082
+ * @return {boolean} true when the V2 controls should render
54083
+ */
54084
+ isVideoControlsV2Enabled() {
54085
+ return this.isVideoPlayerV2;
54086
+ }
54087
+
52742
54088
  /**
52743
54089
  * Loads a media source.
52744
54090
  *
@@ -52906,6 +54252,10 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52906
54252
  });
52907
54253
  }
52908
54254
  buildPlayButtonWithSeekButtons() {
54255
+ if (this.isBlueprintMediaControlsEnabled()) {
54256
+ this.buildBlueprintPlaySeekOverlay();
54257
+ return;
54258
+ }
52909
54259
  this.playContainerEl = this.mediaContainerEl.appendChild(document.createElement('div'));
52910
54260
  this.playContainerEl.classList.add(CLASS_PLAY_CONTAINER);
52911
54261
  this.playContainerEl.classList.add(constants/* CLASS_HIDDEN */.zX);
@@ -52932,7 +54282,38 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52932
54282
  this.seekBackwardButtonEl.addEventListener('click', () => this.movePlayback(false, 5));
52933
54283
  }
52934
54284
  }
54285
+
54286
+ /**
54287
+ * Renders the narrow-video play/seek cluster with Blueprint buttons. The container stays on
54288
+ * playContainerEl so the shared show/hide and narrow-width logic treats both versions the same.
54289
+ *
54290
+ * @private
54291
+ * @return {void}
54292
+ */
54293
+ buildBlueprintPlaySeekOverlay() {
54294
+ this.playContainerEl = this.mediaContainerEl.appendChild(document.createElement('div'));
54295
+ this.playContainerEl.classList.add(CLASS_PLAY_SEEK_OVERLAY);
54296
+ this.playContainerEl.classList.add(constants/* CLASS_HIDDEN */.zX);
54297
+ const handlePlay = () => {
54298
+ // The cluster hides once playback starts; keep focus in the player so Space still reaches it.
54299
+ if (this.playContainerEl?.contains(document.activeElement)) {
54300
+ this.mediaContainerEl.focus();
54301
+ }
54302
+ this.handlePlayRequest();
54303
+ };
54304
+ this.playSeekOverlayRoot = (0,client_.createRoot)(this.playContainerEl);
54305
+ this.playSeekOverlayRoot.render(/*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
54306
+ container: this.containerEl
54307
+ }, /*#__PURE__*/external_react_["default"].createElement(VideoPlaySeekOverlay, {
54308
+ movePlayback: this.movePlayback,
54309
+ onPlay: handlePlay
54310
+ })));
54311
+ }
52935
54312
  removePlayButtonWithSeekButtons() {
54313
+ if (this.playSeekOverlayRoot) {
54314
+ this.playSeekOverlayRoot.unmount();
54315
+ this.playSeekOverlayRoot = undefined;
54316
+ }
52936
54317
  if (this.playContainerEl) {
52937
54318
  if (this.seekForwardButtonEl) {
52938
54319
  this.seekForwardButtonEl.removeEventListener('click', () => this.movePlayback(true, 5));
@@ -52984,6 +54365,10 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52984
54365
  if (this.seekBackwardButtonEl) {
52985
54366
  this.seekBackwardButtonEl.removeEventListener('click', () => this.movePlayback(false, 5));
52986
54367
  }
54368
+ if (this.playSeekOverlayRoot) {
54369
+ this.playSeekOverlayRoot.unmount();
54370
+ this.playSeekOverlayRoot = undefined;
54371
+ }
52987
54372
  if (this.bufferingSpinnerRoot) {
52988
54373
  this.bufferingSpinnerRoot.unmount();
52989
54374
  this.bufferingSpinnerRoot = undefined;
@@ -53047,9 +54432,9 @@ class VideoBaseViewer extends media_MediaBaseViewer {
53047
54432
  loadUIReact() {
53048
54433
  super.loadUIReact();
53049
54434
 
53050
- // For the V2 player, mount the controls on the wrapper (above the media container)
54435
+ // For the V2 controls, mount on the wrapper (above the media container)
53051
54436
  // so their width is constrained by the viewport rather than the video
53052
- const controlsContainerEl = this.isVideoPlayerV2 ? this.wrapperEl : this.mediaContainerEl;
54437
+ const controlsContainerEl = this.isVideoControlsV2Enabled() ? this.wrapperEl : this.mediaContainerEl;
53053
54438
  this.controls = new ControlsRoot({
53054
54439
  className: 'bp-VideoControlsRoot',
53055
54440
  containerEl: controlsContainerEl,
@@ -53368,7 +54753,7 @@ class VideoBaseViewer extends media_MediaBaseViewer {
53368
54753
  */
53369
54754
  handleNarrowVideoUI() {
53370
54755
  if (this.useReactControls()) {
53371
- const widthNumber = this.isVideoPlayerV2 ? this.wrapperEl.clientWidth : parseInt(this.mediaEl.style.width, 10);
54756
+ const widthNumber = this.isVideoControlsV2Enabled() ? this.wrapperEl.clientWidth : parseInt(this.mediaEl.style.width, 10);
53372
54757
  if (!Number.isNaN(widthNumber)) {
53373
54758
  // check if play and seek buttons exist in the dom
53374
54759
  if (this.playContainerEl && widthNumber >= SMALL_VIDEO_WIDTH_THRESHOLD) {
@@ -53546,27 +54931,6 @@ function MediaFullscreenToggle(props) {
53546
54931
  var Medium_ = __webpack_require__(9747);
53547
54932
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/MediaToggle.tsx
53548
54933
  var MediaToggle = __webpack_require__(8997);
53549
- ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.scss
53550
- // extracted by mini-css-extract-plugin
53551
-
53552
- ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.tsx
53553
-
53554
-
53555
-
53556
- // Blueprint's Tooltip writes its own data-state onto the element it wraps, which overwrites the
53557
- // data-state Toolbar.ToggleItem uses for its selected styling, so the tooltip gets its own element.
53558
- function ToggleTooltipV2({
53559
- children,
53560
- content,
53561
- side
53562
- }) {
53563
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
53564
- content: content,
53565
- side: side
53566
- }, /*#__PURE__*/external_react_["default"].createElement("span", {
53567
- className: "bp-ToggleTooltipV2"
53568
- }, children));
53569
- }
53570
54934
  ;// ./src/lib/viewers/controls/media/SubtitlesToggle.scss
53571
54935
  // extracted by mini-css-extract-plugin
53572
54936
 
@@ -53758,10 +55122,8 @@ function VideoControls({
53758
55122
  var MediaSettingsV2 = __webpack_require__(4027);
53759
55123
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseButton.tsx + 2 modules
53760
55124
  var PlayPauseButton = __webpack_require__(5760);
53761
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/SkipButton.tsx + 2 modules
53762
- var SkipButton = __webpack_require__(2659);
53763
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
53764
- var TimestampControl = __webpack_require__(3308);
55125
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
55126
+ var TimestampControl = __webpack_require__(3904);
53765
55127
  // EXTERNAL MODULE: ./src/lib/viewers/media/formatTimecode.ts
53766
55128
  var formatTimecode = __webpack_require__(4179);
53767
55129
  ;// ./src/lib/viewers/controls/media/FilmstripV2.scss
@@ -54110,6 +55472,13 @@ function TimeControlsV2({
54110
55472
 
54111
55473
 
54112
55474
 
55475
+ function isFocusVisible(el) {
55476
+ try {
55477
+ return !!el?.matches(':focus-visible');
55478
+ } catch {
55479
+ return true;
55480
+ }
55481
+ }
54113
55482
  function VideoFullscreenButton({
54114
55483
  mediaEl,
54115
55484
  onFullscreenToggle,
@@ -54119,11 +55488,21 @@ function VideoFullscreenButton({
54119
55488
  const title = isFullscreen ? VideoFullscreenButton_('exit_fullscreen') : VideoFullscreenButton_('enter_fullscreen');
54120
55489
  const ref = external_react_["default"].useRef(null);
54121
55490
  const [position, setPosition] = external_react_["default"].useState(null);
55491
+ const [isTooltipOpen, setIsTooltipOpen] = external_react_["default"].useState(false);
55492
+ const isHoveredRef = external_react_["default"].useRef(false);
54122
55493
  external_react_["default"].useEffect(() => {
54123
55494
  if (!mediaEl) return undefined;
55495
+ const observed = {};
54124
55496
  const update = () => {
54125
55497
  const parent = ref.current?.offsetParent;
54126
55498
  if (!parent) return;
55499
+ if (parent !== observed.parent) {
55500
+ if (observed.parent) {
55501
+ observed.observer?.unobserve(observed.parent);
55502
+ }
55503
+ observed.parent = parent;
55504
+ observed.observer?.observe(parent);
55505
+ }
54127
55506
  const videoRect = mediaEl.getBoundingClientRect();
54128
55507
  const parentRect = parent.getBoundingClientRect();
54129
55508
  setPosition({
@@ -54131,17 +55510,20 @@ function VideoFullscreenButton({
54131
55510
  right: parentRect.right - videoRect.right + 24
54132
55511
  });
54133
55512
  };
54134
- update();
54135
55513
 
54136
55514
  // Watch both the video and the overlay parent. A sibling layout change
54137
55515
  // (e.g. a host-page sidebar) can shrink the parent and re-center the
54138
55516
  // video without changing the video element's box size, so observing
54139
55517
  // mediaEl alone would leave the button at a stale `right` offset.
55518
+ // The button is watched too: it has no offsetParent while the preview is hidden during load, and the
55519
+ // video can reach its final size before then, so the button appearing may be the only signal left.
54140
55520
  const resizeObserver = new ResizeObserver(update);
55521
+ observed.observer = resizeObserver;
54141
55522
  resizeObserver.observe(mediaEl);
54142
- if (ref.current?.offsetParent) {
54143
- resizeObserver.observe(ref.current.offsetParent);
55523
+ if (ref.current) {
55524
+ resizeObserver.observe(ref.current);
54144
55525
  }
55526
+ update();
54145
55527
  window.addEventListener('resize', update);
54146
55528
  return () => {
54147
55529
  resizeObserver.disconnect();
@@ -54153,6 +55535,13 @@ function VideoFullscreenButton({
54153
55535
  }) => {
54154
55536
  onFullscreenToggle(!isFullscreen, target);
54155
55537
  };
55538
+
55539
+ // The viewer refocuses this button after a fullscreen change, mid-relayout. Show the tooltip for
55540
+ // hover or keyboard focus only, not for that refocus after a mouse click.
55541
+ const handleTooltipOpenChange = open => {
55542
+ if (open && !isHoveredRef.current && !isFocusVisible(document.activeElement)) return;
55543
+ setIsTooltipOpen(open);
55544
+ };
54156
55545
  const positionStyle = position ? {
54157
55546
  top: position.top,
54158
55547
  right: position.right
@@ -54161,9 +55550,17 @@ function VideoFullscreenButton({
54161
55550
  return /*#__PURE__*/external_react_["default"].createElement("div", {
54162
55551
  ref: ref,
54163
55552
  className: "bp-VideoFullscreenButton-position",
55553
+ onPointerEnter: () => {
55554
+ isHoveredRef.current = true;
55555
+ },
55556
+ onPointerLeave: () => {
55557
+ isHoveredRef.current = false;
55558
+ },
54164
55559
  style: positionStyle
54165
55560
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
54166
- content: title
55561
+ content: title,
55562
+ onOpenChange: handleTooltipOpenChange,
55563
+ open: isTooltipOpen
54167
55564
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
54168
55565
  "aria-label": title,
54169
55566
  "data-resin-target": "videoFullscreen",
@@ -54245,238 +55642,6 @@ function AnnotationsPaletteAnchorV2({
54245
55642
  }
54246
55643
  }, children), container);
54247
55644
  }
54248
- ;// external "@box/blueprint-web-assets/icons/Medium/PencilTip"
54249
-
54250
- ;// external "@box/blueprint-web-assets/icons/Medium/SquarePlus"
54251
-
54252
- ;// external "@box/blueprint-web-assets/icons/Medium/TCursorHighlight"
54253
-
54254
- ;// ./src/lib/viewers/controls/annotations/annotationModeIcons.ts
54255
-
54256
-
54257
-
54258
-
54259
- const ANNOTATION_MODE_ICONS = {
54260
- [AnnotationMode.DRAWING]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__,
54261
- [AnnotationMode.HIGHLIGHT]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__,
54262
- [AnnotationMode.REGION]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__
54263
- };
54264
- /* harmony default export */ const annotationModeIcons = (ANNOTATION_MODE_ICONS);
54265
- ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.scss
54266
- // extracted by mini-css-extract-plugin
54267
-
54268
- ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.tsx
54269
- /* provided dependency */ var AnnotationsPaletteV2_ = __webpack_require__(441)["Tl"];
54270
- function AnnotationsPaletteV2_extends() { return AnnotationsPaletteV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, AnnotationsPaletteV2_extends.apply(null, arguments); }
54271
-
54272
-
54273
-
54274
-
54275
-
54276
-
54277
-
54278
-
54279
- function AnnotationsPaletteV2({
54280
- children
54281
- }) {
54282
- return /*#__PURE__*/external_react_["default"].createElement("div", {
54283
- className: "bp-AnnotationsPaletteV2",
54284
- "data-testid": "bp-AnnotationsPaletteV2"
54285
- }, /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, null, children));
54286
- }
54287
- function Modes({
54288
- annotationMode,
54289
- children,
54290
- onAnnotationModeClick = (noop_default())
54291
- }) {
54292
- // The single-select group reports an empty value when the active mode is clicked again. Exiting
54293
- // is left to the trigger on the main bar, so the palette never closes under the cursor.
54294
- const handleModeChange = mode => {
54295
- if (!mode || mode === annotationMode) {
54296
- return;
54297
- }
54298
- onAnnotationModeClick({
54299
- mode: mode
54300
- });
54301
- };
54302
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54303
- "data-testid": "bp-annotations-controls",
54304
- onValueChange: handleModeChange,
54305
- type: "single",
54306
- value: annotationMode
54307
- }, children);
54308
- }
54309
- function Mode({
54310
- value
54311
- }) {
54312
- const {
54313
- label,
54314
- resinTarget,
54315
- testId
54316
- } = {
54317
- [AnnotationMode.DRAWING]: {
54318
- label: AnnotationsPaletteV2_('drawing_comment'),
54319
- resinTarget: 'draw',
54320
- testId: 'bp-AnnotationsControls-drawBtn'
54321
- },
54322
- [AnnotationMode.HIGHLIGHT]: {
54323
- label: AnnotationsPaletteV2_('highlight_text'),
54324
- resinTarget: 'highlightText',
54325
- testId: 'bp-AnnotationsControls-highlightBtn'
54326
- },
54327
- [AnnotationMode.REGION]: {
54328
- label: AnnotationsPaletteV2_('region_comment'),
54329
- resinTarget: 'highlightRegion',
54330
- testId: 'bp-AnnotationsControls-regionBtn'
54331
- }
54332
- }[value];
54333
- return /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54334
- content: label
54335
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
54336
- "aria-label": label,
54337
- "data-resin-target": resinTarget,
54338
- "data-testid": testId,
54339
- icon: annotationModeIcons[value],
54340
- value: value
54341
- }));
54342
- }
54343
- /* harmony default export */ const annotations_AnnotationsPaletteV2 = (AnnotationsPaletteV2_extends(AnnotationsPaletteV2, {
54344
- Mode,
54345
- Modes
54346
- }));
54347
- ;// external "@box/blueprint-web-assets/icons/Medium/Comment"
54348
-
54349
- ;// ./src/lib/viewers/controls/annotations/AnnotationsToggleV2.tsx
54350
- /* provided dependency */ var AnnotationsToggleV2_ = __webpack_require__(441)["Tl"];
54351
- function AnnotationsToggleV2_extends() { return AnnotationsToggleV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, AnnotationsToggleV2_extends.apply(null, arguments); }
54352
-
54353
-
54354
-
54355
-
54356
-
54357
-
54358
-
54359
- // The toolbar parts throw outside a Toolbar.Root, so surfaces without one (the media bar) use a standalone button.
54360
-
54361
- const TOGGLE_VALUE = 'annotations';
54362
- function AnnotationsToggleV2(props, ref) {
54363
- const {
54364
- annotationMode = AnnotationMode.NONE,
54365
- isExpanded,
54366
- modes,
54367
- onAnnotationModeClick = (noop_default()),
54368
- onAnnotationModeEscape = (noop_default()),
54369
- tooltipSide
54370
- } = props;
54371
- const [lastMode, setLastMode] = external_react_["default"].useState(null);
54372
- const isActive = annotationMode !== AnnotationMode.NONE;
54373
- const resumeMode = lastMode && modes.includes(lastMode) ? lastMode : modes[0];
54374
- external_react_["default"].useEffect(() => {
54375
- if (annotationMode !== AnnotationMode.NONE) {
54376
- setLastMode(annotationMode);
54377
- }
54378
- }, [annotationMode]);
54379
-
54380
- // Global event handlers
54381
- external_react_["default"].useEffect(() => {
54382
- const handleKeyDown = event => {
54383
- if (event.key !== 'Escape') {
54384
- return;
54385
- }
54386
- event.preventDefault();
54387
- event.stopPropagation();
54388
- onAnnotationModeEscape();
54389
- };
54390
- if (annotationMode !== AnnotationMode.NONE) {
54391
- document.addEventListener('keydown', handleKeyDown);
54392
- }
54393
- return () => {
54394
- document.removeEventListener('keydown', handleKeyDown);
54395
- };
54396
- }, [annotationMode, onAnnotationModeEscape]);
54397
- if (!resumeMode) {
54398
- return null;
54399
- }
54400
- const handleToggle = isPressed => {
54401
- onAnnotationModeClick({
54402
- mode: isPressed ? resumeMode : AnnotationMode.NONE
54403
- });
54404
- };
54405
- const toggleProps = {
54406
- ref,
54407
- 'aria-expanded': isExpanded ?? isActive,
54408
- 'aria-label': AnnotationsToggleV2_('annotation_tools'),
54409
- 'data-resin-target': 'annotations',
54410
- 'data-testid': 'bp-AnnotationsControls-toggleBtn',
54411
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__
54412
- };
54413
- const renderToggle = toggle => /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54414
- content: AnnotationsToggleV2_('annotation_tools'),
54415
- side: tooltipSide
54416
- }, toggle);
54417
- if (props.buttonType === 'icon') {
54418
- const {
54419
- className,
54420
- size,
54421
- variant
54422
- } = props;
54423
- return renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconToggleButton, AnnotationsToggleV2_extends({}, toggleProps, {
54424
- className: className,
54425
- onPressedChange: handleToggle,
54426
- pressed: isActive,
54427
- size: size,
54428
- variant: variant
54429
- })));
54430
- }
54431
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54432
- onValueChange: value => handleToggle(value.includes(TOGGLE_VALUE)),
54433
- type: "multiple",
54434
- value: isActive ? [TOGGLE_VALUE] : []
54435
- }, renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, AnnotationsToggleV2_extends({}, toggleProps, {
54436
- value: TOGGLE_VALUE
54437
- }))));
54438
- }
54439
- /* harmony default export */ const annotations_AnnotationsToggleV2 = (/*#__PURE__*/external_react_["default"].forwardRef(AnnotationsToggleV2));
54440
- ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.scss
54441
- // extracted by mini-css-extract-plugin
54442
-
54443
- ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.tsx
54444
- /* provided dependency */ var ColorPickerControlV2_ = __webpack_require__(441)["Tl"];
54445
-
54446
-
54447
-
54448
-
54449
-
54450
- const getColorLabels = () => ({
54451
- [AnnotationColor.BOX_BLUE]: ColorPickerControlV2_('drawing_color_blue'),
54452
- [AnnotationColor.GREEN_LIGHT]: ColorPickerControlV2_('drawing_color_green'),
54453
- [AnnotationColor.WATERMELON_RED]: ColorPickerControlV2_('drawing_color_red'),
54454
- [AnnotationColor.YELLORANGE]: ColorPickerControlV2_('drawing_color_orange'),
54455
- [AnnotationColor.YELLOW]: ColorPickerControlV2_('drawing_color_yellow'),
54456
- [AnnotationColor.GRIMACE]: ColorPickerControlV2_('drawing_color_purple')
54457
- });
54458
- function ColorPickerControlV2({
54459
- activeColor = __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__,
54460
- colors,
54461
- onColorSelect
54462
- }) {
54463
- const colorLabels = getColorLabels();
54464
- return /*#__PURE__*/external_react_["default"].createElement("div", {
54465
- className: "bp-ColorPickerControlV2",
54466
- "data-testid": "bp-color-picker-control"
54467
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Grid, {
54468
- "aria-label": ColorPickerControlV2_('drawing_color'),
54469
- columns: colors.length
54470
- }, colors.map(color => /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Option.ColorCircle, {
54471
- key: color,
54472
- active: color === activeColor,
54473
- "aria-label": colorLabels[color] || color,
54474
- className: "bp-ColorPickerControlV2-swatch",
54475
- color: color,
54476
- "data-resin-target": "colorSelect",
54477
- onClick: () => onColorSelect(color)
54478
- }))));
54479
- }
54480
55645
  ;// ./src/lib/viewers/media/VideoControlsV2.scss
54481
55646
  // extracted by mini-css-extract-plugin
54482
55647
 
@@ -54502,6 +55667,7 @@ function ColorPickerControlV2({
54502
55667
 
54503
55668
 
54504
55669
 
55670
+
54505
55671
 
54506
55672
 
54507
55673
  function VideoControlsV2({
@@ -54547,12 +55713,14 @@ function VideoControlsV2({
54547
55713
  onSubtitlesToggle,
54548
55714
  onTimeChange,
54549
55715
  onVolumeChange,
55716
+ onVrToggle,
54550
55717
  playNext,
54551
55718
  quality,
54552
55719
  rate,
54553
55720
  subtitle,
54554
55721
  subtitles = [],
54555
55722
  isBlueprintEnabled = false,
55723
+ isVrShown = false,
54556
55724
  videoAnnotationsEnabled = false,
54557
55725
  volume
54558
55726
  }) {
@@ -54709,6 +55877,12 @@ function VideoControlsV2({
54709
55877
  rate: rate,
54710
55878
  subtitle: subtitle,
54711
55879
  subtitles: subtitles
55880
+ }), onVrToggle && isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement(VrToggleControlV2, {
55881
+ buttonType: "icon",
55882
+ isVrShown: isVrShown,
55883
+ onVrToggle: onVrToggle,
55884
+ size: "large",
55885
+ variant: "on-dark"
54712
55886
  }), hasAnnotationsV2 && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement("div", {
54713
55887
  className: "bp-VideoControlsV2-divider"
54714
55888
  }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, {
@@ -56315,13 +57489,22 @@ class DashViewer extends media_VideoBaseViewer {
56315
57489
  this.setSubtitle(showSubtitles ? this.selectedSubtitle : constants/* SUBTITLES_OFF */.eA);
56316
57490
  }
56317
57491
 
57492
+ /**
57493
+ * Extra props a subclass passes to the V2 controls.
57494
+ *
57495
+ * @protected
57496
+ * @return {Object} props spread onto VideoControlsV2
57497
+ */
57498
+ getVideoControlsV2Props() {
57499
+ return {};
57500
+ }
57501
+
56318
57502
  /**
56319
57503
  * @inheritdoc
56320
57504
  */
56321
57505
  renderUI() {
56322
57506
  // Extra guard for `render` is needed because Video360Viewer extends DashViewer
56323
- // and creates and assigns the 360 control to this.controls which usually has
56324
- // been reserved for new React controls
57507
+ // and, without React controls, assigns its imperative 360 controls to this.controls
56325
57508
  if (!this.controls || !this.controls.render) {
56326
57509
  return;
56327
57510
  }
@@ -56383,11 +57566,11 @@ class DashViewer extends media_VideoBaseViewer {
56383
57566
  mediaEl: this.mediaEl
56384
57567
  }));
56385
57568
  }
56386
- if (this.isVideoPlayerV2) {
57569
+ if (this.isVideoControlsV2Enabled()) {
56387
57570
  this.controls.render(/*#__PURE__*/external_react_["default"].createElement(VideoControlsV2, DashViewer_extends({
56388
57571
  commentMarkers: this.commentMarkers,
56389
57572
  onCommentMarkerClick: this.handleCommentMarkerClick
56390
- }, sharedProps, {
57573
+ }, sharedProps, this.getVideoControlsV2Props(), {
56391
57574
  onPlayNextChange: this.setPlayNext,
56392
57575
  playNext: this.isPlayNextEnabled(),
56393
57576
  isBlueprintEnabled: this.isBlueprintMediaControlsEnabled()
@@ -56792,6 +57975,8 @@ class Video360Viewer extends media_DashViewer {
56792
57975
  Video360Viewer_defineProperty(this, "videoAsset", void 0);
56793
57976
  /** @property {Box3D.Components.SkyboxRenderer} - The component for rendering the video as 360 degree (on a skybox) */
56794
57977
  Video360Viewer_defineProperty(this, "skybox", void 0);
57978
+ /** @property {boolean} - Whether the React controls show the VR toggle */
57979
+ Video360Viewer_defineProperty(this, "isVrShown", false);
56795
57980
  this.create360Environment = this.create360Environment.bind(this);
56796
57981
  this.handleToggleVr = this.handleToggleVr.bind(this);
56797
57982
  this.handleShowVrButton = this.handleShowVrButton.bind(this);
@@ -56804,6 +57989,30 @@ class Video360Viewer extends media_DashViewer {
56804
57989
  return false;
56805
57990
  }
56806
57991
 
57992
+ /** @inheritdoc */
57993
+ isVideoControlsV2Enabled() {
57994
+ return this.useReactControls() && this.featureEnabled('videoPlayerV2.enabled') && this.isBlueprintMediaControlsEnabled();
57995
+ }
57996
+
57997
+ /** @inheritdoc */
57998
+ getVideoControlsV2Props() {
57999
+ return {
58000
+ isVrShown: this.isVrShown,
58001
+ onVrToggle: this.handleToggleVr
58002
+ };
58003
+ }
58004
+
58005
+ /**
58006
+ * The canvas shows the picture, so the container fills the viewer instead of fitting the video, which
58007
+ * Video360.scss sizes to place its captions. resize() clears the container size before calling this.
58008
+ *
58009
+ * @inheritdoc
58010
+ */
58011
+ setVideoDimensions() {
58012
+ this.mediaContainerEl.style.width = '100%';
58013
+ this.mediaContainerEl.style.height = '100%';
58014
+ }
58015
+
56807
58016
  /** @inheritdoc */
56808
58017
  setup() {
56809
58018
  if (this.isSetup) {
@@ -56814,18 +58023,25 @@ class Video360Viewer extends media_DashViewer {
56814
58023
  super.setup();
56815
58024
  this.destroyed = false;
56816
58025
 
56817
- // Hide video element
56818
- this.mediaEl.style.display = 'none';
56819
58026
  // Instead of keeping aspect ratio of video, we want full sized canvas to render to
56820
58027
  this.mediaContainerEl.style.width = '100%';
56821
58028
  this.mediaContainerEl.style.height = '100%';
56822
58029
  this.wrapperEl.classList.add(CSS_CLASS_VIDEO_360);
58030
+
58031
+ // The video is visible for its captions, but its own picture is flat; keep it out of casting and
58032
+ // picture-in-picture.
58033
+ this.mediaEl.setAttribute('disableremoteplayback', '');
58034
+ this.mediaEl.setAttribute('disablepictureinpicture', '');
58035
+ if (this.isVideoControlsV2Enabled()) {
58036
+ // Scopes the V2 control styles without the padded V2 container or stage
58037
+ this.wrapperEl.classList.add('bp-media--v2');
58038
+ }
56823
58039
  }
56824
58040
 
56825
58041
  /** @inheritdoc */
56826
58042
  destroy() {
56827
58043
  // Tear down 360 controls before super.destroy(), which destroys this.controls
56828
- // (DashViewer's React ControlsRoot when createControls() has not run yet).
58044
+ // (DashViewer's React ControlsRoot when the imperative 360 controls never replaced it).
56829
58045
  if (this.video360Controls) {
56830
58046
  this.destroyControls();
56831
58047
  this.video360Controls = null;
@@ -56896,6 +58112,10 @@ class Video360Viewer extends media_DashViewer {
56896
58112
  * @return {void}
56897
58113
  */
56898
58114
  createControls() {
58115
+ // The V2 React controls render the VR toggle and show themselves on pointer movement.
58116
+ if (this.isVideoControlsV2Enabled()) {
58117
+ return;
58118
+ }
56899
58119
  this.video360Controls = new video360_Video360Controls(this.mediaContainerEl);
56900
58120
  // Overwrite this.controls so DashViewer.renderUI() skips React controls.
56901
58121
  this.controls = this.video360Controls;
@@ -56975,6 +58195,8 @@ class Video360Viewer extends media_DashViewer {
56975
58195
  this.textureAsset = this.renderer.getBox3D().createTexture2d(VIDEO_TEXTURE_PROPS, 'VIDEO_TEX_ID');
56976
58196
  return new Promise(resolve => {
56977
58197
  this.textureAsset.load(() => {
58198
+ // Box3D hides the video it reads frames from; show it again so the browser draws its captions
58199
+ this.mediaEl.style.display = '';
56978
58200
  this.skybox.setAttribute('skyboxTexture', this.textureAsset.id);
56979
58201
  this.skybox.enable();
56980
58202
  this.renderer.getBox3D().on('mouseDown', this.onCanvasMouseDown);
@@ -57009,6 +58231,9 @@ class Video360Viewer extends media_DashViewer {
57009
58231
  handleShowVrButton() {
57010
58232
  if (this.video360Controls) {
57011
58233
  this.video360Controls.showVrButton();
58234
+ } else if (this.isVideoControlsV2Enabled()) {
58235
+ this.isVrShown = true;
58236
+ this.renderUI();
57012
58237
  }
57013
58238
  }
57014
58239
 
@@ -57134,571 +58359,198 @@ function IconGridView24_extends() { return IconGridView24_extends = Object.assig
57134
58359
  function IconGridView24(props) {
57135
58360
  return /*#__PURE__*/external_react_.createElement("svg", IconGridView24_extends({
57136
58361
  "data-testid": "IconGridView24",
57137
- focusable: "false",
57138
- height: "1em",
57139
- role: "img",
57140
- viewBox: "0 0 24 24",
57141
- width: "1em"
57142
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57143
- d: "M8 13a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2ZM6 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2ZM8 3a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2ZM6 5a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z",
57144
- fill: "#fff",
57145
- fillRule: "evenodd"
57146
- }));
57147
- }
57148
- /* harmony default export */ const icons_IconGridView24 = (IconGridView24);
57149
- ;// ./src/lib/viewers/controls/gallery/GalleryToggle.scss
57150
- // extracted by mini-css-extract-plugin
57151
-
57152
- ;// ./src/lib/viewers/controls/gallery/GalleryToggle.tsx
57153
- /* provided dependency */ var GalleryToggle_ = __webpack_require__(441)["Tl"];
57154
-
57155
-
57156
-
57157
- function GalleryToggle({
57158
- onGalleryToggle,
57159
- isGalleryOpen
57160
- }) {
57161
- if (!onGalleryToggle) {
57162
- return null;
57163
- }
57164
- return /*#__PURE__*/external_react_["default"].createElement("button", {
57165
- "aria-pressed": isGalleryOpen,
57166
- className: `bp-GalleryToggle${isGalleryOpen ? ' bp-is-active' : ''}`,
57167
- "data-resin-target": "galleryView",
57168
- onClick: onGalleryToggle,
57169
- title: GalleryToggle_('gallery_view'),
57170
- type: "button"
57171
- }, /*#__PURE__*/external_react_["default"].createElement(icons_IconGridView24, null));
57172
- }
57173
- ;// ./src/lib/viewers/controls/icons/IconNavMedium24.tsx
57174
- function IconNavMedium24_extends() { return IconNavMedium24_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, IconNavMedium24_extends.apply(null, arguments); }
57175
-
57176
- function IconNavMedium24(props) {
57177
- return /*#__PURE__*/external_react_.createElement("svg", IconNavMedium24_extends({
57178
- "data-testid": "IconNavMedium24",
57179
- focusable: "false",
57180
- height: "1em",
57181
- role: "img",
57182
- viewBox: "0 0 24 24",
57183
- width: "1em"
57184
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57185
- clipRule: "evenodd",
57186
- d: "M11 6h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8V6ZM9 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h4ZM5 18a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h4v12H5Zm0-9a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H6a1 1 0 0 1-1-1Zm1 2a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H6Z",
57187
- fill: "#fff",
57188
- fillRule: "evenodd"
57189
- }));
57190
- }
57191
- /* harmony default export */ const icons_IconNavMedium24 = (IconNavMedium24);
57192
- ;// ./src/lib/viewers/controls/icons/IconNavMediumFilled24.tsx
57193
- function IconNavMediumFilled24_extends() { return IconNavMediumFilled24_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, IconNavMediumFilled24_extends.apply(null, arguments); }
57194
-
57195
- function IconNavMediumFilled24(props) {
57196
- return /*#__PURE__*/external_react_.createElement("svg", IconNavMediumFilled24_extends({
57197
- "data-testid": "IconNavMediumFilled24",
57198
- fill: "none",
57199
- focusable: "false",
57200
- height: "1em",
57201
- role: "img",
57202
- viewBox: "0 0 24 24",
57203
- width: "1em"
57204
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57205
- clipRule: "evenodd",
57206
- d: "M6 4a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V8a4 4 0 0 0-4-4H6Zm0 4a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2H6Zm-1 4a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm13-6h-7v12h7a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2Z",
57207
- fill: "#fff",
57208
- fillRule: "evenodd"
57209
- }));
57210
- }
57211
- /* harmony default export */ const icons_IconNavMediumFilled24 = (IconNavMediumFilled24);
57212
- ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.scss
57213
- // extracted by mini-css-extract-plugin
57214
-
57215
- ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.tsx
57216
- /* provided dependency */ var ThumbnailsToggle_ = __webpack_require__(441)["Tl"];
57217
-
57218
-
57219
-
57220
-
57221
- function ThumbnailsToggle({
57222
- onThumbnailsToggle,
57223
- isThumbnailsOpen
57224
- }) {
57225
- if (!onThumbnailsToggle) {
57226
- return null;
57227
- }
57228
- return /*#__PURE__*/external_react_["default"].createElement("button", {
57229
- "aria-expanded": isThumbnailsOpen,
57230
- className: "bp-ThumbnailsToggle",
57231
- "data-resin-target": "thumbnails",
57232
- onClick: onThumbnailsToggle,
57233
- title: ThumbnailsToggle_('toggle_thumbnails'),
57234
- type: "button"
57235
- }, isThumbnailsOpen ? /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMediumFilled24, null) : /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMedium24, null));
57236
- }
57237
- ;// ./src/lib/viewers/doc/DocControls.tsx
57238
-
57239
-
57240
-
57241
-
57242
-
57243
-
57244
-
57245
-
57246
-
57247
-
57248
-
57249
-
57250
- function DocControls({
57251
- annotationColor,
57252
- annotationMode,
57253
- experiences,
57254
- hasDrawing,
57255
- hasGalleryZoom = false,
57256
- hasHighlight,
57257
- hasRegion,
57258
- isGalleryOpen,
57259
- isThumbnailsOpen,
57260
- maxScale,
57261
- minScale,
57262
- onAnnotationColorChange,
57263
- onAnnotationModeClick,
57264
- onAnnotationModeEscape,
57265
- onFindBarToggle,
57266
- onFullscreenToggle,
57267
- onGalleryToggle,
57268
- onPageChange,
57269
- onPageSubmit,
57270
- onRotateLeft,
57271
- onThumbnailsToggle,
57272
- onZoomIn,
57273
- onZoomOut,
57274
- pageCount,
57275
- pageNumber,
57276
- scale
57277
- }) {
57278
- return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
57279
- experiences: experiences
57280
- }, /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
57281
- isThumbnailsOpen: isThumbnailsOpen,
57282
- onThumbnailsToggle: onThumbnailsToggle
57283
- }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
57284
- onFindBarToggle: onFindBarToggle
57285
- })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
57286
- isDistinct: true
57287
- }, /*#__PURE__*/external_react_["default"].createElement(PageControls, {
57288
- onPageChange: onPageChange,
57289
- onPageSubmit: onPageSubmit,
57290
- pageCount: pageCount,
57291
- pageNumber: pageNumber
57292
- }))), (!isGalleryOpen || hasGalleryZoom) && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
57293
- isDistinct: true
57294
- }, /*#__PURE__*/external_react_["default"].createElement(ZoomControls, {
57295
- maxScale: maxScale,
57296
- minScale: minScale,
57297
- onZoomIn: onZoomIn,
57298
- onZoomOut: onZoomOut,
57299
- resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
57300
- resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
57301
- scale: scale
57302
- })), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
57303
- onRotateLeft: onRotateLeft
57304
- })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
57305
- isGalleryOpen: isGalleryOpen,
57306
- onGalleryToggle: onGalleryToggle
57307
- }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
57308
- onFullscreenToggle: onFullscreenToggle
57309
- }), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(AnnotationsControls, {
57310
- annotationColor: annotationColor,
57311
- annotationMode: annotationMode,
57312
- hasDrawing: hasDrawing,
57313
- hasHighlight: hasHighlight,
57314
- hasRegion: hasRegion,
57315
- onAnnotationModeClick: onAnnotationModeClick,
57316
- onAnnotationModeEscape: onAnnotationModeEscape
57317
- }))), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, /*#__PURE__*/external_react_["default"].createElement(DrawingControls, {
57318
- annotationColor: annotationColor,
57319
- annotationMode: annotationMode,
57320
- onAnnotationColorChange: onAnnotationColorChange
57321
- })));
57322
- }
57323
- ;// external "@box/blueprint-web-assets/icons/Medium/GridView"
57324
-
57325
- ;// external "@box/blueprint-web-assets/icons/Medium/Nav"
57326
-
57327
- ;// external "@box/blueprint-web-assets/icons/Medium/RotateLeft"
57328
-
57329
- ;// external "@box/blueprint-web-assets/icons/Medium/Search"
57330
-
57331
- ;// external "@box/blueprint-web-assets/icons/Medium/XMark"
57332
-
57333
- ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.scss
57334
- // extracted by mini-css-extract-plugin
57335
-
57336
- ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.tsx
57337
- /* provided dependency */ var AnnotationsExitButtonV2_ = __webpack_require__(441)["Tl"];
57338
-
57339
-
57340
-
57341
-
57342
- function AnnotationsExitButtonV2({
57343
- onClick
57344
- }) {
57345
- return /*#__PURE__*/external_react_["default"].createElement("span", {
57346
- className: "bp-AnnotationsControls-exitBtn"
57347
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57348
- content: AnnotationsExitButtonV2_('exit_annotations')
57349
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57350
- "aria-label": AnnotationsExitButtonV2_('exit_annotations'),
57351
- "data-resin-target": "exit",
57352
- "data-testid": "bp-annotations-controls-exit-btn",
57353
- onClick: onClick
57354
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57355
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__
57356
- }))));
57357
- }
57358
- ;// ./src/lib/viewers/controls/controls-bar/useControlsOverflow.ts
57359
-
57360
-
57361
-
57362
- const ALWAYS_OVERFLOW = 0;
57363
- // The space the mocks leave between the bar and the edges of the viewer
57364
- const EDGE_MARGIN = 40;
57365
- // One toolbar button, the estimate for a control or the overflow trigger before it has been measured
57366
- const DEFAULT_WIDTH = 32;
57367
- const isCollapsible = ({
57368
- menu,
57369
- priority
57370
- }) => !!menu && priority !== undefined;
57371
- function getOverflowIds(items, availableWidth, metrics) {
57372
- const {
57373
- chrome,
57374
- gap,
57375
- triggerWidth = DEFAULT_WIDTH,
57376
- widths
57377
- } = metrics;
57378
- const overflowIds = new Set(items.filter(item => isCollapsible(item) && item.priority === ALWAYS_OVERFLOW).map(({
57379
- id
57380
- }) => id));
57381
- const getBarWidth = () => {
57382
- const slots = items.filter(({
57383
- id
57384
- }) => !overflowIds.has(id)).map(({
57385
- id
57386
- }) => widths.get(id) ?? DEFAULT_WIDTH);
57387
- if (overflowIds.size) {
57388
- slots.push(triggerWidth);
57389
- }
57390
- return chrome + slots.reduce((total, width) => total + width, 0) + gap * Math.max(slots.length - 1, 0);
57391
- };
57392
- const priorities = items.filter(item => isCollapsible(item) && item.priority !== ALWAYS_OVERFLOW).map(({
57393
- priority
57394
- }) => priority).sort((a, b) => a - b);
57395
- Array.from(new Set(priorities)).every(priority => {
57396
- if (getBarWidth() <= availableWidth) {
57397
- return false;
57398
- }
57399
- items.filter(item => isCollapsible(item) && item.priority === priority).forEach(({
57400
- id
57401
- }) => overflowIds.add(id));
57402
- return true;
57403
- });
57404
- return overflowIds;
57405
- }
57406
- const getStyleWidth = (style, properties) => properties.reduce((total, property) => total + (parseFloat(style.getPropertyValue(property)) || 0), 0);
57407
- function useControlsOverflow(items) {
57408
- const barRef = external_react_["default"].useRef(null);
57409
- const metricsRef = external_react_["default"].useRef({
57410
- chrome: 0,
57411
- gap: 0,
57412
- widths: new Map()
57413
- });
57414
- const portalContainer = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n);
57415
- const [availableWidth, setAvailableWidth] = external_react_["default"].useState(Number.POSITIVE_INFINITY);
57416
- const [, forceUpdate] = external_react_["default"].useReducer(count => count + 1, 0);
57417
-
57418
- // A control can only be measured while it is on the bar, so each width is cached as it renders and
57419
- // reused to decide whether that control would fit again
57420
- external_react_["default"].useLayoutEffect(() => {
57421
- const bar = barRef.current;
57422
- if (!bar) {
57423
- return;
57424
- }
57425
- const metrics = metricsRef.current;
57426
- const style = window.getComputedStyle(bar);
57427
- const chrome = getStyleWidth(style, ['padding-left', 'padding-right', 'border-left-width', 'border-right-width']);
57428
- const gap = getStyleWidth(style, ['column-gap']);
57429
- let hasChanged = chrome !== metrics.chrome || gap !== metrics.gap;
57430
- metrics.chrome = chrome;
57431
- metrics.gap = gap;
57432
- Array.from(bar.children).forEach(child => {
57433
- const {
57434
- offsetWidth
57435
- } = child;
57436
- const {
57437
- overflowId,
57438
- overflowTrigger
57439
- } = child.dataset;
57440
- if (!offsetWidth) {
57441
- return;
57442
- }
57443
- if (overflowId && metrics.widths.get(overflowId) !== offsetWidth) {
57444
- metrics.widths.set(overflowId, offsetWidth);
57445
- hasChanged = true;
57446
- }
57447
- if (overflowTrigger !== undefined && metrics.triggerWidth !== offsetWidth) {
57448
- metrics.triggerWidth = offsetWidth;
57449
- hasChanged = true;
57450
- }
57451
- });
57452
- if (hasChanged) {
57453
- forceUpdate();
57454
- }
57455
- });
57456
-
57457
- // The bar renders nothing without items, so the viewer lookup reruns once it mounts
57458
- const hasItems = items.length > 0;
57459
-
57460
- // The controls root is centered and shrinks to fit the bar, so the space the bar can grow into is the
57461
- // viewer's. Fullscreen resizes the viewer too, which the observer picks up.
57462
- external_react_["default"].useLayoutEffect(() => {
57463
- const container = portalContainer ?? barRef.current?.closest(`.${constants/* CLASS_BOX_PREVIEW_CONTENT */.SG}`) ?? null;
57464
- if (!container) {
57465
- return undefined;
57466
- }
57467
- const updateAvailableWidth = () => {
57468
- const {
57469
- clientWidth
57470
- } = container;
57471
-
57472
- // A container that has not been laid out yet measures zero, which would collapse everything
57473
- setAvailableWidth(clientWidth > 0 ? clientWidth - EDGE_MARGIN : Number.POSITIVE_INFINITY);
57474
- };
57475
- updateAvailableWidth();
57476
- if (typeof ResizeObserver === 'undefined') {
57477
- return undefined;
57478
- }
57479
- const observer = new ResizeObserver(updateAvailableWidth);
57480
- observer.observe(container);
57481
- return () => observer.disconnect();
57482
- }, [hasItems, portalContainer]);
57483
- const overflowIds = getOverflowIds(items, availableWidth, metricsRef.current);
57484
- return {
57485
- barRef,
57486
- overflowItems: items.filter(({
57487
- id
57488
- }) => overflowIds.has(id)),
57489
- visibleItems: items.filter(({
57490
- id
57491
- }) => !overflowIds.has(id))
57492
- };
58362
+ focusable: "false",
58363
+ height: "1em",
58364
+ role: "img",
58365
+ viewBox: "0 0 24 24",
58366
+ width: "1em"
58367
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58368
+ d: "M8 13a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2ZM6 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2ZM8 3a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2ZM6 5a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z",
58369
+ fill: "#fff",
58370
+ fillRule: "evenodd"
58371
+ }));
57493
58372
  }
57494
- ;// external "@box/blueprint-web-assets/icons/Medium/EllipsisVertical"
57495
-
57496
- // EXTERNAL MODULE: ./src/lib/viewers/controls/tooltip/MenuTriggerTooltipV2.tsx
57497
- var MenuTriggerTooltipV2 = __webpack_require__(6014);
57498
- // EXTERNAL MODULE: ./src/lib/viewers/controls/settings/stopMenuKeyPropagation.ts
57499
- var stopMenuKeyPropagation = __webpack_require__(9646);
57500
- ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.scss
58373
+ /* harmony default export */ const icons_IconGridView24 = (IconGridView24);
58374
+ ;// ./src/lib/viewers/controls/gallery/GalleryToggle.scss
57501
58375
  // extracted by mini-css-extract-plugin
57502
58376
 
57503
- ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.tsx
57504
- /* provided dependency */ var ControlsOverflowMenuV2_ = __webpack_require__(441)["Tl"];
57505
- function ControlsOverflowMenuV2_extends() { return ControlsOverflowMenuV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsOverflowMenuV2_extends.apply(null, arguments); }
57506
-
57507
-
58377
+ ;// ./src/lib/viewers/controls/gallery/GalleryToggle.tsx
58378
+ /* provided dependency */ var GalleryToggle_ = __webpack_require__(441)["Tl"];
57508
58379
 
57509
58380
 
57510
58381
 
58382
+ function GalleryToggle({
58383
+ onGalleryToggle,
58384
+ isGalleryOpen
58385
+ }) {
58386
+ if (!onGalleryToggle) {
58387
+ return null;
58388
+ }
58389
+ return /*#__PURE__*/external_react_["default"].createElement("button", {
58390
+ "aria-pressed": isGalleryOpen,
58391
+ className: `bp-GalleryToggle${isGalleryOpen ? ' bp-is-active' : ''}`,
58392
+ "data-resin-target": "galleryView",
58393
+ onClick: onGalleryToggle,
58394
+ title: GalleryToggle_('gallery_view'),
58395
+ type: "button"
58396
+ }, /*#__PURE__*/external_react_["default"].createElement(icons_IconGridView24, null));
58397
+ }
58398
+ ;// ./src/lib/viewers/controls/icons/IconNavMedium24.tsx
58399
+ function IconNavMedium24_extends() { return IconNavMedium24_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, IconNavMedium24_extends.apply(null, arguments); }
57511
58400
 
58401
+ function IconNavMedium24(props) {
58402
+ return /*#__PURE__*/external_react_.createElement("svg", IconNavMedium24_extends({
58403
+ "data-testid": "IconNavMedium24",
58404
+ focusable: "false",
58405
+ height: "1em",
58406
+ role: "img",
58407
+ viewBox: "0 0 24 24",
58408
+ width: "1em"
58409
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58410
+ clipRule: "evenodd",
58411
+ d: "M11 6h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8V6ZM9 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h4ZM5 18a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h4v12H5Zm0-9a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H6a1 1 0 0 1-1-1Zm1 2a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H6Z",
58412
+ fill: "#fff",
58413
+ fillRule: "evenodd"
58414
+ }));
58415
+ }
58416
+ /* harmony default export */ const icons_IconNavMedium24 = (IconNavMedium24);
58417
+ ;// ./src/lib/viewers/controls/icons/IconNavMediumFilled24.tsx
58418
+ function IconNavMediumFilled24_extends() { return IconNavMediumFilled24_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, IconNavMediumFilled24_extends.apply(null, arguments); }
57512
58419
 
58420
+ function IconNavMediumFilled24(props) {
58421
+ return /*#__PURE__*/external_react_.createElement("svg", IconNavMediumFilled24_extends({
58422
+ "data-testid": "IconNavMediumFilled24",
58423
+ fill: "none",
58424
+ focusable: "false",
58425
+ height: "1em",
58426
+ role: "img",
58427
+ viewBox: "0 0 24 24",
58428
+ width: "1em"
58429
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58430
+ clipRule: "evenodd",
58431
+ d: "M6 4a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V8a4 4 0 0 0-4-4H6Zm0 4a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2H6Zm-1 4a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm13-6h-7v12h7a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2Z",
58432
+ fill: "#fff",
58433
+ fillRule: "evenodd"
58434
+ }));
58435
+ }
58436
+ /* harmony default export */ const icons_IconNavMediumFilled24 = (IconNavMediumFilled24);
58437
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.scss
58438
+ // extracted by mini-css-extract-plugin
57513
58439
 
57514
- // Handlers that return focus to the control that invoked them get the trigger, since the row unmounts with the menu
57515
- const ControlsOverflowTriggerContext = /*#__PURE__*/external_react_["default"].createContext({
57516
- current: null
57517
- });
58440
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.tsx
58441
+ /* provided dependency */ var ThumbnailsToggle_ = __webpack_require__(441)["Tl"];
57518
58442
 
57519
- // The menu portals out of the controls root, so it carries the root's Resin attributes itself
57520
- const getResinAttributes = element => {
57521
- const resinComponent = element?.closest('[data-resin-component]');
57522
- return resinComponent ? Object.fromEntries(Array.from(resinComponent.attributes).filter(({
57523
- name
57524
- }) => name.startsWith('data-resin-')).map(({
57525
- name,
57526
- value
57527
- }) => [name, value])) : {};
57528
- };
57529
- function ControlsOverflowToggle(props, ref) {
57530
- const isMenuOpen = props['aria-expanded'] === true || props['aria-expanded'] === 'true';
57531
- return /*#__PURE__*/external_react_["default"].createElement(MenuTriggerTooltipV2/* default */.A, {
57532
- content: ControlsOverflowMenuV2_('controls_more'),
57533
- isMenuOpen: isMenuOpen
57534
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, ControlsOverflowMenuV2_extends({
57535
- ref: ref,
57536
- "aria-label": ControlsOverflowMenuV2_('controls_more'),
57537
- "data-resin-target": "moreOptions",
57538
- "data-testid": "bp-ControlsBar-overflowBtn"
57539
- }, props), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57540
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__
57541
- })));
57542
- }
57543
- const ControlsOverflowToggleV2 = /*#__PURE__*/external_react_["default"].forwardRef(ControlsOverflowToggle);
57544
- function ControlsOverflowMenuV2({
57545
- items
57546
- }) {
57547
- const container = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n) ?? undefined;
57548
- const {
57549
- setIsForced
57550
- } = external_react_["default"].useContext(ControlsLayerContext);
57551
- const triggerRef = external_react_["default"].useRef(null);
57552
- const [isOpen, setIsOpen] = external_react_["default"].useState(false);
57553
- const [resinAttributes, setResinAttributes] = external_react_["default"].useState({});
57554
- const handleOpenChange = open => {
57555
- if (open) {
57556
- setResinAttributes(getResinAttributes(triggerRef.current));
57557
- }
57558
- setIsOpen(open);
57559
- };
57560
58443
 
57561
- // The menu sits outside the controls layer, which would otherwise hide the bar under the open menu
57562
- external_react_["default"].useEffect(() => {
57563
- if (!isOpen) {
57564
- return undefined;
57565
- }
57566
- setIsForced(true);
57567
- return () => setIsForced(false);
57568
- }, [isOpen, setIsForced]);
57569
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, {
57570
- modal: false,
57571
- onOpenChange: handleOpenChange,
57572
- open: isOpen
57573
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
57574
- ref: triggerRef,
57575
- asChild: true,
57576
- "data-overflow-ids": items.map(({
57577
- id
57578
- }) => id).join(' '),
57579
- "data-overflow-trigger": ""
57580
- }, /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowToggleV2, null)), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, ControlsOverflowMenuV2_extends({
57581
- align: "end",
57582
- className: "bp-ControlsOverflowMenuV2",
57583
- container: container,
57584
- "data-testid": "bp-ControlsBar-overflowMenu",
57585
- onEscapeKeyDown: stopMenuKeyPropagation/* stopEscapePropagation */.s,
57586
- onKeyDown: stopMenuKeyPropagation/* stopKeyPropagation */.a,
57587
- side: "top"
57588
- }, resinAttributes), /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowTriggerContext.Provider, {
57589
- value: triggerRef
57590
- }, items.map(({
57591
- id,
57592
- menu
57593
- }) => /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, {
57594
- key: id
57595
- }, menu)))));
57596
- }
57597
- ;// ./src/lib/viewers/controls/controls-bar/shortcuts.ts
57598
- /* provided dependency */ var shortcuts_ = __webpack_require__(441)["Tl"];
57599
58444
 
57600
- // iPads report a Mac user agent, and their keyboards have the command key too
57601
- const isApplePlatform = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
57602
58445
 
57603
- // Preview binds its shortcuts to both Cmd and Ctrl, so each platform is shown the modifier its keyboard labels
57604
- function getShortcut(key) {
57605
- return isApplePlatform() ? {
57606
- keys: `Meta+${key}`,
57607
- label: `⌘ + ${key}`
57608
- } : {
57609
- keys: `Control+${key}`,
57610
- label: (0,util/* replacePlaceholders */.Lb)(shortcuts_('controls_shortcut_ctrl'), [key])
57611
- };
58446
+ function ThumbnailsToggle({
58447
+ onThumbnailsToggle,
58448
+ isThumbnailsOpen
58449
+ }) {
58450
+ if (!onThumbnailsToggle) {
58451
+ return null;
58452
+ }
58453
+ return /*#__PURE__*/external_react_["default"].createElement("button", {
58454
+ "aria-expanded": isThumbnailsOpen,
58455
+ className: "bp-ThumbnailsToggle",
58456
+ "data-resin-target": "thumbnails",
58457
+ onClick: onThumbnailsToggle,
58458
+ title: ThumbnailsToggle_('toggle_thumbnails'),
58459
+ type: "button"
58460
+ }, isThumbnailsOpen ? /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMediumFilled24, null) : /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMedium24, null));
57612
58461
  }
57613
- ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.scss
57614
- // extracted by mini-css-extract-plugin
58462
+ ;// ./src/lib/viewers/doc/DocControls.tsx
57615
58463
 
57616
- ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.tsx
57617
- const ControlsMenuItemV2_excluded = ["bareKey", "icon", "keepOpen", "label", "onSelect", "shortcutKey"];
57618
- function ControlsMenuItemV2_extends() { return ControlsMenuItemV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ControlsMenuItemV2_extends.apply(null, arguments); }
57619
- function ControlsMenuItemV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsMenuItemV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
57620
- function ControlsMenuItemV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
57621
58464
 
57622
58465
 
57623
58466
 
57624
58467
 
57625
58468
 
57626
- // The menu form of a bar control. Toggles are plain rows whose label names the next action, since checkbox
57627
- // rows reserve space for a checkmark that the mocks do not have.
57628
- function ControlsMenuItemV2(_ref) {
57629
- let {
57630
- bareKey,
57631
- icon,
57632
- keepOpen,
57633
- label,
57634
- onSelect,
57635
- shortcutKey
57636
- } = _ref,
57637
- rest = ControlsMenuItemV2_objectWithoutProperties(_ref, ControlsMenuItemV2_excluded);
57638
- const triggerRef = external_react_["default"].useContext(ControlsOverflowTriggerContext);
57639
- let shortcut = null;
57640
- if (shortcutKey) {
57641
- shortcut = getShortcut(shortcutKey);
57642
- } else if (bareKey) {
57643
- shortcut = {
57644
- keys: bareKey,
57645
- label: bareKey
57646
- };
57647
- }
57648
- const handleSelect = event => {
57649
- if (keepOpen) {
57650
- event.preventDefault();
57651
- }
57652
- onSelect(triggerRef.current);
57653
- };
57654
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, ControlsMenuItemV2_extends({
57655
- "aria-keyshortcuts": shortcut?.keys,
57656
- onSelect: handleSelect
57657
- }, rest, {
57658
- className: "bp-ControlsMenuItemV2"
57659
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
57660
- icon: icon
57661
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
57662
- label: label
57663
- }), shortcut && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.EndElement, {
57664
- "aria-hidden": true
57665
- }, shortcut.label));
57666
- }
57667
- ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.scss
57668
- // extracted by mini-css-extract-plugin
57669
58469
 
57670
- ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.tsx
57671
58470
 
57672
58471
 
57673
58472
 
57674
58473
 
57675
58474
 
57676
- // Moves controls into an overflow menu as the viewer narrows. Bars that always show everything, like the
57677
- // annotations palette, use ControlsBarV2 directly.
57678
- function ResponsiveControlsBarV2({
57679
- items
58475
+ function DocControls({
58476
+ annotationColor,
58477
+ annotationMode,
58478
+ experiences,
58479
+ hasDrawing,
58480
+ hasGalleryZoom = false,
58481
+ hasHighlight,
58482
+ hasRegion,
58483
+ isGalleryOpen,
58484
+ isThumbnailsOpen,
58485
+ maxScale,
58486
+ minScale,
58487
+ onAnnotationColorChange,
58488
+ onAnnotationModeClick,
58489
+ onAnnotationModeEscape,
58490
+ onFindBarToggle,
58491
+ onFullscreenToggle,
58492
+ onGalleryToggle,
58493
+ onPageChange,
58494
+ onPageSubmit,
58495
+ onRotateLeft,
58496
+ onThumbnailsToggle,
58497
+ onZoomIn,
58498
+ onZoomOut,
58499
+ pageCount,
58500
+ pageNumber,
58501
+ scale
57680
58502
  }) {
57681
- const {
57682
- barRef,
57683
- overflowItems,
57684
- visibleItems
57685
- } = useControlsOverflow(items);
57686
- if (!items.length) {
57687
- return null;
57688
- }
57689
- return /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, {
57690
- ref: barRef
57691
- }, visibleItems.map(({
57692
- control,
57693
- id
57694
- }) => /*#__PURE__*/external_react_["default"].createElement("div", {
57695
- key: id,
57696
- className: "bp-ResponsiveControlsBarV2-item",
57697
- "data-overflow-id": id
57698
- }, control)), overflowItems.length > 0 && /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowMenuV2, {
57699
- items: overflowItems
57700
- }));
58503
+ return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
58504
+ experiences: experiences
58505
+ }, /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
58506
+ isThumbnailsOpen: isThumbnailsOpen,
58507
+ onThumbnailsToggle: onThumbnailsToggle
58508
+ }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
58509
+ onFindBarToggle: onFindBarToggle
58510
+ })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
58511
+ isDistinct: true
58512
+ }, /*#__PURE__*/external_react_["default"].createElement(PageControls, {
58513
+ onPageChange: onPageChange,
58514
+ onPageSubmit: onPageSubmit,
58515
+ pageCount: pageCount,
58516
+ pageNumber: pageNumber
58517
+ }))), (!isGalleryOpen || hasGalleryZoom) && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
58518
+ isDistinct: true
58519
+ }, /*#__PURE__*/external_react_["default"].createElement(ZoomControls, {
58520
+ maxScale: maxScale,
58521
+ minScale: minScale,
58522
+ onZoomIn: onZoomIn,
58523
+ onZoomOut: onZoomOut,
58524
+ resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
58525
+ resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
58526
+ scale: scale
58527
+ })), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
58528
+ onRotateLeft: onRotateLeft
58529
+ })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
58530
+ isGalleryOpen: isGalleryOpen,
58531
+ onGalleryToggle: onGalleryToggle
58532
+ }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
58533
+ onFullscreenToggle: onFullscreenToggle
58534
+ }), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(AnnotationsControls, {
58535
+ annotationColor: annotationColor,
58536
+ annotationMode: annotationMode,
58537
+ hasDrawing: hasDrawing,
58538
+ hasHighlight: hasHighlight,
58539
+ hasRegion: hasRegion,
58540
+ onAnnotationModeClick: onAnnotationModeClick,
58541
+ onAnnotationModeEscape: onAnnotationModeEscape
58542
+ }))), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, /*#__PURE__*/external_react_["default"].createElement(DrawingControls, {
58543
+ annotationColor: annotationColor,
58544
+ annotationMode: annotationMode,
58545
+ onAnnotationColorChange: onAnnotationColorChange
58546
+ })));
57701
58547
  }
58548
+ ;// external "@box/blueprint-web-assets/icons/Medium/GridView"
58549
+
58550
+ ;// external "@box/blueprint-web-assets/icons/Medium/Nav"
58551
+
58552
+ ;// external "@box/blueprint-web-assets/icons/Medium/Search"
58553
+
57702
58554
  ;// ./src/lib/viewers/controls/findbar/FindBarToggleV2.tsx
57703
58555
  /* provided dependency */ var FindBarToggleV2_ = __webpack_require__(441)["Tl"];
57704
58556
 
@@ -57749,176 +58601,6 @@ function GalleryToggleV2({
57749
58601
  value: "gallery"
57750
58602
  })));
57751
58603
  }
57752
- ;// external "@box/blueprint-web-assets/icons/Medium/ChevronDown"
57753
-
57754
- ;// external "@box/blueprint-web-assets/icons/Medium/ChevronUp"
57755
-
57756
- ;// ./src/lib/viewers/controls/page/PageControlsFormV2.scss
57757
- // extracted by mini-css-extract-plugin
57758
-
57759
- ;// ./src/lib/viewers/controls/page/PageControlsFormV2.tsx
57760
- /* provided dependency */ var PageControlsFormV2_ = __webpack_require__(441)["Tl"];
57761
-
57762
-
57763
-
57764
-
57765
-
57766
- function PageControlsFormV2({
57767
- onPageSubmit,
57768
- pageNumber,
57769
- pageCount
57770
- }) {
57771
- const [isInputShown, setIsInputShown] = external_react_["default"].useState(false);
57772
- // A string because Toolbar.Input only supports text types, so a parsed number would show "NaN" once cleared
57773
- const [inputValue, setInputValue] = external_react_["default"].useState(pageNumber.toString());
57774
- const buttonElRef = external_react_["default"].useRef(null);
57775
- const inputElRef = external_react_["default"].useRef(null);
57776
- const isRetryRef = external_react_["default"].useRef(false);
57777
- const setPage = (allowRetry = false) => {
57778
- const newPageNumber = Number(inputValue);
57779
- if (Number.isInteger(newPageNumber) && newPageNumber >= 1 && newPageNumber <= pageCount && newPageNumber !== pageNumber) {
57780
- onPageSubmit(newPageNumber);
57781
- } else {
57782
- setInputValue(pageNumber.toString()); // Reset the invalid input value to the current page
57783
-
57784
- if (allowRetry) {
57785
- isRetryRef.current = true;
57786
- }
57787
- }
57788
- setIsInputShown(false);
57789
- };
57790
- const handleNumInputChange = event => {
57791
- setInputValue(event.target.value);
57792
- };
57793
- const handleNumInputBlur = () => {
57794
- setPage();
57795
- };
57796
- const handleNumInputKeyDown = event => {
57797
- const key = (0,util/* decodeKeydown */.wU)(event);
57798
- switch (key) {
57799
- case ENTER:
57800
- event.stopPropagation();
57801
- event.preventDefault();
57802
- setPage(true);
57803
- break;
57804
- case ESCAPE:
57805
- event.stopPropagation();
57806
- event.preventDefault();
57807
- isRetryRef.current = true;
57808
- setIsInputShown(false);
57809
- setInputValue(pageNumber.toString());
57810
- break;
57811
- default:
57812
- break;
57813
- }
57814
- };
57815
- external_react_["default"].useEffect(() => {
57816
- setInputValue(pageNumber.toString()); // Keep internal state in sync with prop as it changes
57817
- }, [pageNumber]);
57818
- external_react_["default"].useLayoutEffect(() => {
57819
- if (inputElRef.current && isInputShown) {
57820
- inputElRef.current.select();
57821
- }
57822
- if (buttonElRef.current && !isInputShown) {
57823
- if (isRetryRef.current) {
57824
- buttonElRef.current.focus();
57825
- }
57826
- isRetryRef.current = false;
57827
- }
57828
- }, [isInputShown]);
57829
- return /*#__PURE__*/external_react_["default"].createElement("div", {
57830
- className: "bp-PageControlsFormV2",
57831
- "data-testid": "bp-PageControlsForm"
57832
- }, isInputShown ? /*#__PURE__*/external_react_["default"].createElement("div", {
57833
- className: "bp-PageControlsFormV2-input"
57834
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Input, {
57835
- ref: inputElRef,
57836
- "aria-label": PageControlsFormV2_('enter_page_num'),
57837
- "data-resin-target": "pageNumberInput",
57838
- "data-testid": "bp-PageControlsForm-input",
57839
- inputMode: "numeric",
57840
- onBlur: handleNumInputBlur,
57841
- onChange: handleNumInputChange,
57842
- onKeyDown: handleNumInputKeyDown,
57843
- pattern: "[0-9]*",
57844
- size: 3,
57845
- value: inputValue
57846
- })) : /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57847
- content: PageControlsFormV2_('enter_page_num')
57848
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57849
- ref: buttonElRef,
57850
- "data-resin-target": "pageNumberOpen",
57851
- "data-testid": "bp-PageControlsForm-button",
57852
- disabled: pageCount <= 1,
57853
- onClick: () => setIsInputShown(true)
57854
- }, /*#__PURE__*/external_react_["default"].createElement("span", {
57855
- className: "bp-PageControlsFormV2-button-label",
57856
- "data-testid": "bp-PageControlsForm-button-label"
57857
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
57858
- as: "span",
57859
- color: "textOnDarkDefault"
57860
- }, `${pageNumber} / ${pageCount}`)))));
57861
- }
57862
- ;// ./src/lib/viewers/controls/page/PageControlsV2.tsx
57863
- /* provided dependency */ var PageControlsV2_ = __webpack_require__(441)["Tl"];
57864
-
57865
-
57866
-
57867
-
57868
-
57869
- function PageControlsV2({
57870
- onPageChange,
57871
- onPageSubmit,
57872
- pageCount,
57873
- pageNumber
57874
- }) {
57875
- if (pageCount <= 1) {
57876
- return null;
57877
- }
57878
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57879
- content: PageControlsV2_('previous_page')
57880
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57881
- "aria-label": PageControlsV2_('previous_page'),
57882
- "data-resin-target": "pagePrevious",
57883
- "data-testid": "bp-PageControls-previous",
57884
- disabled: pageNumber === 1,
57885
- onClick: () => onPageChange(pageNumber - 1)
57886
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57887
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__
57888
- }))), /*#__PURE__*/external_react_["default"].createElement(PageControlsFormV2, {
57889
- onPageSubmit: onPageSubmit,
57890
- pageCount: pageCount,
57891
- pageNumber: pageNumber
57892
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57893
- content: PageControlsV2_('next_page')
57894
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57895
- "aria-label": PageControlsV2_('next_page'),
57896
- "data-resin-target": "pageNext",
57897
- "data-testid": "bp-PageControls-next",
57898
- disabled: pageNumber === pageCount,
57899
- onClick: () => onPageChange(pageNumber + 1)
57900
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57901
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__
57902
- }))));
57903
- }
57904
- ;// ./src/lib/viewers/controls/rotate/RotateControlV2.tsx
57905
- /* provided dependency */ var RotateControlV2_ = __webpack_require__(441)["Tl"];
57906
-
57907
-
57908
-
57909
- function RotateControlV2({
57910
- onRotateLeft
57911
- }) {
57912
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57913
- content: RotateControlV2_('rotate_left')
57914
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57915
- "aria-label": RotateControlV2_('rotate_left'),
57916
- "data-resin-target": "rotate",
57917
- onClick: onRotateLeft
57918
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57919
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__
57920
- })));
57921
- }
57922
58604
  ;// external "@box/blueprint-web-assets/icons/MediumFilled/Nav"
57923
58605
 
57924
58606
  ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggleV2.scss
@@ -57972,64 +58654,6 @@ function useMediaQuery(query) {
57972
58654
  }, [query]);
57973
58655
  return matches;
57974
58656
  }
57975
- ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.scss
57976
- // extracted by mini-css-extract-plugin
57977
-
57978
- ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.tsx
57979
- /* provided dependency */ var ZoomMenuItemsV2_ = __webpack_require__(441)["Tl"];
57980
-
57981
-
57982
-
57983
-
57984
-
57985
-
57986
-
57987
-
57988
-
57989
- // The overflow menu form of the zoom controls: the current scale, then zoom in and zoom out
57990
- function ZoomMenuItemsV2({
57991
- maxScale,
57992
- minScale,
57993
- onZoomIn,
57994
- onZoomOut,
57995
- resinTargetZoomIn = 'zoomIn',
57996
- resinTargetZoomOut = 'zoomOut',
57997
- scale
57998
- }) {
57999
- const {
58000
- canZoomIn,
58001
- canZoomOut,
58002
- currentScale
58003
- } = getZoomState({
58004
- maxScale,
58005
- minScale,
58006
- scale
58007
- });
58008
- const scaleLabel = (0,util/* replacePlaceholders */.Lb)(ZoomMenuItemsV2_('controls_zoom_scale'), [`${Math.round(currentScale * 100)}%`]);
58009
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
58010
- as: "div",
58011
- className: "bp-ZoomMenuItemsV2-scale",
58012
- color: "textOnLightSecondary",
58013
- "data-testid": "bp-ZoomMenuItems-scale",
58014
- variant: "caption"
58015
- }, scaleLabel), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58016
- "data-resin-target": resinTargetZoomIn,
58017
- "data-testid": "bp-ZoomControls-in-menuItem",
58018
- disabled: !canZoomIn,
58019
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__,
58020
- keepOpen: true,
58021
- label: ZoomMenuItemsV2_('zoom_in'),
58022
- onSelect: () => onZoomIn()
58023
- }), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58024
- "data-resin-target": resinTargetZoomOut,
58025
- "data-testid": "bp-ZoomControls-out-menuItem",
58026
- disabled: !canZoomOut,
58027
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__,
58028
- keepOpen: true,
58029
- label: ZoomMenuItemsV2_('zoom_out'),
58030
- onSelect: () => onZoomOut()
58031
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null));
58032
- }
58033
58657
  ;// ./src/lib/viewers/doc/DocControlsV2.tsx
58034
58658
  /* provided dependency */ var DocControlsV2_ = __webpack_require__(441)["Tl"];
58035
58659
 
@@ -58047,11 +58671,6 @@ function ZoomMenuItemsV2({
58047
58671
 
58048
58672
 
58049
58673
 
58050
-
58051
-
58052
-
58053
-
58054
-
58055
58674
 
58056
58675
 
58057
58676
 
@@ -58064,7 +58683,7 @@ const THUMBNAILS_MEDIA_QUERY = '(min-width: 768px)';
58064
58683
  // open. Then the grid toggle is the button itself, and nothing else collapses into a more options menu.
58065
58684
  // Rotate collapses next, then thumbnails and fullscreen together, then zoom. Page and the markup trigger
58066
58685
  // have no menu form and never collapse.
58067
- const PRIORITY = {
58686
+ const DocControlsV2_PRIORITY = {
58068
58687
  find: ALWAYS_OVERFLOW,
58069
58688
  fullscreen: 2,
58070
58689
  gallery: ALWAYS_OVERFLOW,
@@ -58100,30 +58719,14 @@ function DocControlsV2({
58100
58719
  pageNumber,
58101
58720
  scale
58102
58721
  }) {
58103
- const annotationsToggleRef = external_react_["default"].useRef(null);
58104
58722
  const isFullscreen = useFullscreen();
58105
58723
  const canShowThumbnails = useMediaQuery(THUMBNAILS_MEDIA_QUERY);
58106
-
58107
- // Listed in the palette's button order, which is also the order the toggle falls back to
58108
- const annotationModes = [];
58109
- if (!isFullscreen) {
58110
- if (hasRegion) {
58111
- annotationModes.push(AnnotationMode.REGION);
58112
- }
58113
- if (hasHighlight) {
58114
- annotationModes.push(AnnotationMode.HIGHLIGHT);
58115
- }
58116
- if (hasDrawing) {
58117
- annotationModes.push(AnnotationMode.DRAWING);
58118
- }
58119
- }
58724
+ const annotationModes = useAnnotationModes({
58725
+ hasDrawing,
58726
+ hasHighlight,
58727
+ hasRegion
58728
+ });
58120
58729
  const hasAnnotations = !isGalleryOpen && annotationModes.length > 0;
58121
- const handleAnnotationsExit = () => {
58122
- annotationsToggleRef.current?.focus();
58123
- onAnnotationModeClick({
58124
- mode: AnnotationMode.NONE
58125
- });
58126
- };
58127
58730
  const zoomProps = {
58128
58731
  maxScale,
58129
58732
  minScale,
@@ -58148,7 +58751,7 @@ function DocControlsV2({
58148
58751
  label: isThumbnailsOpen ? DocControlsV2_('controls_hide_thumbnails') : DocControlsV2_('controls_show_thumbnails'),
58149
58752
  onSelect: () => onThumbnailsToggle()
58150
58753
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null)),
58151
- priority: PRIORITY.thumbnails
58754
+ priority: DocControlsV2_PRIORITY.thumbnails
58152
58755
  }, !isGalleryOpen && pageCount > 1 && {
58153
58756
  control: /*#__PURE__*/external_react_["default"].createElement(PageControlsV2, {
58154
58757
  onPageChange: onPageChange,
@@ -58161,7 +58764,7 @@ function DocControlsV2({
58161
58764
  control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
58162
58765
  id: 'zoom',
58163
58766
  menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
58164
- priority: isGalleryOpen ? undefined : PRIORITY.zoom
58767
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.zoom
58165
58768
  }, !isGalleryOpen && onFindBarToggle && {
58166
58769
  control: /*#__PURE__*/external_react_["default"].createElement(FindBarToggleV2, {
58167
58770
  onFindBarToggle: onFindBarToggle
@@ -58174,20 +58777,17 @@ function DocControlsV2({
58174
58777
  onSelect: onFindBarToggle,
58175
58778
  shortcutKey: "F"
58176
58779
  }),
58177
- priority: PRIORITY.find
58780
+ priority: DocControlsV2_PRIORITY.find
58178
58781
  }, !isGalleryOpen && onRotateLeft && {
58179
58782
  control: /*#__PURE__*/external_react_["default"].createElement(RotateControlV2, {
58180
58783
  onRotateLeft: onRotateLeft
58181
58784
  }),
58182
58785
  id: 'rotate',
58183
- menu: /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58184
- "data-resin-target": "rotate",
58185
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__,
58186
- bareKey: "R",
58786
+ menu: /*#__PURE__*/external_react_["default"].createElement(RotateMenuItemV2, {
58187
58787
  label: DocControlsV2_('controls_rotate_document'),
58188
- onSelect: () => onRotateLeft()
58788
+ onRotateLeft: onRotateLeft
58189
58789
  }),
58190
- priority: PRIORITY.rotate
58790
+ priority: DocControlsV2_PRIORITY.rotate
58191
58791
  }, onGalleryToggle && {
58192
58792
  control: /*#__PURE__*/external_react_["default"].createElement(GalleryToggleV2, {
58193
58793
  isGalleryOpen: isGalleryOpen,
@@ -58200,47 +58800,36 @@ function DocControlsV2({
58200
58800
  label: DocControlsV2_('controls_view_as_grid'),
58201
58801
  onSelect: () => onGalleryToggle()
58202
58802
  }),
58203
- priority: isGalleryOpen ? undefined : PRIORITY.gallery
58803
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.gallery
58204
58804
  }, {
58205
58805
  control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
58206
58806
  onFullscreenToggle: onFullscreenToggle
58207
58807
  }),
58208
58808
  id: 'fullscreen',
58209
- menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58210
- "data-resin-target": "fullscreen",
58211
- icon: isFullscreen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__,
58212
- bareKey: "F",
58213
- label: isFullscreen ? DocControlsV2_('exit_fullscreen') : DocControlsV2_('enter_fullscreen'),
58214
- onSelect: trigger => onFullscreenToggle(!isFullscreen, trigger)
58809
+ menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
58810
+ onFullscreenToggle: onFullscreenToggle
58215
58811
  }),
58216
- priority: isGalleryOpen ? undefined : PRIORITY.fullscreen
58812
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.fullscreen
58217
58813
  }, hasAnnotations && {
58218
- control: /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), /*#__PURE__*/external_react_["default"].createElement(AnnotationsExitButtonV2, {
58219
- onClick: handleAnnotationsExit
58220
- }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, {
58221
- ref: annotationsToggleRef,
58814
+ control: /*#__PURE__*/external_react_["default"].createElement(AnnotationsControlsV2, {
58222
58815
  annotationMode: annotationMode,
58223
58816
  modes: annotationModes,
58224
58817
  onAnnotationModeClick: onAnnotationModeClick,
58225
58818
  onAnnotationModeEscape: onAnnotationModeEscape
58226
- })),
58819
+ }),
58227
58820
  id: 'annotations'
58228
58821
  }];
58229
58822
  return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
58230
58823
  experiences: experiences
58231
58824
  }, /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
58232
58825
  items: items.filter(item => !!item)
58233
- }), hasAnnotations && annotationMode !== AnnotationMode.NONE && /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2, null, /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Modes, {
58826
+ }), hasAnnotations && /*#__PURE__*/external_react_["default"].createElement(AnnotationsPaletteControlsV2, {
58827
+ annotationColor: annotationColor,
58234
58828
  annotationMode: annotationMode,
58829
+ modes: annotationModes,
58830
+ onAnnotationColorChange: onAnnotationColorChange,
58235
58831
  onAnnotationModeClick: onAnnotationModeClick
58236
- }, annotationModes.map(mode => /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Mode, {
58237
- key: mode,
58238
- value: mode
58239
- }))), annotationMode === AnnotationMode.DRAWING && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), /*#__PURE__*/external_react_["default"].createElement(ColorPickerControlV2, {
58240
- activeColor: annotationColor,
58241
- colors: ANNOTATION_COLORS,
58242
- onColorSelect: onAnnotationColorChange
58243
- }))));
58832
+ }));
58244
58833
  }
58245
58834
  ;// ./src/lib/icons/search.svg
58246
58835
  const search_namespaceObject = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 15 14\" focusable=\"false\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M-2-3h20v20H-2z\"/>\n <path class=\"icon\" fill=\"#FFF\" d=\"M6.931 0a5.994 5.994 0 0 1 4.907 9.438l2.806 2.807a1 1 0 0 1 0 1.415l-.047.047a1 1 0 0 1-1.414 0L10.375 10.9A5.994 5.994 0 1 1 6.931 0zm0 1.998a3.996 3.996 0 1 0 0 7.992 3.996 3.996 0 0 0 0-7.992z\"/>\n </g>\n</svg>\n";
@@ -58675,6 +59264,341 @@ class DocFindBar extends (events_default()) {
58675
59264
  }
58676
59265
  }
58677
59266
  /* harmony default export */ const doc_DocFindBar = (DocFindBar);
59267
+ ;// external "@box/blueprint-web-assets/icons/Fill"
59268
+
59269
+ ;// ./src/lib/viewers/doc/DocFindBarV2.scss
59270
+ // extracted by mini-css-extract-plugin
59271
+
59272
+ ;// ./src/lib/viewers/doc/DocFindBarV2.tsx
59273
+ /* provided dependency */ var DocFindBarV2_ = __webpack_require__(441)["Tl"];
59274
+ function DocFindBarV2_extends() { return DocFindBarV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, DocFindBarV2_extends.apply(null, arguments); }
59275
+ function DocFindBarV2_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
59276
+ function DocFindBarV2_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? DocFindBarV2_ownKeys(Object(t), !0).forEach(function (r) { DocFindBarV2_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : DocFindBarV2_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
59277
+ function DocFindBarV2_defineProperty(e, r, t) { return (r = DocFindBarV2_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
59278
+ function DocFindBarV2_toPropertyKey(t) { var i = DocFindBarV2_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
59279
+ function DocFindBarV2_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
59280
+
59281
+
59282
+
59283
+
59284
+
59285
+
59286
+
59287
+
59288
+
59289
+
59290
+
59291
+
59292
+
59293
+
59294
+
59295
+
59296
+ // Mirrors pdf.js FindState
59297
+ const FindState = {
59298
+ FOUND: 0,
59299
+ NOT_FOUND: 1,
59300
+ WRAPPED: 2,
59301
+ PENDING: 3
59302
+ };
59303
+ const canNavigateMatches = (query, isNotFound) => !!query && !isNotFound;
59304
+ const NO_MATCHES = {
59305
+ current: 0,
59306
+ total: 0
59307
+ };
59308
+ const formatMatchesCount = ({
59309
+ current,
59310
+ total
59311
+ }) => (0,util/* replacePlaceholders */.Lb)(DocFindBarV2_('find_match_count'), [String(current), String(total)]);
59312
+ function DocFindBarV2({
59313
+ inputRef,
59314
+ isNotFound,
59315
+ matchesCount,
59316
+ nextButtonRef,
59317
+ onClose,
59318
+ onFindNext,
59319
+ onFindPrevious,
59320
+ onQueryChange,
59321
+ previousButtonRef,
59322
+ query
59323
+ }) {
59324
+ const canNavigate = canNavigateMatches(query, isNotFound);
59325
+ const hasMatches = !!matchesCount && matchesCount.total > 0;
59326
+ let displayedCount = null;
59327
+ if (hasMatches) {
59328
+ displayedCount = matchesCount;
59329
+ } else if (query && isNotFound) {
59330
+ displayedCount = NO_MATCHES;
59331
+ }
59332
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
59333
+ as: "label",
59334
+ className: classnames_default()('bp-DocFindBarV2-field', {
59335
+ 'bp-DocFindBarV2-field--filled': !!query
59336
+ }),
59337
+ variant: "bodyDefault"
59338
+ }, /*#__PURE__*/external_react_["default"].createElement(__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Fill_15c08185_Search__, {
59339
+ "aria-hidden": true,
59340
+ className: "bp-DocFindBarV2-searchIcon",
59341
+ color: tokens_.bpIconIconOnLightSecondary
59342
+ }), /*#__PURE__*/external_react_["default"].createElement("input", {
59343
+ ref: inputRef,
59344
+ "aria-label": DocFindBarV2_('find_label'),
59345
+ className: "bp-DocFindBarV2-input",
59346
+ enterKeyHint: "search",
59347
+ onChange: ({
59348
+ currentTarget
59349
+ }) => onQueryChange(currentTarget.value),
59350
+ placeholder: DocFindBarV2_('find_placeholder'),
59351
+ role: "searchbox",
59352
+ value: query
59353
+ }), /*#__PURE__*/external_react_["default"].createElement("span", {
59354
+ className: "bp-DocFindBarV2-count",
59355
+ role: "status"
59356
+ }, displayedCount && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
59357
+ as: "span",
59358
+ color: "textOnLightSecondary",
59359
+ "data-testid": "bp-DocFindBarV2-count",
59360
+ variant: "bodyDefault"
59361
+ }, /*#__PURE__*/external_react_["default"].createElement(TabularDigits/* default */.Ay, null, formatMatchesCount(displayedCount))))), /*#__PURE__*/external_react_["default"].createElement("div", {
59362
+ className: "bp-DocFindBarV2-actions"
59363
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59364
+ content: DocFindBarV2_('find_previous')
59365
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59366
+ ref: previousButtonRef,
59367
+ "aria-label": DocFindBarV2_('find_previous'),
59368
+ "data-target-id": "DocFindBarV2-previous",
59369
+ disabled: !canNavigate,
59370
+ icon: Medium_.ChevronUp,
59371
+ onClick: onFindPrevious
59372
+ })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59373
+ content: DocFindBarV2_('find_next')
59374
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59375
+ ref: nextButtonRef,
59376
+ "aria-label": DocFindBarV2_('find_next'),
59377
+ "data-target-id": "DocFindBarV2-next",
59378
+ disabled: !canNavigate,
59379
+ icon: Medium_.ChevronDown,
59380
+ onClick: onFindNext
59381
+ })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59382
+ content: DocFindBarV2_('find_close')
59383
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59384
+ "aria-label": DocFindBarV2_('find_close'),
59385
+ "data-target-id": "DocFindBarV2-close",
59386
+ icon: Medium_.XMark,
59387
+ onClick: onClose
59388
+ }))));
59389
+ }
59390
+ class DocFindBarV2Root extends (events_default()) {
59391
+ constructor(containerEl, findController, eventBus) {
59392
+ super();
59393
+ DocFindBarV2_defineProperty(this, "containerEl", void 0);
59394
+ DocFindBarV2_defineProperty(this, "eventBus", void 0);
59395
+ DocFindBarV2_defineProperty(this, "findBarEl", void 0);
59396
+ DocFindBarV2_defineProperty(this, "findController", void 0);
59397
+ DocFindBarV2_defineProperty(this, "inputRef", /*#__PURE__*/(0,external_react_.createRef)());
59398
+ DocFindBarV2_defineProperty(this, "isDestroyed", false);
59399
+ DocFindBarV2_defineProperty(this, "nextButtonRef", /*#__PURE__*/(0,external_react_.createRef)());
59400
+ DocFindBarV2_defineProperty(this, "opened", false);
59401
+ DocFindBarV2_defineProperty(this, "prevSearchQuery", '');
59402
+ DocFindBarV2_defineProperty(this, "previousButtonRef", /*#__PURE__*/(0,external_react_.createRef)());
59403
+ DocFindBarV2_defineProperty(this, "root", void 0);
59404
+ DocFindBarV2_defineProperty(this, "state", {
59405
+ isNotFound: false,
59406
+ matchesCount: null,
59407
+ query: ''
59408
+ });
59409
+ DocFindBarV2_defineProperty(this, "findFieldHandler", () => {
59410
+ this.dispatchFindEvent('find');
59411
+ });
59412
+ DocFindBarV2_defineProperty(this, "close", () => {
59413
+ this.prevSearchQuery = this.state.query;
59414
+ this.setFindFieldElValue('');
59415
+ this.findFieldHandler();
59416
+ if (!this.opened) {
59417
+ return;
59418
+ }
59419
+ this.emit('close');
59420
+ this.opened = false;
59421
+ this.findBarEl.classList.add(constants/* CLASS_HIDDEN */.zX);
59422
+ });
59423
+ DocFindBarV2_defineProperty(this, "handleFindBarKeyDown", event => {
59424
+ const key = (0,util/* decodeKeydown */.wU)(event).toLowerCase();
59425
+ switch (key) {
59426
+ case 'enter':
59427
+ case 'shift+enter':
59428
+ {
59429
+ if (event.isComposing) {
59430
+ break;
59431
+ }
59432
+ const navigationTargets = [this.inputRef.current, this.nextButtonRef.current, this.previousButtonRef.current];
59433
+ if (!navigationTargets.some(el => el === event.target)) {
59434
+ break;
59435
+ }
59436
+ const findPrevious = key === 'shift+enter';
59437
+ const buttonRef = findPrevious ? this.previousButtonRef : this.nextButtonRef;
59438
+ event.preventDefault();
59439
+ buttonRef.current?.focus();
59440
+ this.findAgain(findPrevious);
59441
+ break;
59442
+ }
59443
+ case 'escape':
59444
+ case 'esc':
59445
+ if (!this.opened) {
59446
+ return;
59447
+ }
59448
+ this.close();
59449
+ event.stopPropagation();
59450
+ event.preventDefault();
59451
+ break;
59452
+ case 'shift++':
59453
+ case 'shift+_':
59454
+ case '[':
59455
+ case ']':
59456
+ event.stopPropagation();
59457
+ break;
59458
+ default:
59459
+ break;
59460
+ }
59461
+ });
59462
+ DocFindBarV2_defineProperty(this, "handleFindControlState", ({
59463
+ matchesCount,
59464
+ state
59465
+ }) => {
59466
+ const isNotFound = state === FindState.PENDING ? this.state.isNotFound : state === FindState.NOT_FOUND;
59467
+ const hasNavigationFocus = [this.nextButtonRef.current, this.previousButtonRef.current].some(el => !!el && el === document.activeElement);
59468
+ this.update({
59469
+ isNotFound,
59470
+ matchesCount: matchesCount || null
59471
+ });
59472
+ if (isNotFound && hasNavigationFocus) {
59473
+ this.inputRef.current?.focus();
59474
+ }
59475
+ });
59476
+ DocFindBarV2_defineProperty(this, "handleFindMatchesCount", ({
59477
+ matchesCount
59478
+ }) => {
59479
+ this.update({
59480
+ matchesCount: matchesCount || null
59481
+ });
59482
+ });
59483
+ DocFindBarV2_defineProperty(this, "handleQueryChange", query => {
59484
+ this.setFindFieldElValue(query);
59485
+ this.findFieldHandler();
59486
+ });
59487
+ if (!containerEl) {
59488
+ throw new Error('DocFindBar cannot be used without a container element.');
59489
+ }
59490
+ if (!eventBus) {
59491
+ throw new Error('DocFindBar cannot be used without an EventBus instance.');
59492
+ }
59493
+ if (!findController) {
59494
+ throw new Error('DocFindBar cannot be used without a PDFFindController instance.');
59495
+ }
59496
+ this.containerEl = containerEl;
59497
+ this.eventBus = eventBus;
59498
+ this.findController = findController;
59499
+ this.findBarEl = document.createElement('div');
59500
+ this.findBarEl.className = `bp-DocFindBarV2 ${constants/* CLASS_HIDDEN */.zX}`;
59501
+ this.findBarEl.setAttribute('data-testid', 'document-findbar');
59502
+ containerEl.appendChild(this.findBarEl);
59503
+ this.root = (0,client_.createRoot)(this.findBarEl);
59504
+ this.findBarEl.addEventListener('keydown', this.handleFindBarKeyDown, true);
59505
+ this.eventBus.on('updatefindcontrolstate', this.handleFindControlState);
59506
+ this.eventBus.on('updatefindmatchescount', this.handleFindMatchesCount);
59507
+ this.render();
59508
+ }
59509
+ destroy() {
59510
+ this.isDestroyed = true;
59511
+ this.removeAllListeners();
59512
+ this.eventBus.off('updatefindcontrolstate', this.handleFindControlState);
59513
+ this.eventBus.off('updatefindmatchescount', this.handleFindMatchesCount);
59514
+ this.findBarEl.removeEventListener('keydown', this.handleFindBarKeyDown, true);
59515
+ this.root.unmount();
59516
+ this.findBarEl.remove();
59517
+ }
59518
+ dispatchFindEvent(type, findPrevious) {
59519
+ this.eventBus.dispatch('find', {
59520
+ query: this.state.query,
59521
+ phraseSearch: true,
59522
+ highlightAll: true,
59523
+ findPrevious,
59524
+ type
59525
+ });
59526
+ }
59527
+ setFindFieldElValue(phrase) {
59528
+ this.update({
59529
+ query: phrase
59530
+ });
59531
+ }
59532
+ onKeydown(event) {
59533
+ const key = (0,util/* decodeKeydown */.wU)(event).toLowerCase();
59534
+ switch (key) {
59535
+ case 'meta+f':
59536
+ case 'control+f':
59537
+ case 'meta+g':
59538
+ case 'control+g':
59539
+ case 'f3':
59540
+ this.open();
59541
+ event.preventDefault();
59542
+ return true;
59543
+ default:
59544
+ return false;
59545
+ }
59546
+ }
59547
+ open() {
59548
+ if (this.prevSearchQuery) {
59549
+ this.setFindFieldElValue(this.prevSearchQuery);
59550
+ this.findFieldHandler();
59551
+ }
59552
+ if (!this.opened) {
59553
+ this.opened = true;
59554
+ this.findBarEl.classList.remove(constants/* CLASS_HIDDEN */.zX);
59555
+ this.emit(lib_events/* VIEWER_EVENT */.Oi.metric, {
59556
+ name: lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.OPEN
59557
+ });
59558
+ }
59559
+ this.inputRef.current?.select();
59560
+ this.inputRef.current?.focus();
59561
+ }
59562
+ toggle() {
59563
+ if (this.opened) {
59564
+ this.close();
59565
+ } else {
59566
+ this.open();
59567
+ }
59568
+ }
59569
+ findAgain(findPrevious) {
59570
+ if (!canNavigateMatches(this.state.query, this.state.isNotFound)) {
59571
+ return;
59572
+ }
59573
+ this.dispatchFindEvent('again', findPrevious);
59574
+ this.emit(lib_events/* VIEWER_EVENT */.Oi.metric, {
59575
+ name: findPrevious ? lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.PREVIOUS : lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.NEXT
59576
+ });
59577
+ }
59578
+ update(nextState) {
59579
+ if (this.isDestroyed) {
59580
+ return;
59581
+ }
59582
+ this.state = DocFindBarV2_objectSpread(DocFindBarV2_objectSpread({}, this.state), nextState);
59583
+ this.render();
59584
+ }
59585
+ render() {
59586
+ // Commits synchronously so open() can focus and select the input right after
59587
+ (0,external_react_dom_.flushSync)(() => {
59588
+ this.root.render(/*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
59589
+ container: this.containerEl
59590
+ }, /*#__PURE__*/external_react_["default"].createElement(DocFindBarV2, DocFindBarV2_extends({}, this.state, {
59591
+ inputRef: this.inputRef,
59592
+ nextButtonRef: this.nextButtonRef,
59593
+ onClose: this.close,
59594
+ onFindNext: () => this.findAgain(false),
59595
+ onFindPrevious: () => this.findAgain(true),
59596
+ onQueryChange: this.handleQueryChange,
59597
+ previousButtonRef: this.previousButtonRef
59598
+ }))));
59599
+ });
59600
+ }
59601
+ }
58678
59602
  ;// ./src/lib/Cache.js
58679
59603
 
58680
59604
  class Cache {
@@ -61991,6 +62915,7 @@ function DocBaseViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) retur
61991
62915
 
61992
62916
 
61993
62917
 
62918
+
61994
62919
 
61995
62920
 
61996
62921
  const DOC_FIRST_PAGES_ENABLED = 'docFirstPages.enabled';
@@ -63108,7 +64033,8 @@ class DocBaseViewer extends viewers_BaseViewer {
63108
64033
  if (this.isFindDisabled()) {
63109
64034
  return;
63110
64035
  }
63111
- this.findBar = new doc_DocFindBar(this.containerEl, this.pdfFindController, this.pdfEventBus);
64036
+ const FindBar = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_SUPPORTING_UI */.Ed) ? DocFindBarV2Root : doc_DocFindBar;
64037
+ this.findBar = new FindBar(this.containerEl, this.pdfFindController, this.pdfEventBus);
63112
64038
  this.findBar.addListener(lib_events/* VIEWER_EVENT */.Oi.metric, this.emitMetric);
63113
64039
  this.findBar.addListener('close', this.handleFindBarClose);
63114
64040
  }
@@ -69791,7 +70717,8 @@ function ComparisonBanner({
69791
70717
  return /*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
69792
70718
  container: menuContainer
69793
70719
  }, /*#__PURE__*/external_react_["default"].createElement("div", {
69794
- className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on
70720
+ className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on,
70721
+ "data-resin-feature": "versionComparison"
69795
70722
  }, /*#__PURE__*/external_react_["default"].createElement("div", {
69796
70723
  "aria-label": isComparedPreview ? ComparisonBanner_('comparison_banner_previous') : ComparisonBanner_('comparison_banner_current'),
69797
70724
  className: "bp-version-banner-details",
@@ -69829,8 +70756,10 @@ function ComparisonBanner({
69829
70756
  })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, {
69830
70757
  align: "end",
69831
70758
  container: menuContainer ?? undefined,
70759
+ "data-resin-feature": "versionComparison",
69832
70760
  side: "bottom"
69833
70761
  }, onMakeCurrent && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70762
+ "data-resin-target": "makeCurrentVersion",
69834
70763
  "data-target-id": "ComparisonBanner-makeCurrent",
69835
70764
  onSelect: onMakeCurrent
69836
70765
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69838,6 +70767,7 @@ function ComparisonBanner({
69838
70767
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69839
70768
  label: ComparisonBanner_('comparison_banner_make_current')
69840
70769
  })), onDownload && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70770
+ "data-resin-target": "downloadVersion",
69841
70771
  "data-target-id": "ComparisonBanner-download",
69842
70772
  onSelect: onDownload
69843
70773
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69845,6 +70775,7 @@ function ComparisonBanner({
69845
70775
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69846
70776
  label: ComparisonBanner_('download')
69847
70777
  })), onOpenFullPreview && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70778
+ "data-resin-target": "openFullPreview",
69848
70779
  "data-target-id": "ComparisonBanner-openFullPreview",
69849
70780
  onSelect: onOpenFullPreview
69850
70781
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69852,6 +70783,7 @@ function ComparisonBanner({
69852
70783
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69853
70784
  label: ComparisonBanner_('comparison_banner_open_full_preview')
69854
70785
  })), onDelete && (onMakeCurrent || onDownload || onOpenFullPreview) && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null), onDelete && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70786
+ "data-resin-target": "deleteVersion",
69855
70787
  "data-target-id": "ComparisonBanner-delete",
69856
70788
  onSelect: onDelete,
69857
70789
  variant: "destructive"
@@ -69864,6 +70796,7 @@ function ComparisonBanner({
69864
70796
  className: "bp-version-banner-divider"
69865
70797
  }), showClose && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
69866
70798
  "aria-label": ComparisonBanner_('comparison_banner_close'),
70799
+ "data-resin-target": "closeComparison",
69867
70800
  "data-target-id": "ComparisonBanner-close",
69868
70801
  icon: Medium_.XMark,
69869
70802
  onClick: onOpenFullPreview,