2026-10-09 10:00:15 +00:00
// Module ID: 11378
// Function ID: 11379
2026-10-05 08:00:40 +00:00
// Name: conjurePreviewNativeSurfaces
2026-10-09 10:00:15 +00:00
// Dependencies: [1085, 11379, 2]
2026-09-19 06:52:51 +00:00
// Exports: beginNativeSurfaceSessionForFrame
2026-10-09 10:00:15 +00:00
// Module 11378 (conjurePreviewNativeSurfaces)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */ ;
2026-10-09 10:00:15 +00:00
import RpcCommandInterception from "RpcCommandInterception" /* 11379 */ ;
2026-09-19 06:52:51 +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-03 08:58:59 +00:00
let options ;
let subject ;
let closure_0 = cmd ;
2026-09-19 06:52:51 +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-09 10:00:15 +00:00
const tmp10Result = obj [ cmd . cmd ] ( cmd ) ;
( { options , subject } = tmp10Result ) ;
const result = tmp10Result . result ;
2026-10-03 08:58:59 +00:00
if ( found . recorded . length < 20 ) {
const recorded = found . recorded ;
2026-10-09 10:00:15 +00:00
const obj2 = { command : cmd.cmd , answered : tmp12 } ;
2026-09-19 06:52:51 +00:00
if ( null != options ) {
2026-10-03 08:58:59 +00:00
let obj5 ;
2026-09-19 06:52:51 +00:00
if ( options . length > 0 ) {
2026-10-09 10:00:15 +00:00
obj = { options } ;
const obj3 = { options } ;
2026-09-19 06:52:51 +00:00
}
2026-10-09 10:00:15 +00:00
const merged = Object . assign ( obj ) ;
2026-09-19 06:52:51 +00:00
if ( null != subject ) {
2026-10-09 10:00:15 +00:00
obj5 = { subject } ;
const obj4 = { subject } ;
2026-09-19 06:52:51 +00:00
} else {
2026-10-09 10:00:15 +00:00
obj5 = { } ;
2026-09-19 06:52:51 +00:00
}
2026-10-09 10:00:15 +00:00
const merged1 = Object . assign ( obj5 ) ;
tmp13 ( obj2 ) ;
2026-09-19 06:52:51 +00:00
}
2026-10-09 10:00:15 +00:00
obj = { } ;
2026-09-19 06:52:51 +00:00
}
2026-10-03 08:58:59 +00:00
return { result } ;
2026-09-19 06:52:51 +00:00
}
}
const RPCCommands = Constants . RPCCommands ;
let obj = {
2026-10-06 11:16:32 +00:00
[ RPCCommands . OPEN_CONTEXT_MENU ] : ( args ) = > {
if ( "custom" !== args . args . type ) {
2026-09-19 06:52:51 +00:00
obj = { result : { opened : true } , answered : "opened, no selection to make" } ;
2026-10-06 11:16:32 +00:00
const obj2 = { result : { opened : true } , answered : "opened, no selection to make" } ;
} else {
obj = { result : { opened : true , selected_id : null } , answered : "dismissed" , options : menuOptionIds ( args . args . items ) } ;
2026-09-19 06:52:51 +00:00
}
2026-10-03 08:58:59 +00:00
return obj ;
2026-09-19 06:52:51 +00:00
} ,
2026-10-06 11:16:32 +00:00
[ RPCCommands . SHOW_CONFIRM_MODAL ] : ( args ) = > {
2026-09-19 06:52:51 +00:00
let tmp ;
2026-10-06 11:16:32 +00:00
const title = args . args . title ;
obj = { result : "confirm" === args . args . type ? { confirmed : false } : { acknowledged : false } , answered : "dismissed" , subject : tmp } ;
tmp = undefined ;
2026-09-19 06:52:51 +00:00
if ( typeof title === "string" ) {
if ( "" !== title ) {
tmp = title ;
}
}
2026-10-06 11:16:32 +00:00
return obj ;
2026-09-19 06:52:51 +00:00
} ,
[ RPCCommands . OPEN_EXTERNAL_LINK ] : ( args ) = > {
let tmp ;
2026-10-03 08:58:59 +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-19 06:52:51 +00:00
if ( typeof url === "string" ) {
if ( "" !== url ) {
tmp = url ;
}
}
return obj ;
} ,
[ RPCCommands . SHARE_CONTENT ] : ( args ) = > {
let tmp ;
2026-10-03 08:58:59 +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-19 06:52:51 +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" } ) ,
2026-10-09 10:00:15 +00:00
[ RPCCommands . OPEN_GAME_PROFILE ] : ( ) = > ( { result : { opened : true } , answered : "opened" } ) ,
2026-09-19 06:52:51 +00:00
[ 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-09 10:00:15 +00:00
[ RPCCommands . OPEN_INVITE_DIALOG ] : ( ) = > ( { result : "code" , answered : null } ) ,
[ RPCCommands . OPEN_SHARE_MOMENT_DIALOG ] : ( ) = > ( { result : "code" , answered : null } )
2026-09-19 06:52:51 +00:00
} ;
let closure_5 = {
drain() {
return [ ] ;
} ,
end() {
} ,
iframeId : null
} ;
let closure_6 = [ ] ;
const keys = Object . keys ( obj ) ;
2026-10-05 08:00:40 +00:00
let result = size . fileFinishedImporting ( "modules/conjure/preview/conjurePreviewNativeSurfaces.tsx" ) ;
2026-09-19 06:52:51 +00:00
export const ANSWERED_NATIVE_COMMANDS = keys ;
2026-10-06 11:16:32 +00:00
export const beginNativeSurfaceSessionForFrame = function beginNativeSurfaceSessionForFrame ( iframeId , beneathBatches ) {
2026-09-19 06:52:51 +00:00
if ( null == iframeId ) {
return closure_5 ;
} else {
2026-10-03 08:58:59 +00:00
let arr ;
2026-10-06 11:16:32 +00:00
const obj2 = { iframeId , recorded : [ ] } ;
2026-09-19 06:52:51 +00:00
beneathBatches = undefined ;
if ( beneathBatches != null ) {
beneathBatches = beneathBatches . beneathBatches ;
}
if ( true === beneathBatches ) {
2026-10-06 11:16:32 +00:00
closure_6 . push ( obj2 ) ;
2026-10-03 08:58:59 +00:00
arr = closure_6 ;
2026-09-19 06:52:51 +00:00
} else {
arr = closure_6 ;
2026-10-06 11:16:32 +00:00
closure_6 . unshift ( obj2 ) ;
2026-09-19 06:52:51 +00:00
}
if ( 1 === arr . length ) {
2026-10-09 10:00:15 +00:00
obj = obj2 ( 11379 ) ;
2026-10-06 11:16:32 +00:00
let result = obj . setRpcCommandInterceptor ( answerFor ) ;
2026-09-19 06:52:51 +00:00
}
2026-10-03 08:58:59 +00:00
return {
2026-09-19 06:52:51 +00:00
iframeId ,
drain() {
2026-10-06 11:16:32 +00:00
const recorded = obj2 . recorded ;
return recorded . splice ( 0 , obj2 . recorded . length ) ;
2026-09-19 06:52:51 +00:00
} ,
end() {
2026-10-06 11:16:32 +00:00
const index = closure_6 . indexOf ( obj2 ) ;
2026-09-19 06:52:51 +00:00
if ( - 1 !== index ) {
2026-10-03 08:58:59 +00:00
closure_6 . splice ( index , 1 ) ;
if ( 0 === closure_6 . length ) {
obj = RpcCommandInterception ;
const result = obj . setRpcCommandInterceptor ( null ) ;
2026-09-19 06:52:51 +00:00
}
}
}
} ;
}
} ;