2026-10-06 22:12:49 +00:00
// Module ID: 12445
// Function ID: 12446
2026-09-29 21:26:22 +00:00
// Name: vibegrationsPreviewNativeSurfaces
2026-10-06 22:12:49 +00:00
// Dependencies: [1086, 12446, 2]
2026-09-29 21:26:22 +00:00
// Exports: beginNativeSurfaceSessionForFrame
2026-10-06 22:12:49 +00:00
// Module 12445 (vibegrationsPreviewNativeSurfaces)
import Constants from "Constants" /* 1086 */ ;
import RpcCommandInterception from "RpcCommandInterception" /* 12446 */ ;
2026-09-29 21:26:22 +00:00
import size from "module_2" /* 2 */ ;
function asString ( str ) {
let tmp ;
if ( typeof str === "string" ) {
if ( "" !== str ) {
tmp = str ;
}
}
return tmp ;
}
function menuOptionIds ( items , items2 ) {
items = items2 ;
if ( items2 === undefined ) {
items = [ ] ;
}
if ( Array . isArray ( items ) ) {
const iter = items [ Symbol . iterator ] ( ) ;
const nextResult = iter . next ( ) ;
while ( iter !== undefined ) {
let tmp6 = nextResult ;
if ( items . length >= 40 ) {
iter . return ( ) ;
break ;
} else {
if ( null != tmp6 ) {
if ( typeof tmp6 === "object" ) {
let tmp17 = asString ( tmp6 . id ) ;
if ( null != tmp17 ) {
let arr = items . push ( tmp18 ) ;
}
let tmp13 = menuOptionIds ( tmp6 . items , items ) ;
}
}
continue ;
}
return items ;
}
} else {
return items ;
}
}
function answerFor ( cmd ) {
2026-10-06 22:12:49 +00:00
let options ;
let subject ;
let closure_0 = cmd ;
2026-09-29 21:26:22 +00:00
const found = closure_6 . find ( ( iframeId ) = > iframeId . iframeId === iframeId . iframeId ) ;
if ( null == found ) {
return null ;
} else if ( null == obj [ cmd . cmd ] ) {
return null ;
} else {
2026-10-06 22:12:49 +00:00
const tmp10Result = obj [ cmd . cmd ] ( cmd , found . answers ) ;
( { options , subject } = tmp10Result ) ;
const result = tmp10Result . result ;
if ( found . recorded . length < 20 ) {
const recorded = found . recorded ;
const obj2 = { command : cmd.cmd , answered : tmp12 } ;
2026-09-29 21:26:22 +00:00
if ( null != options ) {
2026-10-06 22:12:49 +00:00
let obj5 ;
2026-09-29 21:26:22 +00:00
if ( options . length > 0 ) {
2026-10-06 22:12:49 +00:00
obj = { options } ;
2026-09-29 21:26:22 +00:00
const obj3 = { options } ;
}
2026-10-06 22:12:49 +00:00
const merged = Object . assign ( obj ) ;
2026-09-29 21:26:22 +00:00
if ( null != subject ) {
2026-10-06 22:12:49 +00:00
obj5 = { subject } ;
2026-09-29 21:26:22 +00:00
const obj4 = { subject } ;
} else {
obj5 = { } ;
}
const merged1 = Object . assign ( obj5 ) ;
2026-10-06 22:12:49 +00:00
tmp13 ( obj2 ) ;
2026-09-29 21:26:22 +00:00
}
2026-10-06 22:12:49 +00:00
obj = { } ;
2026-09-29 21:26:22 +00:00
}
2026-10-06 22:12:49 +00:00
return { result } ;
2026-09-29 21:26:22 +00:00
}
}
const RPCCommands = Constants . RPCCommands ;
let obj = {
[ RPCCommands . OPEN_CONTEXT_MENU ] : ( args , contextMenuSelect ) = > {
2026-10-06 22:12:49 +00:00
let items ;
2026-09-29 21:26:22 +00:00
if ( "custom" === args . args . type ) {
2026-10-06 22:12:49 +00:00
items = menuOptionIds ( args . args . items ) ;
2026-09-29 21:26:22 +00:00
} else {
items = [ ] ;
}
if ( "custom" === args . args . type ) {
contextMenuSelect = contextMenuSelect . contextMenuSelect ;
}
if ( "custom" === args . args . type ) {
2026-10-06 22:12:49 +00:00
let tmp6 ;
2026-09-29 21:26:22 +00:00
if ( null == contextMenuSelect ) {
2026-10-06 22:12:49 +00:00
tmp6 = { result : { opened : true , selected_id : null } , answered : "dismissed" , options : items } ;
2026-09-29 21:26:22 +00:00
const obj2 = { result : { opened : true , selected_id : null } , answered : "dismissed" , options : items } ;
} else {
const obj3 = { result : null , answered : null , options : null } ;
const obj4 = { opened : true , selected_id : null } ;
if ( items . includes ( contextMenuSelect ) ) {
obj4 . selected_id = contextMenuSelect ;
obj3 . result = obj4 ;
const _HermesInternal2 = HermesInternal ;
obj3 . answered = "selected \"" + contextMenuSelect + "\"" ;
obj3 . options = items ;
2026-10-06 22:12:49 +00:00
tmp6 = obj3 ;
2026-09-29 21:26:22 +00:00
} else {
obj3 . result = obj4 ;
const _HermesInternal = HermesInternal ;
obj3 . answered = "dismissed \u2014 no item with id \"" + contextMenuSelect + "\"" ;
obj3 . options = items ;
2026-10-06 22:12:49 +00:00
tmp6 = obj3 ;
2026-09-29 21:26:22 +00:00
}
}
2026-10-06 22:12:49 +00:00
obj = tmp6 ;
2026-09-29 21:26:22 +00:00
} else {
obj = { result : { opened : true } , answered : "opened, no selection to make" } ;
}
2026-10-06 22:12:49 +00:00
return obj ;
2026-09-29 21:26:22 +00:00
} ,
[ RPCCommands . SHOW_CONFIRM_MODAL ] : ( args , confirm ) = > {
2026-10-06 22:12:49 +00:00
let result ;
let str ;
2026-09-29 21:26:22 +00:00
const title = args . args . title ;
let tmp ;
2026-10-06 22:12:49 +00:00
const _confirm = confirm . confirm ;
2026-09-29 21:26:22 +00:00
if ( typeof title === "string" ) {
if ( "" !== title ) {
tmp = title ;
}
}
if ( "confirm" === args . args . type ) {
2026-10-06 22:12:49 +00:00
result = { confirmed : true === _confirm } ;
const obj2 = { confirmed : true === _confirm } ;
2026-09-29 21:26:22 +00:00
} else {
2026-10-06 22:12:49 +00:00
result = { acknowledged : true === _confirm } ;
2026-09-29 21:26:22 +00:00
}
2026-10-06 22:12:49 +00:00
const obj3 = { result , answered : str , subject : tmp } ;
str = "dismissed" ;
if ( true === _confirm ) {
2026-09-29 21:26:22 +00:00
str = "confirmed" ;
}
return obj3 ;
} ,
[ RPCCommands . OPEN_EXTERNAL_LINK ] : ( args ) = > {
let tmp ;
2026-10-06 22:12:49 +00:00
const url = args . args . url ;
obj = { result : { opened : false } , answered : "cancelled \u2014 an agent may not open external links" , subject : tmp } ;
tmp = undefined ;
2026-09-29 21:26:22 +00:00
if ( typeof url === "string" ) {
if ( "" !== url ) {
tmp = url ;
}
}
return obj ;
} ,
[ RPCCommands . SHARE_CONTENT ] : ( args ) = > {
let tmp ;
2026-10-06 22:12:49 +00:00
const preview_title = args . args . preview_title ;
obj = { result : { success : false , didCopyLink : false , didSendMessage : false } , answered : "closed without sharing \u2014 an agent may not send a message for the user" , subject : tmp } ;
tmp = undefined ;
2026-09-29 21:26:22 +00:00
if ( typeof preview_title === "string" ) {
if ( "" !== preview_title ) {
tmp = preview_title ;
}
}
if ( tmp == null ) {
const content = args . args . content ;
let tmp2 ;
if ( typeof content === "string" ) {
if ( "" !== content ) {
tmp2 = content ;
}
}
tmp = tmp2 ;
}
return obj ;
} ,
[ RPCCommands . OPEN_USER_PROFILE ] : ( ) = > ( { result : { opened : true } , answered : "opened" } ) ,
[ RPCCommands . OPEN_USER_POPOUT ] : ( ) = > ( { result : { opened : true } , answered : "opened" } ) ,
[ RPCCommands . SHOW_TOOLTIP ] : ( ) = > ( { result : { shown : true } , answered : "shown" } ) ,
[ RPCCommands . HIDE_TOOLTIP ] : ( ) = > ( { result : { hidden : true } , answered : "hidden" } ) ,
[ RPCCommands . OPEN_MEDIA_VIEWER ] : ( ) = > ( { result : { opened : true } , answered : "opened" } ) ,
[ RPCCommands . SHOW_TOAST ] : ( ) = > ( { result : { shown : true } , answered : "shown" } ) ,
2026-10-06 22:12:49 +00:00
[ RPCCommands . OPEN_INVITE_DIALOG ] : ( ) = > ( { result : "unicodeVersion" , answered : "NavigationContext" } ) ,
[ RPCCommands . OPEN_SHARE_MOMENT_DIALOG ] : ( ) = > ( { result : "unicodeVersion" , answered : "NavigationContext" } )
2026-09-29 21:26:22 +00:00
} ;
let closure_5 = {
drain() {
return [ ] ;
} ,
end() {
} ,
iframeId : null
} ;
let closure_6 = [ ] ;
const keys = Object . keys ( obj ) ;
let result = size . fileFinishedImporting ( "modules/vibegrations/lib/vibegrationsPreviewNativeSurfaces.tsx" ) ;
export const ANSWERED_NATIVE_COMMANDS = keys ;
export const beginNativeSurfaceSessionForFrame = function beginNativeSurfaceSessionForFrame ( iframeId , native , beneathBatches ) {
if ( null == iframeId ) {
return closure_5 ;
} else {
2026-10-06 22:12:49 +00:00
let arr ;
2026-09-29 21:26:22 +00:00
let answers = native ;
2026-10-06 22:12:49 +00:00
const obj3 = { iframeId , answers , recorded : [ ] } ;
2026-09-29 21:26:22 +00:00
if ( native == null ) {
answers = { } ;
}
beneathBatches = undefined ;
if ( beneathBatches != null ) {
beneathBatches = beneathBatches . beneathBatches ;
}
if ( true === beneathBatches ) {
closure_6 . push ( obj3 ) ;
2026-10-06 22:12:49 +00:00
arr = closure_6 ;
2026-09-29 21:26:22 +00:00
} else {
arr = closure_6 ;
closure_6 . unshift ( obj3 ) ;
}
if ( 1 === arr . length ) {
2026-10-06 22:12:49 +00:00
const obj2 = obj3 ( 12446 ) ;
let result = obj2 . setRpcCommandInterceptor ( answerFor ) ;
2026-09-29 21:26:22 +00:00
}
2026-10-06 22:12:49 +00:00
return {
2026-09-29 21:26:22 +00:00
iframeId ,
drain() {
const recorded = obj3 . recorded ;
return recorded . splice ( 0 , obj3 . recorded . length ) ;
} ,
end() {
const index = closure_6 . indexOf ( obj3 ) ;
if ( - 1 !== index ) {
2026-10-06 22:12:49 +00:00
closure_6 . splice ( index , 1 ) ;
if ( 0 === closure_6 . length ) {
obj = RpcCommandInterception ;
const result = obj . setRpcCommandInterceptor ( null ) ;
2026-09-29 21:26:22 +00:00
}
}
}
} ;
}
} ;