doum
2025-09-26 9057e04efad1b7d61c77a72e5c37a504d0aee935
1
const win="undefined"!=typeof window?window:void 0,doc="undefined"!=typeof document?document:void 0,nav="undefined"!=typeof navigator?navigator:void 0,loc="undefined"!=typeof location?location:void 0;function getHref(){return loc?.href||""}function getTitle(){return doc?.title||""}const ua=nav?.userAgent||"",platform=nav?.platform||"",wecomVersion=ua?.match(/wxwork\/([\d.]+)/i)?.[1],isWeCom=!!wecomVersion,isWeChat=!isWeCom&&/micromessenger/i.test(ua),isAndroid=/\bAndroid\b/i.test(ua),isWindows=/Win/i.test(platform),{isIOS:isIOS,isMac:isMac}=getAppleDeviceType();function getAppleDeviceType(){const e=nav?.maxTouchPoints??1,t=/Mac/i.test(platform);return t&&e>2?{isMac:!1,isIOS:!0}:{isMac:t,isIOS:/\b(iPhone|iPad|iPod)\b/i.test(ua)}}let registerOptions,corpConfigTask,agentConfigTask;function setRegisterOptions(e){if(!e.corpId)throw new Error("Missing corpId");registerOptions=e}function getRegisterOptions(){return registerOptions}function getCorpConfigTask(){return corpConfigTask}function setCorpConfigTask(e){corpConfigTask=e}function getCorpConfigParams(){return corpConfigTask?.getResult()?.params}function getAgentConfigTask(){return agentConfigTask}function setAgentConfigTask(e){agentConfigTask=e}function getAgentConfigParams(){return agentConfigTask?.getResult()?.params}function getConfigParams(){const e=getRegisterOptions();return isWeCom&&e?.getAgentConfigSignature?getAgentConfigParams():getCorpConfigParams()}function getConfigCorpId(){const e=getRegisterOptions();if(isWeCom&&e?.getAgentConfigSignature){const e=getAgentConfigParams();return e?.corpid}const t=getCorpConfigParams();return t?.appId}function getVerifyParams(){const e=getConfigParams();if(!e)return;const t=getConfigCorpId();return{appId:t,verifyAppId:t,verifySignType:"sha1",verifyTimestamp:e.timestamp,verifyNonceStr:e.nonceStr,verifySignature:e.signature}}const webToClientJsApiMap={config:"preVerifyJsApi",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareWechat:"menu:share:wechat",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress",getBrandWCPayRequest:"getBrandWCPayRequest"},clientToWebJsApiMap={};for(const e of Object.keys(webToClientJsApiMap))clientToWebJsApiMap[webToClientJsApiMap[e]]=e;function mapJsApiNameToClient(e){return webToClientJsApiMap[e]||e}function mapJsApiNameToWeb(e){return clientToWebJsApiMap[e]||e}function mapJsApiListToClient(e){return e.map(mapJsApiNameToClient)}function error(...e){console.error("[wwsdk]",...e)}const originalHref=getHref();function semverSubtract(e,t){const n=e?.split(".")||[],r=t?.split(".")||[];for(let i=0,a=Math.max(n.length,r.length);i<a;i++){const e=parseInt(n[i])||0,t=parseInt(r[i])||0;if(e>t)return 1;if(e<t)return-1}return 0}function arrayBufferToBase64(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");let t="";const n=new Uint8Array(e),r=n.byteLength;for(let i=0;i<r;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function base64ToArrayBuffer(e){if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").buffer;const t=atob(e),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r.buffer}function safeRun(e,t,n){if(isFunction(e))try{return e.call(n,t)}catch(r){error(r)}}function startsWith(e,t){return e.slice(0,t.length)===t}function getSignURL(e){return e?originalHref.split("#")[0]:getHref().split("#")[0]}function extractErrMsgKeyword(e){return isString(e)?e.slice(e.indexOf(":")+1):""}function isFalsy(e){return!1===e||0===e}function isObject$1(e){return!!e&&"object"==typeof e}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function joinList(e){return e?isString(e)?e:e.join(";"):e}let isWeixinJSBridgeReady=!!win?.WeixinJSBridge,onWeixinJSBridgeReady=Promise.resolve();async function on(e,t){isWeixinJSBridgeReady||await onWeixinJSBridgeReady,win.WeixinJSBridge.on(e,t)}async function invoke(e,t={},n){isWeixinJSBridgeReady||await onWeixinJSBridgeReady;const r=await new Promise((n=>{const r={...t,...getVerifyParams()};win.WeixinJSBridge.invoke(e,r,n)}));r.errMsg||(r.errMsg=formatErrMsg(e,r.err_msg||r.errmsg));const i=extractErrMsgKeyword(r.errMsg);if(null==r.errCode&&(r.errCode=null!=r.err_code?r.err_code:"ok"===i?0:-1),safeRun(n,r),"ok"!==i&&"yes"!==i)throw r;return r}function formatErrMsg(e,t){const n=mapJsApiNameToWeb(e);if(!t)return`${n}:ok`;let r=extractErrMsgKeyword(t);return"confirm"===r&&(r="ok"),"failed"===r&&(r="fail"),startsWith(r,"failed_")&&(r=r.slice(7)),startsWith(r,"fail_")&&(r=r.slice(5)),r=r.replace(/_/g,"").toLowerCase(),"access denied"!==r&&"no permission to execute"!==r||(r="permission denied"),"config"===n&&"function not exist"===r&&(r="ok"),r||(r="fail"),`${n}:${r}`}isWeixinJSBridgeReady||(onWeixinJSBridgeReady=new Promise((e=>{doc?.addEventListener("WeixinJSBridgeReady",(()=>{isWeixinJSBridgeReady=!0,e()}))})));class SDKError extends Error{constructor(e){super(`SDK Error: ${e}`)}}class AbortError extends SDKError{constructor(){super("Aborted")}}function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const CONFIG_TYPE_CORP=1,CONFIG_TYPE_AGENT=2;class ConfigTask{checkValid(){return isWeCom&&this.url!==getSignURL(this.useOriginalURL)&&(this.error=new AbortError),!this.error}getResult(){if(this.checkValid())return this.result}async awaitPromise(e){try{return this.result=await e,this.result}catch(error){throw this.error=error,error}}constructor(e,t){_define_property(this,"type",void 0),_define_property(this,"url",void 0),_define_property(this,"promise",void 0),_define_property(this,"result",void 0),_define_property(this,"error",void 0),_define_property(this,"useOriginalURL",void 0),this.type=e,this.useOriginalURL=isWeChat&&!isWindows&&!isMac&&e===CONFIG_TYPE_CORP,this.url=getSignURL(this.useOriginalURL),this.promise=this.awaitPromise(t(this.url))}}async function ensureCorpConfigReady(){const e=getCorpConfigTask();if(e?.checkValid())return e.promise;const t=new ConfigTask(CONFIG_TYPE_CORP,(async e=>{const n=getRegisterOptions();if(!n?.getConfigSignature)throw new SDKError("Missing getConfigSignature");const r=await n.getConfigSignature(e);if(!t.checkValid())throw new AbortError;const i=buildCorpConfigParams(n,r),a=await invoke("preVerifyJSAPI",{appId:i.appId,verifyJsApiList:i.jsApiList,verifyOpenTagList:i.openTagList,verifyAppId:i.appId,verifySignType:"sha1",verifyTimestamp:i.timestamp,verifyNonceStr:i.nonceStr,verifySignature:i.signature});if(!t.checkValid())throw new AbortError;return{params:i,result:a}}));return t.promise.then((e=>{const t=getRegisterOptions();safeRun(t?.onConfigSuccess,e.result),safeRun(t?.onConfigComplete,e.result)}),(e=>{const t=getRegisterOptions();safeRun(t?.onConfigFail,e),safeRun(t?.onConfigComplete,e)})),setCorpConfigTask(t),t.promise}function buildCorpConfigParams(e,t){return{appId:e.corpId,timestamp:`${t.timestamp}`,nonceStr:t.nonceStr,signature:t.signature,jsApiList:mapJsApiListToClient(e.jsApiList||["config"]),openTagList:mapJsApiListToClient(e.openTagList||[])}}async function ensureAgentConfigReady(){const e=getAgentConfigTask();if(e?.checkValid())return e.promise;const t=new ConfigTask(CONFIG_TYPE_AGENT,(async e=>{let n;isWeCom&&semverSubtract(wecomVersion,"3.0.24")<0&&(n=ensureCorpConfigReady());const[r]=await Promise.all([resolveAgentConfigParams(e),n]);if(!t.checkValid())throw new AbortError;const i=await invoke("agentConfig",r);if(!t.checkValid())throw new AbortError;return{params:r,result:i}}));return t.promise.then((e=>handleAgentConfigSuccess(e.result)),(e=>handleAgentConfigFail(e))),setAgentConfigTask(t),t.promise}async function resolveAgentConfigParams(e){const t=getRegisterOptions();if(!t?.getAgentConfigSignature)throw new SDKError("Missing getAgentConfigSignature");const n=await t.getAgentConfigSignature(e);return{corpid:t.corpId,agentid:`${t.agentId}`,timestamp:`${n.timestamp}`,nonceStr:n.nonceStr,signature:n.signature,jsApiList:mapJsApiListToClient(t.jsApiList||["agentConfig"])}}function handleAgentConfigSuccess(e){const t=getRegisterOptions();safeRun(t?.onAgentConfigSuccess,e),safeRun(t?.onAgentConfigComplete,e)}function handleAgentConfigFail(e){const t=getRegisterOptions();safeRun(t?.onAgentConfigFail,e),safeRun(t?.onAgentConfigComplete,e)}function ensureConfigReady(){const e=getRegisterOptions();return isWeCom&&e?.getAgentConfigSignature?ensureAgentConfigReady():ensureCorpConfigReady()}function tryEnsureConfigReady(){const e=getRegisterOptions();if(e)return isWeCom&&e.getAgentConfigSignature?ensureAgentConfigReady():e.getConfigSignature?ensureCorpConfigReady():void 0}function register(e){setRegisterOptions(e),(isWeChat||isWeCom)&&tryEnsureConfigReady()}async function passthrough(e,t,n=t){return promiseToCallback(t,(async()=>(await tryEnsureConfigReady(),invoke(e,n))))}async function bindShare(e,t,n){await tryEnsureConfigReady(),on(e,(()=>{promiseToCallback(t,n)}))}function promiseToCallback(e,t){return t(e).then((t=>(safeRun(e?.success,t),safeRun(e?.complete,t),t)),(t=>{throw safeRun("cancel"===extractErrMsgKeyword(t.errMsg)?e?.cancel:e?.fail,t),safeRun(e?.complete,t),t}))}var Proximity,LocationType,NetworkType,ChooseMessageFileType,TempFileType,SizeType,SourceType,CameraMode,LiveType,WedocSelectedFileType,ProductViewType,CreateExternalPaymentType,EntryType,OpenAppManagePageType,EnvVersion,OpenUserProfileType,PrintFileIdType,InTalkType,ScanQRCodeType,InputCorpGroupContactMode,InputCorpGroupContactType,SelectEnterpriseContactMode,SelectEnterpriseContactType,SelectExternalContactType,SelectPrivilegedContactMode,OAType,OaExtDataType;function startSearchBeacons(e={}){return passthrough("startMonitoringBeacons",e)}function stopSearchBeacons(e={}){return passthrough("stopMonitoringBeacons",e)}function onSearchBeacons(e){on("onBeaconsInRange",e)}function createBLEConnection(e){return passthrough("createBLEConnection",e)}function closeBLEConnection(e){return passthrough("closeBLEConnection",e)}function onBLEConnectionStateChange(e){on("onBLEConnectionStateChange",e)}function getBLEDeviceServices(e){return passthrough("getBLEDeviceServices",e)}function getBLEDeviceCharacteristics(e){return passthrough("getBLEDeviceCharacteristics",e)}function readBLECharacteristicValue(e){return passthrough("readBLECharacteristicValue",e)}function writeBLECharacteristicValue(e){return passthrough("writeBLECharacteristicValue",e,{deviceId:e.deviceId,serviceId:e.serviceId,characteristicId:e.characteristicId,value:arrayBufferToBase64(e.value)})}function notifyBLECharacteristicValueChange(e){return passthrough("notifyBLECharacteristicValueChange",e)}function onBLECharacteristicValueChange(e){on("onBLECharacteristicValueChange",(t=>{"string"==typeof t?.value&&(t.value=base64ToArrayBuffer(t.value)),e(t)}))}function openBluetoothAdapter(e={}){return passthrough("openBluetoothAdapter",e)}function closeBluetoothAdapter(e={}){return passthrough("closeBluetoothAdapter",e)}function getBluetoothAdapterState(e={}){return passthrough("getBluetoothAdapterState",e)}function onBluetoothAdapterStateChange(e){on("onBluetoothAdapterStateChange",e)}function startBluetoothDevicesDiscovery(e={}){return passthrough("startBluetoothDevicesDiscovery",e)}function stopBluetoothDevicesDiscovery(e={}){return passthrough("stopBluetoothDevicesDiscovery",e)}function getBluetoothDevices(e={}){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const e=await invoke("getBluetoothDevices");for(const t of e.devices||[])normalizeBluetoothDevice(t);return e}))}function onBluetoothDeviceFound(e){on("onBluetoothDeviceFound",(t=>{for(const e of t.devices||[])normalizeBluetoothDevice(e);e(t)}))}function getConnectedBluetoothDevices(e){return passthrough("getConnectedBluetoothDevices",e)}function normalizeBluetoothDevice(e){if("string"==typeof e.advertisData&&(e.advertisData=base64ToArrayBuffer(e.advertisData)),e.serviceDataV2){const t=e.serviceDataV2;for(const e of Object.keys(t))"string"==typeof t[e]&&(t[e]=base64ToArrayBuffer(t[e]));e.serviceData=t,delete e.serviceDataV2}}function setClipboardData(e){return passthrough("setClipboardData",e)}function getClipboardData(e={}){return passthrough("getClipboardData",e)}function startBeaconDiscovery(e){return passthrough("startBeaconDiscovery",e)}function stopBeaconDiscovery(e={}){return passthrough("stopBeaconDiscovery",e)}function getBeacons(e={}){return passthrough("getBeacons",e)}function onBeaconUpdate(e){on("onBeaconUpdate",e)}function onBeaconServiceChange(e){on("onBeaconServiceChange",e)}function openLocation(e){return passthrough("openLocation",e,{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""})}function getLocation(e={}){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("geoLocation",{type:e.type||"wgs84"});return delete t.type,t}))}function startAutoLBS(e){return passthrough("startAutoLBS",e)}function stopAutoLBS(e={}){return passthrough("stopAutoLBS",e)}function onLocationChange(e){on("auto:location:report",e)}function getNetworkType(e={}){return passthrough("getNetworkType",e)}function onNetworkStatusChange(e){on("onNetworkStatusChange",e)}function startWifi(e={}){return passthrough("startWifi",e)}function stopWifi(e={}){return passthrough("stopWifi",e)}function connectWifi(e){return passthrough("connectWifi",e)}function getWifiList(e={}){return passthrough("getWifiList",e)}function onGetWifiList(e){on("onGetWifiList",e)}function onWifiConnected(e){on("onWifiConnected",e)}function getConnectedWifi(e={}){return passthrough("getConnectedWifi",e)}function previewFile(e){return passthrough("previewFile",e)}function chooseMessageFile(e){return passthrough("chooseMessageFile",e)}function getLocalFileData(e){return passthrough("getLocalFileData",e)}function chooseImage(e={}){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"],defaultCameraMode:e.defaultCameraMode||"normal",isSaveToAlbum:isFalsy(e.isSaveToAlbum)?0:1});if(isAndroid&&t.localIds){t.localIds=t.localIds||"[]";try{t.localIds=JSON.parse(t.localIds)}catch(error){}}return t}))}function previewImage(e){return passthrough("imagePreview",e)}function uploadImage(e){return passthrough("uploadImage",e,{localId:e.localId,isShowProgressTips:isFalsy(e.isShowProgressTips)?0:1})}function downloadImage(e){return passthrough("downloadImage",e,{serverId:e.serverId,isShowProgressTips:isFalsy(e.isShowProgressTips)?0:1})}function getLocalImgData(e){return passthrough("getLocalImgData",e)}function startRecord(e={}){return passthrough("startRecord",e)}function stopRecord(e={}){return passthrough("stopRecord",e)}function onVoiceRecordEnd(e){on("onVoiceRecordEnd",e)}function playVoice(e){return passthrough("playVoice",e)}function pauseVoice(e){return passthrough("pauseVoice",e)}function stopVoice(e){return passthrough("stopVoice",e)}function onVoicePlayEnd(e){on("onVoicePlayEnd",e)}function uploadVoice(e){return passthrough("uploadVoice",e,{localId:e.localId,isShowProgressTips:isFalsy(e.isShowProgressTips)?0:1})}function downloadVoice(e){return passthrough("downloadVoice",e,{serverId:e.serverId,isShowProgressTips:isFalsy(e.isShowProgressTips)?0:1})}function translateVoice(e){return passthrough("translateVoice",e,{localId:e.localId,isShowProgressTips:isFalsy(e.isShowProgressTips)?0:1})}function startLiving(e={}){return passthrough("startLiving",e)}function replayLiving(e){return passthrough("replayLiving",e)}function downloadLivingReplay(e){return passthrough("downloadLivingReplay",e)}function startMeeting(e={}){return passthrough("startMeeting",e)}function createDoc(e){return passthrough("createDoc",e)}function wedocSelectDoc(e){return passthrough("wedocSelectDoc",e)}function wedriveSelectDir(e={}){return passthrough("wedriveSelectDir",e)}function wedriveSelectFile(e){return passthrough("wedriveSelectFile",e)}function wedriveSelectFileForShare(e){return passthrough("wedriveSelectFileForShare",e)}function wedriveSelectFileForDownload(e){return passthrough("wedriveSelectFileForDownload",e)}function onHistoryBack(e){on("historyBack",e)}function hideOptionMenu(e={}){return passthrough("hideOptionMenu",e)}function showOptionMenu(e={}){return passthrough("showOptionMenu",e)}function closeWindow(e={}){return passthrough("closeWindow",e)}function hideMenuItems(e){return passthrough("hideMenuItems",e)}function showMenuItems(e){return passthrough("showMenuItems",e)}function hideAllNonBaseMenuItem(e={}){return passthrough("hideAllNonBaseMenuItem",e)}function showAllNonBaseMenuItem(e={}){return passthrough("showAllNonBaseMenuItem",e)}function openDefaultBrowser(e){return passthrough("openDefaultBrowser",e)}function onUserCaptureScreen(e){on("onUserCaptureScreen",e)}function onMenuShareAppMessage(e){bindShare("menu:share:appmessage",e,(()=>invoke("sendAppMessage",{title:e.title||getTitle(),desc:e.desc||"",link:e.link||getHref(),img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||"",finder_feed:e.finderFeed||e.finder_feed,finder_topic:e.finderTopic||e.finder_topic,finder_profile:e.finderProfile||e.finder_profile,enableIdTrans:e.enableIdTrans?1:0})))}function onMenuShareTimeline(e){bindShare("menu:share:timeline",e,(()=>invoke("shareTimeline",{title:e.title||getTitle(),desc:e.title||getTitle(),img_url:e.imgUrl||"",link:e.link||getHref(),type:e.type||"link",data_url:e.dataUrl||"",enableIdTrans:e.enableIdTrans?1:0})))}function onMenuShareWechat(e){bindShare("menu:share:wechat",e,(()=>invoke("shareWechat",{title:e.title||getTitle(),desc:e.desc||"",link:e.link||getHref(),img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||"",enableIdTrans:e.enableIdTrans?1:0})))}function onMenuShareQQ(e){bindShare("menu:share:qq",e,(()=>invoke("shareQQ",{title:e.title||getTitle(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||getHref()})))}function onMenuShareWeibo(e){bindShare("menu:share:weiboApp",e,(()=>invoke("shareWeiboApp",{title:e.title||getTitle(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||getHref()})))}function onMenuShareQZone(e){bindShare("menu:share:QZone",e,(()=>invoke("shareQZone",{title:e.title||getTitle(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||getHref()})))}function shareAppMessage(e){return passthrough("shareAppMessage",e)}function shareWechatMessage(e){return passthrough("shareWechatMessage",e)}function updateTimelineShareData(e={}){return passthrough("updateTimelineShareData",e)}function updateAppMessageShareData(e={}){return passthrough("updateAppMessageShareData",e)}function addCard(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("batchAddCard",{card_list:e.cardList.map((e=>({card_id:e.cardId,card_ext:e.cardExt})))});if(!t.card_list)return t;for(const e of t.card_list)e.cardId=e.card_id,delete e.card_id,e.cardExt=e.card_ext,delete e.card_ext,e.isSuccess=!!e.is_succ,delete e.is_succ;return t.cardList=t.card_list,delete t.card_list,t}))}function chooseCard(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("chooseCard",{app_id:getConfigCorpId(),location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:`${e.timestamp}`,nonce_str:e.nonceStr});return t.cardList=t.choose_card_info,delete t.choose_card_info,t}))}function openCard(e){return passthrough("batchViewCard",e,{card_list:e.cardList.map((e=>({card_id:e.cardId,code:e.code})))})}function consumeAndShareCard(e){return passthrough("consumedShareCard",e,{consumedCardId:e.cardId,consumedCode:e.code})}function openProductSpecificView(e){return passthrough("openProductViewWithPid",e,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo})}function chooseWXPay(e){return passthrough("getBrandWCPayRequest",e,normalizeParams(e))}function openEnterpriseRedPacket(e){return passthrough("getRecevieBizHongBaoRequest",e,normalizeParams(e))}function normalizeParams(e){return{timeStamp:`${e.timestamp}`,nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function addDevice(e){return passthrough("addDevice",e)}async function checkJsApi(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("checkJsApi",{jsApiList:mapJsApiListToClient(e.jsApiList)});if("string"==typeof t.checkResult)try{t.checkResult=JSON.parse(t.checkResult)}catch(error){t.checkResult={}}return t.checkResult=normalize(flatten(t.checkResult)),t}))}function normalize(e){const t={...e};for(const n of Object.keys(e))t[mapJsApiNameToWeb(n)]=e[n];return t}function flatten(e){const t={};for(const n of Object.keys(e)){if(!isObject$1(e[n])){t[n]=e[n];continue}const r=flatten(e[n]);for(const e of Object.keys(r))t[`${n}.${e}`]=r[e]}return t}function checkSchedule(e){return passthrough("checkSchedule",e)}function chooseInvoice(e){return passthrough("chooseInvoice",e)}function claimClassAdmin(e={}){return passthrough("claimClassAdmin",e)}function createChatWithMsg(e){return passthrough("createChatWithMsg",e)}function createCorpGroupChat(e){return passthrough("createCorpGroupChat",e,{groupName:e.groupName||"",userIds:e.userIds,openUserIds:e.openUserIds,externalUserIds:e.externalUserIds,corpGroupUserIds:e.corpGroupUserIds})}function createExternalPayment(e={}){return passthrough("createExternalPayment",e)}function createSchoolPayment(e){return passthrough("createSchoolPayment",e)}function discoverDevice(e){return passthrough("discoverDevice",e)}function enterHWOpenTalk(e){return passthrough("enterHWOpenTalk",e)}function enterpriseVerify(e={}){return passthrough("enterpriseVerify",e)}function getApprovalSelectedItems(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("getApprovalSelectedItems",{key:e.key});if(!t.selectedData)return t;try{t.selectedData=JSON.parse(t.selectedData)}catch(error){t.selectedData=[]}return t}))}function getContext(e={}){return passthrough("getContext",e)}function getCurCorpGroupChat(e={}){return passthrough("getCurCorpGroupChat",e)}function getCurCorpGroupContact(e){return passthrough("getCurCorpGroupContact",e)}function getCurExternalChat(e={}){return passthrough("getCurExternalChat",e)}function getCurExternalContact(e={}){return passthrough("getCurExternalContact",e)}function getShareInfo(e){return passthrough("getShareInfo",e)}function hideChatAttachmentMenu(e){return passthrough("hideChatAttachmentMenu",e)}function launchMiniprogram(e){return passthrough("launchMiniprogram",e,{appid:e.appid,path:addHTMLToPath(e.path),envVersion:e.envVersion})}function addHTMLToPath(e){if(!e||!isString(e))return;const[t,...n]=e.split("?");return n.length?`${t}.html?${n.join("?")}`:`${t}.html`}function navigateToAddCustomer(e={}){return passthrough("navigateToAddCustomer",e)}function navigateToKfChat(e){return passthrough("navigateToKfChat",e)}function openAddress(e={}){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const e=await invoke("editAddress");return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}))}function openAppComment(e={}){return passthrough("openAppComment",e)}function openAppDeviceDataAuth(e={}){return passthrough("openAppDeviceDataAuth",e)}function openAppManage(e={}){return passthrough("openAppManage",e)}function openAppPurchase(e){return passthrough("openAppPurchase",e)}function openBusinessView(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("openBusinessView",{businessType:e.businessType,queryString:e.queryString||"",envVersion:e.envVersion});if(!isAndroid||!t.extraData)return t;try{t.extraData=JSON.parse(t.extraData)}catch(error){t.extraData={}}return t}))}function openDeviceProfile(e){return passthrough("openDeviceProfile",e)}function openEnterpriseChat(e={}){return passthrough("openEnterpriseChat",e,{chatId:e.chatId||"",chatname:e.groupName||"",groupName:e.groupName||"",useridlist:joinList(e.userIds),userIds:joinList(e.userIds),openIds:joinList(e.openIds),externalUserIds:joinList(e.externalUserIds)})}function openExistedChatWithMsg(e){return passthrough("openExistedChatWithMsg",e)}function openThirdAppServiceChat(e={}){return passthrough("openThirdAppServiceChat",e)}function openUserProfile(e){return passthrough("openUserProfile",e)}function printFile(e){return passthrough("printFile",e)}function queryCurrHWOpenTalk(e={}){return passthrough("queryCurrHWOpenTalk",e)}function refundExternalPayment(e){return passthrough("refundExternalPayment",e)}function saveApprovalSelectedItems(e){return passthrough("saveApprovalSelectedItems",e,{key:e.key,selectedData:"string"==typeof e.selectedData?e.selectedData:JSON.stringify(e.selectedData)})}function scanQRCode(e={}){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("scanQRCode",{needResult:e.needResult?1:0,scanType:e.scanType||["qrCode","barCode"]});if(!isIOS)return t;const n=t.resultStr;if(!n)return t;let r;try{r=JSON.parse(n)}catch(error){}return t.resultStr=r?.scan_code?.scan_result,t}))}function selectCorpGroupContact(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("selectCorpGroupContact",e);if(!isString(t.result))return t;try{t.result=JSON.parse(t.result)}catch(error){}return t}))}function selectEnterpriseContact(e){return promiseToCallback(e,(async()=>{await tryEnsureConfigReady();const t=await invoke("selectEnterpriseContact",e);if(!isString(t.result))return t;try{t.result=JSON.parse(t.result)}catch(error){}return t}))}function selectExternalContact(e={}){return passthrough("selectExternalContact",e)}function selectPrivilegedContact(e){return passthrough("selectPrivilegedContact",e)}function sendChatMessage(e){return passthrough("sendChatMessage",e)}function setShareAttr(e={}){return passthrough("setShareAttr",e)}function shareToExternalChat(e){return passthrough("shareToExternalChat",e)}function shareToExternalContact(e){return passthrough("shareToExternalContact",e)}function shareToExternalMoments(e){return passthrough("shareToExternalMoments",e)}function startWecast(e={}){return passthrough("startWecast",e)}function thirdPartyOpenPage(e){return passthrough("thirdPartyOpenPage",e)}function updateCorpGroupChat(e){return passthrough("updateCorpGroupChat",e)}function updateEnterpriseChat(e){return passthrough("updateEnterpriseChat",e,{chatId:e.chatId,userIdsToAdd:joinList(e.userIdsToAdd)})}function updateMomentsSetting(e){return passthrough("updateMomentsSetting",e)}function setKeepScreenOn(e){return passthrough("setKeepScreenOn",e)}function initOpenData(e={}){return promiseToCallback(e,(async()=>{if(!isWeCom)return invokeOpenDataAgentConfig();const{result:e}=await ensureAgentConfigReady();if(!isWindows&&!win?.WeixinSandBox)throw new SDKError("Missing WeixinSandBox");if(win?.WWOpenData||await invoke("wwapp.initWwOpenData"),!win?.WWOpenData)throw new SDKError("Init WWOpenData failed");return win.WWOpenData.initJSSDK&&win.WWOpenData.initJSSDK({invoke:invoke,ensureAgentConfigReady:ensureAgentConfigReady}),e}))}async function invokeOpenDataAgentConfig(){if(!win?.WWOpenData?.agentConfig)throw new SDKError("Missing WWOpenData.agentConfig");const e=await resolveAgentConfigParams(getSignURL()),t=new Promise(((t,n)=>{win.WWOpenData.agentConfig({...e,success:t,fail:n})}));return t.then(handleAgentConfigSuccess,handleAgentConfigFail),t}function createTransparentIFrame(e){const t=document.createElement("iframe"),{style:n}=t;n.display="block",n.border="none",n.background="transparent",t.referrerPolicy="origin",t.setAttribute("frameborder","0"),t.setAttribute("allowtransparency","true");const r=resolveEl(e);return r&&r.appendChild(t),t}function resolveEl(e){return"string"==typeof e?document.querySelector(e):e}!function(e){e.CLProximityUnknown="0",e.CLProximityImmediate="1",e.CLProximityNear="2",e.CLProximityFar="3"}(Proximity||(Proximity={})),function(e){e.wgs84="wgs84",e.gcj02="gcj02"}(LocationType||(LocationType={})),function(e){e.wifi="wifi",e.network2g="2g",e.network3g="3g",e.network4g="4g",e.none="none",e.unknown="unknown"}(NetworkType||(NetworkType={})),function(e){e.video="video",e.image="image",e.file="file",e.video_and_image="video_and_image"}(ChooseMessageFileType||(ChooseMessageFileType={})),function(e){e.video="video",e.image="image",e.file="file"}(TempFileType||(TempFileType={})),function(e){e.original="original",e.compressed="compressed"}(SizeType||(SizeType={})),function(e){e.album="album",e.camera="camera"}(SourceType||(SourceType={})),function(e){e.normal="normal",e.batch="batch",e.front="front",e.batch_front="batch_front"}(CameraMode||(CameraMode={})),function(e){e[e.common=0]="common",e[e.corp_training=1]="corp_training",e[e.edu_normal_class=2]="edu_normal_class",e[e.edu_small_class=3]="edu_small_class"}(LiveType||(LiveType={})),function(e){e[e.other=0]="other",e[e.doc=3]="doc",e[e.sheet=4]="sheet",e[e.form=5]="form",e[e.slide=6]="slide",e[e.mindmap=7]="mindmap",e[e.flowchart=8]="flowchart",e[e.smartsheet=10]="smartsheet"}(WedocSelectedFileType||(WedocSelectedFileType={})),function(e){e[e.normal=0]="normal",e[e.scan=1]="scan"}(ProductViewType||(ProductViewType={})),function(e){e[e.chat=0]="chat",e[e.qrcode=1]="qrcode"}(CreateExternalPaymentType||(CreateExternalPaymentType={})),function(e){e.contact_profile="contact_profile",e.single_chat_tools="single_chat_tools",e.group_chat_tools="group_chat_tools",e.chat_attachment="chat_attachment",e.single_kf_tools="single_kf_tools",e.chain_single_chat_tools="chain_single_chat_tools",e.chain_group_chat_tools="chain_group_chat_tools",e.internal_group_chat_board="internal_group_chat_board",e.normal="normal"}(EntryType||(EntryType={})),function(e){e.permission="permission",e.datazone_permission="datazone_permission"}(OpenAppManagePageType||(OpenAppManagePageType={})),function(e){e.release="release",e.trial="trial",e.develop="develop"}(EnvVersion||(EnvVersion={})),function(e){e[e.internal=1]="internal",e[e.external=2]="external"}(OpenUserProfileType||(OpenUserProfileType={})),function(e){e[e.mediaid=1]="mediaid",e[e.url=2]="url",e[e.localId=4]="localId"}(PrintFileIdType||(PrintFileIdType={})),function(e){e.None="None",e.HWOpenTalk="HWOpenTalk",e.VoIP="VoIP",e.SystemCall="SystemCall"}(InTalkType||(InTalkType={})),function(e){e.qrCode="qrCode",e.barCode="barCode"}(ScanQRCodeType||(ScanQRCodeType={})),function(e){e.single="single",e.multi="multi"}(InputCorpGroupContactMode||(InputCorpGroupContactMode={})),function(e){e.department="department",e.user="user"}(InputCorpGroupContactType||(InputCorpGroupContactType={})),function(e){e.single="single",e.multi="multi"}(SelectEnterpriseContactMode||(SelectEnterpriseContactMode={})),function(e){e.department="department",e.user="user"}(SelectEnterpriseContactType||(SelectEnterpriseContactType={})),function(e){e[e.all=0]="all",e[e.unselected=1]="unselected"}(SelectExternalContactType||(SelectExternalContactType={})),function(e){e.single="single",e.multi="multi"}(SelectPrivilegedContactMode||(SelectPrivilegedContactMode={})),function(e){e.create_approval="10001",e.view_approval="10002"}(OAType||(OAType={})),function(e){e.link="link",e.text="text"}(OaExtDataType||(OaExtDataType={}));const clientId=random();let disposeModalFrame,uid=0;function genUid(){return`${clientId}-${uid++}`}function random(){return Math.random().toString(36).slice(2)}function normalizeError(e){return e&&"object"==typeof e?{...e,message:e.message,stack:e.stack}:e}function tryParseJSON(e){try{return"string"==typeof e?JSON.parse(e):e}catch(error){}}function useRemoteInvoke(e,t){const n=new Map;return{invoke:function(t,r){return r?.dropResult?(e({type:"ww-iframe-handle:call",args:t},r),Promise.resolve(void 0)):new Promise(((i,a)=>{const o=genUid();n.set(o,{resolve:i,reject:a}),e({type:"ww-iframe-handle:call",uid:o,args:t},r)}))},handleCallMessage:async function(n,r){if(!n.uid)return t(n.args,r);try{e({type:"ww-iframe-handle:response",uid:n.uid,kind:"resolve",args:await t(n.args,r)})}catch(error){throw e({type:"ww-iframe-handle:response",uid:n.uid,kind:"reject",args:normalizeError(error)}),error}},handleResponseMessage:function(e){const t=n.get(e.uid);t&&(t[e.kind](e.args),n.delete(e.uid))}}}function useIframeClient(e,t,n){const r=[];let i=!1,a=!1;function o(n){if(n.origin!==t||e.contentWindow!==n.source)return;const r=tryParseJSON(n.data);"string"==typeof r?.type&&r.type.startsWith("ww-iframe-handle:")&&p(r,n)}window.addEventListener("message",o);const s=new MessageChannel;s.port1.onmessage=e=>{p(tryParseJSON(e.data),e)};const{invoke:c,handleCallMessage:u,handleResponseMessage:l}=useRemoteInvoke((function(e,t){i?d(e,t):r.push({msg:e,opts:t})}),n);function p(e,t){switch(e.type){case"ww-iframe-handle:ready":return function(e){if(i)return;i=!0,e.supportChannel&&(d({type:"ww-iframe-handle:set-port",port:s.port2},{transfer:[s.port2],serialize:!1}),a=!0);for(const t of r)d(t.msg,t.opts)}(e);case"ww-iframe-handle:call":return u(e,t);case"ww-iframe-handle:response":return void l(e)}}function d(n,r){const i=!1===r?.serialize?n:JSON.stringify(n);a?s.port1.postMessage(i,r?.transfer):e.contentWindow?.postMessage(i,t,r?.transfer)}return e.addEventListener("load",(()=>{i||d({type:"ww-iframe-handle:init"})})),{el:e,invoke:c,dispose:function(){window.removeEventListener("message",o),s.port1.onmessage=null}}}async function resolveSuiteConfigParams(e){const t=getRegisterOptions();if(!t?.getSuiteConfigSignature)throw new SDKError("Missing getSuiteConfigSignature");const n=await t.getSuiteConfigSignature(e);return{suiteid:t.suiteId,timestamp:`${n.timestamp}`,nonceStr:n.nonceStr,signature:n.signature,jsApiList:mapJsApiListToClient(t.jsApiList||["agentConfig"])}}function has$1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function handleCallMsg(e,t,n){safeRun(t[e.name],e.payload||e.data,n)}function createMsgDispatcher(){const e=new Map;return{subscribe:function(t,n){e.set(t,n)},handleMessage:function(t){return e.get(t.type)?.(t)}}}function showModalFrame(e,t){disposeModalFrame?.();const n=createTransparentIFrame(document.body),{style:r}=n;r.position="fixed",r.left="0",r.top="0",r.zIndex="1000",r.width="100vw",r.height="100vh",n.classList.add("wecom-jssdk-modal"),n.setAttribute("src",e);const{origin:i}=new URL(e),a=useIframeClient(n,i,(e=>("close"===e.type&&o(),t?.(e))));function o(){a.dispose(),n.parentNode?.removeChild(n)}return disposeModalFrame=o,a}const FRAME_ORIGIN$1="https://login.work.weixin.qq.com";function createJSAPIPanel(e,t){const n=createTransparentIFrame(t.el),{style:r}=n;r.width="100%",r.height="100%";const i=new Map,{subscribe:a,handleMessage:o}=createMsgDispatcher(),{dispose:s}=useIframeClient(n,FRAME_ORIGIN$1,o);return a("call",(e=>{handleCallMsg(e,t)})),a("getStaticOptions",(()=>({name:e,options:{...t,el:void 0,params:void 0}}))),a("jsapiCallback",(e=>{if(!i.has(e.seq))return;const t=i.get(e.seq);i.delete(e.seq),safeRun("success"===e.kind?t?.success:t?.fail,e.payload),safeRun(t?.complete,e.payload)})),a("getJSAPIParams",(async n=>{const r=isFunction(t.params)?await t.params():t.params,a=getSignURL();return i.set(n.seq,r),{webToken:t.webToken,url:a,configParams:n.payload?.skipSignature?void 0:await resolveSignatureData(a,n.payload?.preferSignatureTypeList||["agentConfig"]),jsapi:e,jsapiParams:r}})),a("openModalFrame",(e=>{showModalFrame(e.payload.url)})),n.style.opacity="0",n.src="https://login.work.weixin.qq.com/wwopen/ww-jsapi-transparent-frame",{el:n,unmount(){s(),n.parentNode?.removeChild(n)}}}const resolveSignatureFnMap={agentConfig:resolveAgentConfigParams,suiteConfig:resolveSuiteConfigParams};async function resolveSignatureData(e,t){let n=new Error("Missing signature handler");for(const r of t)try{if(!has$1(resolveSignatureFnMap,r))continue;return{type:r,params:await resolveSignatureFnMap[r](e)}}catch(error){n=error}throw n}function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function isObject(e){return"object"==typeof e&&null!==e}function includes(e,t){return!!e&&e.indexOf(t)>=0}var createIdentifier=createBuilder("Identifier","name"),createLiteral=createBuilder("Literal","value");function createBuilder(e,t){return function(n){var r;return(r={type:e})[t]=n,r}}function isIdentifierStart(e){return isInRange(e,65,90)||isInRange(e,97,122)||36===e||95===e}function isIdentifierPart(e){return isIdentifierStart(e)||isDecimalDigit(e)}function isDecimalDigit(e){return isInRange(e,48,57)}function isHexDigit(e){return isDecimalDigit(e)||isInRange(e,65,70)||isInRange(e,97,102)}function isInRange(e,t,n){return e>=t&&e<=n}for(var LITERAL_NAME={null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},reserveWords="await break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),reserveWordMap={},_i=0,reserveWords_1=reserveWords;_i<reserveWords_1.length;_i++){var word=reserveWords_1[_i];reserveWordMap[word]=!0}function parseIdentifierReference(e){var t=parseIdentifierName(e);return has(LITERAL_NAME,t)?e.build(createLiteral(LITERAL_NAME[t])):(has(reserveWordMap,t)&&e.unexpected(t),e.build(createIdentifier(t)))}function parseIdentifier(e){var t=parseIdentifierName(e);return e.build(createIdentifier(t))}function parseIdentifierName(e){isIdentifierStart(e.peek())||e.unexpected();var t=e.index;do{e.next()}while(isIdentifierPart(e.peek()));return e.expr.slice(t,e.index)}function parseNumericLiteral(e){for(var t="";isDecimalDigit(e.peek());)t+=e.nextCh();if("0"===t){if(e.eat(120)||e.eat(88)){for(t="";isHexDigit(e.peek());)t+=e.nextCh();return t||e.unexpected(),e.build(createLiteral(parseInt(t,16)))}if(e.eat(98)||e.eat(66)){for(t="";48===e.peek()||49===e.peek();)t+=e.nextCh();return t||e.unexpected(),e.build(createLiteral(parseInt(t,2)))}}if(46===e.peek())for(t+=e.nextCh();isDecimalDigit(e.peek());)t+=e.nextCh();if(101===e.peek()||69===e.peek()){t+=e.nextCh(),43!==e.peek()&&45!==e.peek()||(t+=e.nextCh());for(var n=!1;isDecimalDigit(e.peek());)n=!0,t+=e.nextCh();n||e.unexpected()}return isIdentifierStart(e.peek())&&e.throw("Variable name cannot start with a number (".concat(t).concat(e.peekCh(),").")),46!==e.peek()&&"."!==t||e.unexpected(),e.build(createLiteral(parseFloat(t)))}var ESCAPE_CHARACTER={n:"\n",r:"\r",t:"\t"};function parseStringLiteral(e){for(var t,n=e.nextCh(),r="";t=e.nextCh();){if(t===n)return e.build(createLiteral(r));"\\"===t?(t=e.nextCh(),has(ESCAPE_CHARACTER,t)?r+=ESCAPE_CHARACTER[t]:r+=t):r+=t}e.unexpected()}function parsePrimaryExpression(e){var t=e.peek();return isDecimalDigit(t)||46===t?parseNumericLiteral(e):39===t||34===t?parseStringLiteral(e):isIdentifierStart(t)?parseIdentifierReference(e):void e.unexpected()}function parseLeftHandSideExpression(e){for(var t,n=parsePrimaryExpression(e);t=e.peek();)if(91!==t){if(!e.eat(46))break;n=buildMemberExpression(e,n)}else n=buildMemberExpression(e,n,!0);return n}function buildMemberExpression(e,t,n){var r;return void 0===n&&(n=!1),n?(e.expect(91),r=parseExpression(e),e.expect(93)):r=parseIdentifier(e),e.build({type:"MemberExpression",object:t,property:r,computed:n})}function parseExpression(e){return parseLeftHandSideExpression(e)}function createParserContext(e){return{expr:e,index:0,peek:function(){return this.expr.charCodeAt(this.index)},peekCh:function(){return this.expr.charAt(this.index)},next:function(){this.index+=1},nextCh:function(){return this.index+=1,this.expr.charAt(this.index-1)},eat:function(e){return this.peek()===e&&(this.next(),this.skipWhitespace(),!0)},expect:function(e){this.eat(e)||this.unexpected()},skip:function(e){this.index+=e,this.skipWhitespace()},skipWhitespace:function(){for(var t=e.charCodeAt(this.index);32===t||9===t||13===t||10===t;)this.index+=1,t=e.charCodeAt(this.index);return this.index},build:function(e){return this.skipWhitespace(),e},unexpected:function(t){if(!t&&this.index>=e.length)throw this.throw("Unexpected end of input.");throw this.throw("Unexpected token '".concat(t||this.peekCh(),"'."))},throw:function(e){throw new SyntaxError("".concat(e," (1:").concat(this.index,")"))}}}function parseDataPath(e){var t=createParserContext(e.trim()),n=parseExpression(t);return t.index!==t.expr.length&&t.unexpected(),n}var DEFAULT_PROTECTED_KEYS=["constrcutor","prototype","__proto__"];function patch(e,t,n){void 0===n&&(n={});for(var r=n.protectedKeys||DEFAULT_PROTECTED_KEYS,i=n.set||defaultSet,a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];if(!includes(r,s))if(includes(s,"[")||includes(s,"."))try{var c=extractPath(parseDataPath(s),r||[]);c?setIn(e,c,t[s],i):i(e,s,t[s])}catch(error){i(e,s,t[s])}else i(e,s,t[s])}}function extractPath(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),"Identifier"===e.type)return n.unshift(e.name),n;if("MemberExpression"===e.type){var r=e.object,i=e.property;if(e.computed){if("Literal"!==i.type)return;var a=i.value;if(includes(t,a))return;n.unshift(a)}else{if("Identifier"!==i.type)return;var o=i.name;if(includes(t,o))return;n.unshift(o)}return extractPath(r,t,n)}}function setIn(e,t,n,r){for(var i=e,a=0,o=t.length-1;a<o;a++){var s=t[a];has(i,s)&&isObject(i[s])||r(i,s,"string"==typeof t[a+1]?{}:[]),i=i[s]}return r(i,t[t.length-1],n),i}function defaultSet(e,t,n){e[t]=n}function cloneDeep(e){if(Array.isArray(e))return e.map(cloneDeep);if(null==e||"object"!=typeof e)return e;const t={};for(const n of Object.keys(e))t[n]=cloneDeep(e[n]);return t}const contextMap=new WeakMap;function setPluginContext(e,t){contextMap.set(e,t)}function getPluginContext(e){return contextMap.get(e)}function createOpenSessionInjector(e){return new Promise(((t,n)=>{win.WWOpenData.createOpenSessionInjector(e,((e,r)=>{e||!r?n(e||new Error("System error")):t(r)}))}))}function getHookNames(e){return Object.keys(e).filter((t=>"function"==typeof e[t]))}function removeHooks(e){return Object.entries(e).reduce(((e,[t,n])=>("function"!=typeof n&&(e[t]=n),e)),{})}const FRAME_ORIGIN="https://open.work.weixin.qq.com",BUSINESS_URL=`${FRAME_ORIGIN}/wwopen/ww-open-data-frame`,PROTECTED_DATA_KEYS=["constructor","prototype","__proto__","__ob__"];function createOpenDataFrameFactory(e){const t=isWeCom?initOpenData():void 0;let n=r();async function r(){if(isWeCom)try{return await t,createOpenSessionInjector({url:BUSINESS_URL})}catch(error){throw safeRun(e?.onError,error),safeRun(e?.handleError,error),error}}async function i(e){if(!isWeCom)return;const t=await n;t&&t(e)}return{createOpenDataFrame:function(e){if(!e.template)throw new Error("options.template is required");const a=createTransparentIFrame(e.el),o=t?.then((()=>win?.WWOpenData?.registerOpenFrame(a))),{subscribe:s,handleMessage:c}=createMsgDispatcher(),{invoke:u,dispose:l}=useIframeClient(a,FRAME_ORIGIN,c),p={el:a,data:cloneDeep(e.data)||{},setData:async function(e){patch(p.data,e,{protectedKeys:PROTECTED_DATA_KEYS}),await u({type:"update",options:{data:e}})},dispose:function(){l(),o?.then((e=>{win?.WWOpenData?.unregisterOpenFrame(e)}))},...e.methods};return setPluginContext(p,{frame:p,invoke:u,subscribe:s}),a.src=BUSINESS_URL,s("init",(async()=>({id:isWeCom?await o:void 0,hooks:getHookNames(e),options:removeHooks({...e,el:void 0,methods:void 0,data:p.data}),config:{support:["injectSession"]}}))),s("call",(t=>{let n=e;return"method"===t.kind&&(n=n.methods),handleCallMsg(t,n,p)})),s("injectSession",(async()=>{await i(a)})),s("refreshSession",(async()=>{n=r(),await i(a)})),s("invokeJsapi",(e=>invoke("wwapp.invokeJsApiByCallInfo",{callInfo:e.callInfo}))),s("invokeDownload",(e=>{if(!e.url.startsWith("https://open.work.weixin.qq.com/"))throw new Error("Invalid download url");const t=document.createElement("a");t.href=e.url,t.target="_blank",t.style.display="none",t.click()})),s("agentConfig",(async()=>{const e=getSignURL();return{url:e,params:await resolveAgentConfigParams(e)}})),s("modal",(async t=>{const n=isWeCom?"wecom-window":void 0;if("function"!=typeof e.handleModal)return{modalType:n};return{modalType:!1===e.handleModal({modalUrl:t.modalUrl,modalSize:t.modalSize})?"iframe":n}})),p}}}function showSecurityGatewayConfirmModal(e){const t=new URL("https://open.work.weixin.qq.com/wwopen/secureGateway/confirm");if(t.searchParams.set("confirm_id",e.confirmId),isIOS||isAndroid)return void(location.href=t.href);t.searchParams.set("modal","true");const n=showModalFrame(t.href,(t=>{switch(t.type){case"call":return handleCallMsg(t,e);case"close":return;default:throw new Error(`Unknown message type '${t.type}'`)}}));return{el:n.el,unmount(){n.dispose(),n.el.parentNode?.removeChild(n.el)}}}const SDK_VERSION="2.3.0";var WWLoginType,WWLoginLangType,WWLoginRedirectType,WWLoginPanelSizeType;!function(e){e.serviceApp="ServiceApp",e.corpApp="CorpApp"}(WWLoginType||(WWLoginType={})),function(e){e.zh="zh",e.en="en"}(WWLoginLangType||(WWLoginLangType={})),function(e){e.top="top",e.callback="callback",e.self="self"}(WWLoginRedirectType||(WWLoginRedirectType={})),function(e){e.middle="middle",e.small="small"}(WWLoginPanelSizeType||(WWLoginPanelSizeType={}));const PANEL_SIZE={[WWLoginPanelSizeType.middle]:["480px","416px"],[WWLoginPanelSizeType.small]:["320px","380px"]};function createWWLoginPanel(e){const{width:t,height:n}=getPanelSize(e.params?.panel_size),r=createTransparentIFrame(e.el),{style:i}=r;i.width=t,i.height=n;const{dispose:a}=useIframeClient(r,"https://login.work.weixin.qq.com",(t=>{if("call"===t.type)return handleCallMsg(t,e);throw new Error(`Unknown message type '${t.type}'`)})),o=new URL("https://login.work.weixin.qq.com/wwlogin/sso/login");for(const s of Object.keys(e.params||{}))o.searchParams.set(s,e.params[s]);return o.searchParams.set("version","2.3.0"),r.src=o.href,{el:r,unmount(){a(),r.parentNode?.removeChild(r)}}}function getPanelSize(e=WWLoginPanelSizeType.middle){const t=PANEL_SIZE[e]||PANEL_SIZE[WWLoginPanelSizeType.middle];return{width:t[0],height:t[1]}}function createSingleton(e){const t=new WeakMap;return(n,...r)=>(t.has(n)||t.set(n,e(n,...r)),t.get(n))}function createWeakRef(e){return"undefined"!=typeof WeakRef?new WeakRef(e):{deref:()=>e}}function createPlugin(e){return createSingleton((t=>{const n=getPluginContext(t);if(!n)throw new TypeError("Illegal invocation");return e(n)}))}const useRefManager=createPlugin((({frame:e,invoke:t,subscribe:n})=>{const r=new Map,i=new Map;return n("ref.event",(e=>{const t=i.get(e.refId);if(t)for(const n of t)n(e.data)})),n("refDispose",(e=>{r.delete(e.refId),i.delete(e.refId)})),{get:async function(n){const a=await t({type:"ref.get",name:n});if(!a)return;const o=r.get(a.refId)?.deref();if(o)return o;const s=function(n){i.has(n)||i.set(n,[]);const r=i.get(n);function a(e,r,i){return t({type:"ref.call",refId:n,name:e,data:r},i)}function o(e){return r.push(e),()=>{const t=r.indexOf(e);t>=0&&r.splice(t,1)}}return{frame:e,invoke:a,subscribe:o}}(a.refId);return r.set(a.refId,createWeakRef(s)),s}}}));function createSymbolKey(e){return"function"==typeof Symbol?Symbol(e):e}const MIN_PAGE_SIZE=65536,MAX_PAGE_SIZE=1048576;class BufferList{concat(){if(1===this.list.length)return stabilizeBufferItem(this.current);const e=new Uint8Array(this.list.reduce(((e,t)=>e+t.offset),0));return this.list.reduce(((t,n)=>(e.set(new Uint8Array(stabilizeBufferItem(n)),t),t+n.offset)),0),e.buffer}ensureCapacity(e){const t=this.current,n=t.offset+e;if(n<=t.size)return;const r=t.buffer;!r.resizable||n>r.maxByteLength?(this.current=this.createBufferItem(),this.list.push(this.current)):(t.size=Math.min(2*t.size,r.maxByteLength),r.resize(t.size))}createBufferItem(){const e=new ArrayBuffer(65536,{maxByteLength:1048576});return{view:new DataView(e),buffer:e,size:e.byteLength,offset:0}}constructor(){_define_property(this,"list",void 0),_define_property(this,"current",void 0),this.current=this.createBufferItem(),this.list=[this.current]}}function stabilizeBufferItem(e){return e.offset>=e.size?e.buffer:e.buffer.resizable&&e.buffer.transfer?e.buffer.transfer(e.offset):e.buffer.slice(0,e.offset)}var VariantType;!function(e){e[e.int32=1]="int32",e[e.float64=2]="float64",e[e.boolean=3]="boolean",e[e.null=4]="null",e[e[void 0]=5]="undefined",e[e.valueRef=6]="valueRef"}(VariantType||(VariantType={}));const MIN_INT32=-Math.pow(2,31),MAX_INT32=Math.pow(2,31);function create(){return{buffer:new BufferList,values:[],stringIndexMap:new Map}}function encode(e){return{buffer:e.buffer.concat(),values:e.values}}function uint8(e,t){e.buffer.ensureCapacity(1);const n=e.buffer.current;n.view.setUint8(n.offset,t),n.offset+=1}function int32(e,t){e.buffer.ensureCapacity(4);const n=e.buffer.current;n.view.setInt32(n.offset,t),n.offset+=4}function uint32(e,t){e.buffer.ensureCapacity(4);const n=e.buffer.current;n.view.setUint32(n.offset,t),n.offset+=4}function float64(e,t){e.buffer.ensureCapacity(8);const n=e.buffer.current;n.view.setFloat64(n.offset,t),n.offset+=8}function string(e,t){let n=e.stringIndexMap.get(t);n||(n=e.values.push(t),e.stringIndexMap.set(t,n)),uint32(e,n-1)}function unknown(e,t){uint32(e,e.values.push(t)-1)}function variant(e,t){if(null!==t)switch(typeof t){case"number":if(isInt32(t)){uint8(e,1),int32(e,t);break}uint8(e,2),float64(e,t);break;case"string":uint8(e,6),string(e,t);break;case"boolean":uint8(e,3),uint8(e,t?1:0);break;case"undefined":uint8(e,5);break;default:uint8(e,6),unknown(e,t)}else uint8(e,4)}function isInt32(e){return!!Number.isInteger(e)&&(MIN_INT32<=e&&e<MAX_INT32)}var CommandType,ValueType;!function(e){e[e.set=1]="set",e[e.call=2]="call",e[e.dispose=3]="dispose"}(CommandType||(CommandType={})),function(e){e[e.value=1]="value",e[e.ref=2]="ref"}(ValueType||(ValueType={}));const KEY_REFLECT_ID=createSymbolKey("__WECOM_REFLECT_ID__"),useReflectStore=createPlugin((({invoke:e})=>{const t="function"==typeof FinalizationRegistry?new FinalizationRegistry((function(e){uint8(o,3),uint32(o,e),c()})):null,n=new WeakSet;let r=1;const i=Promise.resolve();let a=!1,o=create();function s(e){n.has(e)?(uint8(o,2),uint32(o,e[KEY_REFLECT_ID])):(uint8(o,1),variant(o,e))}function c(){a||(a=!0,i.then(u))}function u(){a=!1;const t=encode(o);o=create(),e({type:"reflect.command",commands:t},{serialize:!1,dropResult:!0,transfer:[t.buffer]})}function l(){return r++}return{genReflectId:l,bind:function(e,r=l()){return n.has(e)?e[KEY_REFLECT_ID]:(e[KEY_REFLECT_ID]=r,n.add(e),t?.register(e,r),r)},set:function(e,t,n){const r=e[KEY_REFLECT_ID];if(!r)throw new TypeError("Illegal invocation");uint8(o,1),uint32(o,r),string(o,t),s(n),c()},call:function(e,t,n,r){const i=e[KEY_REFLECT_ID];if(!i)throw new TypeError("Illegal invocation");uint8(o,2),uint32(o,i),string(o,t),uint32(o,(r?r[KEY_REFLECT_ID]:0)??0),uint32(o,n.length),n.forEach(s),c()}}}));function _class_apply_descriptor_get(e,t){return t.get?t.get.call(e):t.value}function _class_extract_field_descriptor(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function _class_private_field_get(e,t){return _class_apply_descriptor_get(e,_class_extract_field_descriptor(e,t,"get"))}function _check_private_redeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _class_private_field_init(e,t,n){_check_private_redeclaration(e,t),t.set(e,n)}function _class_apply_descriptor_set(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}function _class_private_field_set(e,t,n){return _class_apply_descriptor_set(e,_class_extract_field_descriptor(e,t,"set"),n),n}const wrapper2NativeMap=new WeakMap,native2wrapperMap=new WeakMap;function setNativeObject(e,t){wrapper2NativeMap.set(e,t),native2wrapperMap.set(t,e)}function toNativeValue(e){return wrapper2NativeMap.has(e)?wrapper2NativeMap.get(e):e}function toWrappedValue(e){return native2wrapperMap.has(e)?native2wrapperMap.get(e):e}const PLACEHOLDER_SRC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";let placeholderImage=null;function getPlaceholderImage(){return placeholderImage||(placeholderImage=new Image,placeholderImage.src=PLACEHOLDER_SRC),placeholderImage}var _src=new WeakMap,_complete=new WeakMap,_error=new WeakMap;let _KEY_REFLECT_ID$3=KEY_REFLECT_ID;class ImageResource{get src(){return _class_private_field_get(this,_src)}get loading(){return!_class_private_field_get(this,_complete)}get complete(){return _class_private_field_get(this,_complete)}get error(){return _class_private_field_get(this,_error)}__handleSettled(e){_class_private_field_set(this,_complete,!0),_class_private_field_set(this,_error,e),e?safeRun(this.onerror,e):safeRun(this.onload,void 0)}constructor(e){_define_property(this,_KEY_REFLECT_ID$3,void 0),_define_property(this,"onload",void 0),_define_property(this,"onerror",void 0),_class_private_field_init(this,_src,{writable:!0,value:void 0}),_class_private_field_init(this,_complete,{writable:!0,value:!1}),_class_private_field_init(this,_error,{writable:!0,value:void 0}),_class_private_field_set(this,_src,e),setNativeObject(this,getPlaceholderImage())}}const useImageStore=createPlugin((({frame:e,invoke:t,subscribe:n})=>{const r=useReflectStore(e),i=new Map;function a(e,t){return"string"==typeof e?{type:"url",src:e}:{type:"arraybuffer",data:e,mime:t}}return n("image.settled",(e=>{const t=i.get(e.refId);i.delete(e.refId),t&&t(e)})),{createImage:function(e,n){const o=new ImageResource(e),s=r.bind(o);return t({type:"image.load",refId:s,data:a(e,n)},{serialize:"string"==typeof e}),i.set(s,(e=>{o.__handleSettled(e.error)})),o}}})),useRefEventManager=createSingleton((e=>{const t=new Map;return e.subscribe((e=>{if("event.trigger"!==e.type)return;const n=t.get(`${e.capture}|${e.name}`);if(!n?.size)return;const r=createCustomEvent(e.event);for(const t of Array.from(n))safeRun(t,r)})),{addListener:function(n,r,i){const a="boolean"==typeof i?i:!!i?.capture;t.has(`${a}|${n}`)||t.set(`${a}|${n}`,new Set);const o=t.get(`${a}|${n}`);o.size||e.invoke("event.subscribe",{name:n,capture:a}),o.add(r)},removeListener:function(n,r,i){const a="boolean"==typeof i?i:!!i?.capture;if(!t.has(`${a}|${n}`))return;const o=t.get(`${a}|${n}`);o.delete(r),o.size||e.invoke("event.unsubscribe",{name:n,capture:a})}}}));function createCustomEvent(e){const t=new CustomEvent(e.type,{detail:e.detail});for(const n of Object.keys(e))n in t||(t[n]=e[n]);return Object.defineProperties(t,{target:{value:e.target},currentTarget:{value:e.currentTarget}}),t}var _store$1=new WeakMap,_native$1=new WeakMap;let _KEY_REFLECT_ID$2=KEY_REFLECT_ID;class FrameCanvasPattern{setTransform(e){_class_private_field_get(this,_native$1).setTransform(e),_class_private_field_get(this,_store$1).call(this,"setTransform",[e])}constructor(e,t){_define_property(this,_KEY_REFLECT_ID$2,void 0),_class_private_field_init(this,_store$1,{writable:!0,value:void 0}),_class_private_field_init(this,_native$1,{writable:!0,value:void 0}),_class_private_field_set(this,_store$1,e),_class_private_field_set(this,_native$1,t),e.bind(this),setNativeObject(this,t)}}var _store1=new WeakMap,_native1=new WeakMap;let _KEY_REFLECT_ID1=KEY_REFLECT_ID;class FrameCanvasGradient{addColorStop(e,t){_class_private_field_get(this,_native1).addColorStop(e,t),_class_private_field_get(this,_store1).call(this,"addColorStop",[e,t])}constructor(e,t){_define_property(this,_KEY_REFLECT_ID1,void 0),_class_private_field_init(this,_store1,{writable:!0,value:void 0}),_class_private_field_init(this,_native1,{writable:!0,value:void 0}),_class_private_field_set(this,_store1,e),_class_private_field_set(this,_native1,t),e.bind(this),setNativeObject(this,t)}}const CANVAS_STYLE_PROPS=["fillStyle","filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","strokeStyle"],CANVAS_CONFIG_PROPS=["direction","font","fontKerning","fontStretch","fontVariantCaps","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","textAlign","textBaseline","textRendering","wordSpacing"],CANVAS_CONFIG_METHODS=["arc","arcTo","beginPath","bezierCurveTo","clip","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect","reset","resetTransform","restore","rotate","roundRect","save","scale","setLineDash","setTransform","transform","translate"],CANVAS_DRAW_METHODS=["clearRect","drawFocusIfNeeded","drawImage","fill","fillRect","fillText","stroke","strokeRect","strokeText"],CANVAS_LOCAL_METHODS=["getContextAttributes","getLineDash","getTransform","isContextLost","isPointInPath","isPointInStroke","measureText"],CANVAS_FACTORY_METHODS=[["createConicGradient",FrameCanvasGradient],["createLinearGradient",FrameCanvasGradient],["createPattern",FrameCanvasPattern],["createRadialGradient",FrameCanvasGradient]],KEY_INTERNAL=createSymbolKey("__WECOM_INTERNAL__"),createFrameContext=createSingleton(((e,t,n)=>new FrameCanvasRenderingContext2D(e,t,n)));let _KEY_INTERNAL=KEY_INTERNAL,_KEY_REFLECT_ID$1=KEY_REFLECT_ID;class FrameCanvasRenderingContext2D{constructor(e,t,n){_define_property(this,"canvas",void 0),_define_property(this,_KEY_INTERNAL,void 0),_define_property(this,_KEY_REFLECT_ID$1,void 0),this.canvas=e,this[KEY_INTERNAL]={store:t,native:n,props:Object.create(null)},t.bind(this),setNativeObject(this,n)}}const FrameContextProto=FrameCanvasRenderingContext2D.prototype;for(const e of CANVAS_STYLE_PROPS)Object.defineProperty(FrameContextProto,e,{configurable:!0,enumerable:!0,get(){const{native:t,props:n}=this[KEY_INTERNAL];return n[e]??toWrappedValue(t[e])},set(t){const{store:n,props:r}=this[KEY_INTERNAL];r[e]=toNativeValue(t),n.set(this,e,t)}});for(const e of CANVAS_CONFIG_PROPS)Object.defineProperty(FrameContextProto,e,{configurable:!0,enumerable:!0,get(){return toWrappedValue(this[KEY_INTERNAL].native[e])},set(t){const{store:n,native:r}=this[KEY_INTERNAL];r[e]=toNativeValue(t),n.set(this,e,t)}});for(const e of CANVAS_LOCAL_METHODS)FrameContextProto[e]=function(...t){const{native:n}=this[KEY_INTERNAL];return callNative(n,e,t)};for(const e of CANVAS_CONFIG_METHODS)FrameContextProto[e]=function(...t){const{store:n,native:r}=this[KEY_INTERNAL];callNative(r,e,t),n.call(this,e,t)};for(const e of CANVAS_DRAW_METHODS)FrameContextProto[e]=function(...t){const{store:n}=this[KEY_INTERNAL];n.call(this,e,t)};for(const[e,t]of CANVAS_FACTORY_METHODS)FrameContextProto[e]=function(...n){const{store:r,native:i}=this[KEY_INTERNAL],a=callNative(i,e,n),o=new t(r,a);return r.call(this,e,n,o),o};function callNative(e,t,n){switch(n.length){case 1:return e[t](n[0]);case 2:return e[t](n[0],n[1]);case 3:return e[t](n[0],n[1],n[2]);case 4:return e[t](n[0],n[1],n[2],n[3]);case 5:return e[t](n[0],n[1],n[2],n[3],n[4]);case 6:return e[t](n[0],n[1],n[2],n[3],n[4],n[5]);default:return e[t](...n)}}var _native=new WeakMap,_store=new WeakMap,_imageStore=new WeakMap,_refEvent=new WeakMap,_context=new WeakMap;let _KEY_REFLECT_ID=KEY_REFLECT_ID;class FrameCanvas{get width(){return _class_private_field_get(this,_native).width}set width(e){_class_private_field_get(this,_native).width=e,_class_private_field_get(this,_store).set(this,"width",e)}get height(){return _class_private_field_get(this,_native).height}set height(e){_class_private_field_get(this,_native).height=e,_class_private_field_get(this,_store).set(this,"height",e)}createImage(e,t){return _class_private_field_get(this,_imageStore).createImage(e,t)}getContext(e,t){if("2d"!==e)throw new Error(`Failed to execute 'getContext' on 'FrameCanvas': The provided value '${e}' is not a valid enum value of type RenderingContextType`);if(_class_private_field_get(this,_context))return _class_private_field_get(this,_context);const n=_class_private_field_get(this,_native).getContext(e,t);return _class_private_field_set(this,_context,createFrameContext(this,_class_private_field_get(this,_store),n)),_class_private_field_get(this,_store).call(this,"getContext",[e,t],_class_private_field_get(this,_context)),_class_private_field_get(this,_context)}addEventListener(e,t,n){_class_private_field_get(this,_refEvent).addListener(e,t,n)}removeEventListener(e,t,n){_class_private_field_get(this,_refEvent).removeListener(e,t,n)}constructor(e,t,n){_define_property(this,_KEY_REFLECT_ID,void 0),_class_private_field_init(this,_native,{writable:!0,value:void 0}),_class_private_field_init(this,_store,{writable:!0,value:void 0}),_class_private_field_init(this,_imageStore,{writable:!0,value:void 0}),_class_private_field_init(this,_refEvent,{writable:!0,value:void 0}),_class_private_field_init(this,_context,{writable:!0,value:void 0}),_class_private_field_set(this,_native,new OffscreenCanvas(n.width,n.height)),_class_private_field_set(this,_store,useReflectStore(e.frame)),_class_private_field_get(this,_store).bind(this,t),_class_private_field_set(this,_imageStore,useImageStore(e.frame)),_class_private_field_set(this,_refEvent,useRefEventManager(e)),setNativeObject(this,_class_private_field_get(this,_native))}}const ref2canvasMap=new WeakMap,getCanvasId=createSingleton((e=>{const{genReflectId:t}=useReflectStore(e.frame);return t()}));async function getCanvas(e,t){const{get:n}=useRefManager(e),r=await n(t);if(!r)return;if(ref2canvasMap.has(r))return ref2canvasMap.get(r);const i=getCanvasId(r),a=await r.invoke("bind",{refId:i});return a?(ref2canvasMap.has(r)||ref2canvasMap.set(r,new FrameCanvas(r,i,a)),ref2canvasMap.get(r)):void 0}const getScrollViewContext=createSingleton((e=>({scrollTo(t){e.invoke("scrollTo",t)},scrollIntoView(t,n){e.invoke("scrollIntoView",{selector:t,options:n})}})));async function createScrollViewContext(e,t){const{get:n}=useRefManager(e),r=await n(t);if(r)return getScrollViewContext(r)}async function getNodeInfo(e,t,n){const{get:r}=useRefManager(e),i=await r(t);if(i)return i.invoke("nodeInfo.get",{fields:n})}function hex_sha1(e){return rstr2hex(rstr_sha1(e))}function rstr_sha1(e){return binb2rstr(binb_sha1(rstr2binb(e),8*e.length))}function rstr2hex(e){const t="0123456789abcdef";let n,r="";for(let i=0;i<e.length;i++)n=e.charCodeAt(i),r+=t.charAt(n>>>4&15)+t.charAt(15&n);return r}function rstr2binb(e){const t=new Array(e.length>>2);for(let n=0;n<t.length;n++)t[n]=0;for(let n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function binb2rstr(e){let t="";for(let n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}function binb_sha1(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;const n=new Array(80);let r=1732584193,i=-271733879,a=-1732584194,o=271733878,s=-1009589776;for(let c=0;c<e.length;c+=16){const t=r,u=i,l=a,p=o,d=s;for(let f=0;f<80;f++){n[f]=f<16?e[c+f]:bit_rol(n[f-3]^n[f-8]^n[f-14]^n[f-16],1);const t=safe_add(safe_add(bit_rol(r,5),sha1_ft(f,i,a,o)),safe_add(safe_add(s,n[f]),sha1_kt(f)));s=o,o=a,a=bit_rol(i,30),i=r,r=t}r=safe_add(r,t),i=safe_add(i,u),a=safe_add(a,l),o=safe_add(o,p),s=safe_add(s,d)}return[r,i,a,o,s]}function sha1_ft(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function sha1_kt(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function safe_add(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function bit_rol(e,t){return e<<t|e>>>32-t}function getSignature(e){let t=e;"string"==typeof e&&(t={ticket:e});const n=t.nonceStr||random(),r=t.timestamp||Math.floor(Date.now()/1e3),i=t.url||getHref().split("#")[0];return{timestamp:r,nonceStr:n,signature:hex_sha1(`jsapi_ticket=${t.ticket}&noncestr=${n}&timestamp=${r}&url=${i}`)}}const env={isWeChat:isWeChat,isWeCom:isWeCom},IS_WECOM_SDK=!0;export{CameraMode,ChooseMessageFileType,CreateExternalPaymentType,EntryType,EnvVersion,FrameCanvas,IS_WECOM_SDK,InTalkType,InputCorpGroupContactMode,InputCorpGroupContactType,LiveType,LocationType,NetworkType,OAType,OaExtDataType,OpenAppManagePageType,OpenUserProfileType,PrintFileIdType,ProductViewType,Proximity,SDK_VERSION,ScanQRCodeType,SelectEnterpriseContactMode,SelectEnterpriseContactType,SelectExternalContactType,SelectPrivilegedContactMode,SizeType,SourceType,TempFileType,WWLoginLangType,WWLoginPanelSizeType,WWLoginRedirectType,WWLoginType,WedocSelectedFileType,addCard,addDevice,checkJsApi,checkSchedule,chooseCard,chooseImage,chooseInvoice,chooseMessageFile,chooseWXPay,claimClassAdmin,closeBLEConnection,closeBluetoothAdapter,closeWindow,connectWifi,consumeAndShareCard,createBLEConnection,createChatWithMsg,createCorpGroupChat,createDoc,createExternalPayment,createJSAPIPanel,createOpenDataFrameFactory,createSchoolPayment,createScrollViewContext,createWWLoginPanel,discoverDevice,downloadImage,downloadLivingReplay,downloadVoice,ensureAgentConfigReady,ensureConfigReady,ensureCorpConfigReady,enterHWOpenTalk,enterpriseVerify,env,getApprovalSelectedItems,getBLEDeviceCharacteristics,getBLEDeviceServices,getBeacons,getBluetoothAdapterState,getBluetoothDevices,getCanvas,getClipboardData,getConnectedBluetoothDevices,getConnectedWifi,getContext,getCurCorpGroupChat,getCurCorpGroupContact,getCurExternalChat,getCurExternalContact,getLocalFileData,getLocalImgData,getLocation,getNetworkType,getNodeInfo,getShareInfo,getSignature,getVerifyParams,getWifiList,hideAllNonBaseMenuItem,hideChatAttachmentMenu,hideMenuItems,hideOptionMenu,initOpenData,invoke,isWeixinJSBridgeReady,launchMiniprogram,navigateToAddCustomer,navigateToKfChat,notifyBLECharacteristicValueChange,on,onBLECharacteristicValueChange,onBLEConnectionStateChange,onBeaconServiceChange,onBeaconUpdate,onBluetoothAdapterStateChange,onBluetoothDeviceFound,onGetWifiList,onHistoryBack,onLocationChange,onMenuShareAppMessage,onMenuShareQQ,onMenuShareQZone,onMenuShareTimeline,onMenuShareWechat,onMenuShareWeibo,onNetworkStatusChange,onSearchBeacons,onUserCaptureScreen,onVoicePlayEnd,onVoiceRecordEnd,onWeixinJSBridgeReady,onWifiConnected,openAddress,openAppComment,openAppDeviceDataAuth,openAppManage,openAppPurchase,openBluetoothAdapter,openBusinessView,openCard,openDefaultBrowser,openDeviceProfile,openEnterpriseChat,openEnterpriseRedPacket,openExistedChatWithMsg,openLocation,openProductSpecificView,openThirdAppServiceChat,openUserProfile,pauseVoice,playVoice,previewFile,previewImage,printFile,queryCurrHWOpenTalk,readBLECharacteristicValue,refundExternalPayment,register,replayLiving,saveApprovalSelectedItems,scanQRCode,selectCorpGroupContact,selectEnterpriseContact,selectExternalContact,selectPrivilegedContact,sendChatMessage,setClipboardData,setKeepScreenOn,setShareAttr,shareAppMessage,shareToExternalChat,shareToExternalContact,shareToExternalMoments,shareWechatMessage,showAllNonBaseMenuItem,showMenuItems,showOptionMenu,showSecurityGatewayConfirmModal,startAutoLBS,startBeaconDiscovery,startBluetoothDevicesDiscovery,startLiving,startMeeting,startRecord,startSearchBeacons,startWecast,startWifi,stopAutoLBS,stopBeaconDiscovery,stopBluetoothDevicesDiscovery,stopRecord,stopSearchBeacons,stopVoice,stopWifi,thirdPartyOpenPage,translateVoice,updateAppMessageShareData,updateCorpGroupChat,updateEnterpriseChat,updateMomentsSetting,updateTimelineShareData,uploadImage,uploadVoice,wedocSelectDoc,wedriveSelectDir,wedriveSelectFile,wedriveSelectFileForDownload,wedriveSelectFileForShare,writeBLECharacteristicValue};