import invoker,{API_INVOKER_TYPE,PLATFORM_TYPE_ENUM,Container_Type_Enum}from"./invoker";import getContainerType from"./getContainerType";function setNavLeftTextHandler(e,n){var t=n.resolve,i=n.reject,a=n.context,o=n.containerType,r=n.appType,s=n.platformType,T=n.watch;if(o){var c=function(n){e.onSuccess&&e.onSuccess(),invoker.handleBridgeResponse(n,t,i)},f=function(e){invoker.handleBridgeResponse(e,t,i)};r===API_INVOKER_TYPE.MINI_APP?a&&a({m:"biz.navigation.setLeft",args:e,onSuccess:c,onFail:f}):s===PLATFORM_TYPE_ENUM.ANDROID?a&&a(c,f,"biz.navigation","setLeft",e):s===PLATFORM_TYPE_ENUM.IOS&&a.callHandler("biz.navigation.setLeft",Object.assign({},e),(function(e){!T&&t(e)}))}else a&&a.call("setNavLeftText",e,(function(){t()}))}invoker.registerAPI("setNavLeftText",{mini:setNavLeftTextHandler,mobile:setNavLeftTextHandler,pc:function(e,n){window.dingtalk.platform.invokeAPI(n.msgId,"biz.navigation.setLeft",e)}}),setNavLeftText.version={ios:"1.2.0",pc:"1.2.0"};export default function setNavLeftText(e){var n=getContainerType();return invoker.invoke("setNavLeftText",n===Container_Type_Enum.isDingTalk?Object.assign({watch:!0,show:!0,control:!1,showIcon:!0,text:""},e):e,{dingTalkAPIName:n===Container_Type_Enum.isDingTalk?"biz.navigation.setLeft":null})}