'use strict';
import { runSheetOpenChangeAction, syncSheetState } from '../services/resource-sheet.js';
import { getPropertyKeyByRelation } from '../relations/meta-relations.js';
import { metaQueryParams } from '../../../fd-toolbox/constants/meta-query-params.js';
import { isUuidSet } from '../../../fd-toolbox/functions/value-checking-functions.js';
import { emptyUuid } from '../../../fd-toolbox/constants/constants.js';
import { getElementId } from '../../../fd-toolbox/html/element-ids.js';
import { elements } from '../../../fd-toolbox/constants/elements.js';

var __defProp=Object['defineProperty'],__name=(_0x41f831,_0x513625)=>__defProp(_0x41f831,'name',{'value':_0x513625,'configurable':!![]});function getViewSheetEditButtonId(_0x512635){return getElementId(elements['table']['editButton'],void(0x74*-0x8+-0x23e1+0x2781),_0x512635);}__name(getViewSheetEditButtonId,'getViewSheetEditButtonId');async function handleOpenChange(_0x109003,_0x7f8f10,_0xbf988c,_0x1aef4f,_0x55e8c9,_0x137936,_0x453133,_0x10667a){if(_0x1aef4f&&_0xbf988c&&_0x55e8c9){const _0xfdde13=await encodeDefaultValues(_0xbf988c,_0x55e8c9,_0x1aef4f),_0x5587df=new URLSearchParams();_0xfdde13&&_0x5587df['set'](metaQueryParams['default'],_0xfdde13);const _0x33fe8f=_0x5587df['get'](metaQueryParams['default'])??void(-0x2e4*0xa+0x1c5e+0x2*0x45);onViewSheetOpenChange(_0x109003,_0xbf988c,_0x7f8f10,_0x137936,_0x453133,_0x33fe8f);}else onViewSheetOpenChange(_0x109003,_0xbf988c,_0x7f8f10,_0x137936,_0x453133);_0x10667a?.(_0x109003);}__name(handleOpenChange,'handleOpenChange');async function handleSaveComplete(_0x424d86,_0xa821b9,_0x5ab269,_0x1fcaab,_0x2bd1db,_0x8927e6,_0xcfdef0){_0xa821b9(_0x424d86),_0x2bd1db?.(),_0x8927e6?.(![]),_0x5ab269(!!_0xcfdef0),_0x1fcaab(!!_0xcfdef0);}__name(handleSaveComplete,'handleSaveComplete');function getViewSheetId(_0x52847c,_0x54a310){return getElementId(_0x52847c,'',_0x54a310);}__name(getViewSheetId,'getViewSheetId');function handleCancelClick(_0x44cd0d,_0x279db0){_0x44cd0d(![]),_0x279db0?.(![]);}__name(handleCancelClick,'handleCancelClick');function handleDeleteClick(_0x5d27c0,_0x5d3199){_0x5d27c0(![]),_0x5d3199?.(![]);}__name(handleDeleteClick,'handleDeleteClick');function onSheetClose(_0x9cce1a,_0x5cdcd0,_0x280714){!_0x280714&&_0x9cce1a(isUuidSet(_0x5cdcd0)&&_0x5cdcd0||emptyUuid);}__name(onSheetClose,'onSheetClose');async function encodeDefaultValues(_0x3c1019,_0x4ae3d5,_0x5b86dd){const _0x30e16d=await getPropertyKeyByRelation(_0x3c1019,_0x4ae3d5);if(!_0x30e16d)return void(-0x2dd+-0xb49+-0x713*-0x2);const _0x9ff96a=metaQueryParams['relatedResourceName']+'='+_0x30e16d+'&'+metaQueryParams['relatedResourceId']+'='+_0x5b86dd;return encodeURIComponent(_0x9ff96a);}__name(encodeDefaultValues,'encodeDefaultValues');function onViewSheetOpenChange(_0x18599d,_0x3512d8,_0x33976b,_0x1ebe85,_0x5f22f8,_0x217a5c,_0x110aa0){runSheetOpenChangeAction(_0x18599d,_0x3512d8,_0x1ebe85,_0x5f22f8,_0x217a5c),syncSheetState(_0x18599d,_0x33976b,_0x110aa0);}__name(onViewSheetOpenChange,'onViewSheetOpenChange');

export { getViewSheetEditButtonId, getViewSheetId, handleCancelClick, handleDeleteClick, handleOpenChange, handleSaveComplete, onSheetClose };
