@dimina-kit/devtools 0.4.0-dev.20260801163345 → 0.4.0-dev.20260824071518
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/app/app.js +12 -1
- package/dist/main/index.bundle.js +584 -323
- package/dist/main/ipc/index.d.ts +1 -0
- package/dist/main/ipc/index.js +1 -0
- package/dist/main/ipc/session.js +11 -0
- package/dist/main/ipc/tooltip.d.ts +13 -0
- package/dist/main/ipc/tooltip.js +28 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +2 -1
- package/dist/main/services/notifications/renderer-notifier.d.ts +2 -0
- package/dist/main/services/notifications/renderer-notifier.js +7 -1
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +79 -130
- package/dist/main/services/views/console-filter.js +140 -183
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/host-toolbar-view.js +5 -18
- package/dist/main/services/views/native-simulator-devtools-host.js +64 -45
- package/dist/main/services/views/native-simulator-view.js +6 -24
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +27 -4
- package/dist/main/services/views/overlay-panels-view.js +138 -109
- package/dist/main/services/views/placement-reconciler.d.ts +4 -16
- package/dist/main/services/views/placement-reconciler.js +64 -29
- package/dist/main/services/views/placement-test-driver.d.ts +26 -0
- package/dist/main/services/views/placement-test-driver.js +26 -0
- package/dist/main/services/views/view-manager.d.ts +5 -9
- package/dist/main/services/views/view-manager.js +7 -1
- package/dist/main/services/views/workbench-view.js +27 -20
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +32 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +21 -8
- package/dist/main/services/workspace/rebuild-status.js +24 -8
- package/dist/main/utils/sender-policy.d.ts +1 -1
- package/dist/main/utils/sender-policy.js +6 -1
- package/dist/main/utils/theme.d.ts +7 -2
- package/dist/main/utils/theme.js +8 -3
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +1966 -1816
- package/dist/native-host/service/service.js +1 -1
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/main.cjs +3176 -14
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +5 -2
- package/dist/preload/windows/simulator.cjs.map +2 -2
- package/dist/preload/windows/simulator.js +5 -2
- package/dist/renderer/assets/constants-Bdz0LHdy.js +2 -0
- package/dist/renderer/assets/index-CtznrmHR.js +49 -0
- package/dist/renderer/assets/{input-xdmfv-eH.js → input-Dmm6nob5.js} +2 -2
- package/dist/renderer/assets/ipc-transport-BOg0gR9W.js +9 -0
- package/dist/renderer/assets/ipc-transport-DgQhZaE9.css +1 -0
- package/dist/renderer/assets/popover-Cd1FEGOX.js +2 -0
- package/dist/renderer/assets/select-BaYox7If.js +2 -0
- package/dist/renderer/assets/settings-BXvwuFaz.js +2 -0
- package/dist/renderer/assets/settings-api-Bo9GbYqs.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-Beia6lMr.js +2 -0
- package/dist/renderer/assets/tooltip-DfQqK3Sk.js +2 -0
- package/dist/renderer/assets/view-api-nn69je7A.js +2 -0
- package/dist/renderer/assets/workbenchSettings-oq_EyfKf.js +8 -0
- package/dist/renderer/entries/main/index.html +8 -7
- package/dist/renderer/entries/popover/index.html +7 -6
- package/dist/renderer/entries/settings/index.html +7 -5
- package/dist/renderer/entries/tooltip/index.html +20 -0
- package/dist/renderer/entries/workbench-settings/index.html +7 -5
- package/dist/service-host/sync-impls/menu-button-geometry.js +1 -0
- package/dist/shared/ipc-channels.d.ts +11 -0
- package/dist/shared/ipc-channels.js +28 -2
- package/dist/shared/ipc-schemas.d.ts +19 -0
- package/dist/shared/ipc-schemas.js +23 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/types.d.ts +7 -0
- package/dist/shared/view-ids.d.ts +2 -0
- package/dist/shared/view-ids.js +11 -0
- package/dist/simulator/assets/device-shell-CmtM1QxP.js +2 -0
- package/dist/simulator/assets/device-shell-iFZo1igL.css +1 -0
- package/dist/simulator/assets/{simulator-COIE6R49.js → simulator-CIobn3Mh.js} +6 -6
- package/dist/simulator/assets/{simulator-mini-app-BLn7XV8e.js → simulator-mini-app-CRe6n9br.js} +2 -2
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-C_cP602X.js +2 -0
- package/dist/simulator/simulator.html +3 -2
- package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-oHcwN53f.js → dist-CMfmHflW.js} +3 -3
- package/dist/vscode-workbench/assets/{iconv-lite-umd-CLMLpdGm.js → iconv-lite-umd-Bx8CgaZq.js} +1 -1
- package/dist/vscode-workbench/assets/{index-BE3UJdoH.js → index-CdG6YWhW.js} +436 -436
- package/dist/vscode-workbench/assets/{jschardet-BICW8PLJ.js → jschardet-M0qgd2lN.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +7 -6
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BBg3YI5b.js +0 -49
- package/dist/renderer/assets/ipc-transport-B3EpmfNS.js +0 -9
- package/dist/renderer/assets/ipc-transport-Blac3sOj.css +0 -1
- package/dist/renderer/assets/popover-B88e2hkg.js +0 -2
- package/dist/renderer/assets/select-CD9CJyhI.js +0 -2
- package/dist/renderer/assets/settings-44hf0QtO.js +0 -2
- package/dist/renderer/assets/settings-api-pJKPuP1M.js +0 -2
- package/dist/renderer/assets/workbenchSettings-DKD5U1Ql.js +0 -8
- package/dist/simulator/assets/device-shell-Cw7c-IkG.js +0 -2
- package/dist/simulator/assets/device-shell-DbC5ccs8.css +0 -1
- package/dist/simulator/assets/jsx-runtime-DkKmJyBb.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -18
- package/dist/vscode-workbench/assets/__vite-browser-external-BON7qP59.js +0 -1
|
@@ -3,4 +3,4 @@ var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i
|
|
|
3
3
|
msg: ${t.message}
|
|
4
4
|
stack:
|
|
5
5
|
${t.stack}
|
|
6
|
-
`;console.error(`require ${e} error: ${a}`),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}b.async=async e=>new Promise((t,n)=>{try{t(b(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var x=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},oe=`__dimina_data_function_reference__`,se=1;function ce(e){return{[oe]:e,version:se}}function le(e){return typeof e==`object`&&!!e&&e.version===se&&typeof e[oe]==`string`&&Object.keys(e).length===2}function ue(e){return le(e)?e[oe]:void 0}function de(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(le(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=de(e[a],{mapFunction:t,mapReference:n},r);return i}var fe=new Set([String,Number,Boolean,Object,Array,null]);function pe(e){return fe.has(e)}function me(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function he(e){return Array.isArray(e)?e.filter(pe):[]}function ge(e){let t,n=[],r;return pe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=he(e.optionalTypes),r=e.value),pe(t)||(t=n[0]??null),r===void 0&&(r=me(t)),{type:t,optionalTypes:n,value:y(r)}}function _e(e){return Array.isArray(e)}function ve(e){return _e(e)&&e?.constructor?.name===Array.name}function ye(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?ve(t):t!==void 0}function be(e,t){typeof e==`function`&&e(t)}function xe(e,t,{absent:n=!1,warn:r}={}){if(n)return y(e.value);for(let n of e.optionalTypes||[])if(ye(n,t))return t;let i=e.type;if(i===String)return t==null?(be(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&be(r,`property received type-uncompatible value: expected <String> but got object-typed value. Forcely converted.`),String(t));if(i===Number){try{if(Number.isFinite(Number(t)))return Number(t)}catch{}return be(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?_e(t)?t:(be(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(be(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var S=new class{constructor(){this.listeners=new Set,this.reset()}reset(){this.active=!1,this.snapshot={systemInfo:null,menuRect:null}}init(e={}){this.active=!0,this.snapshot={...this.snapshot,...e}}update(e={}){this.snapshot={...this.snapshot,...e},this.listeners.forEach(t=>t(e,this.snapshot))}onUpdate(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function Se(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var Ce=new WeakMap,we=new Map;function Te(e){let t=Ce.get(e);if(t)return we.set(t,e),t;let n;do n=`data-function-${p()}`;while(we.has(n));return Ce.set(e,n),we.set(n,e),n}function Ee(e){return we.get(e)}function De(e){return de(e,{mapFunction(e){return ce(Te(e))}})}function Oe(e){return de(e,{mapReference(e){return Ee(ue(e))||e}})}var C=new class e{constructor(){this.event=Se(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){let t=Oe(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=De(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=De(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return _?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},w=new class{#e=[];#t=``;setInitId(e){this.#t=e}push(e,t){this.stack(t).push(e)}pop(){this.stack().length>0&&this.stack().pop()}remove(e){for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t].pages,r=n.findIndex(t=>t.id===e);if(r!==-1){n.splice(r,1);return}}}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function ke(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var Ae={getWindowInfo:()=>ke(S.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>S.getSystemInfo(),getAppBaseInfo:()=>ke(S.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>ke(S.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>S.getMenuRect()},je=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),Me=new Set(`FileSystemManager.getSavedFileList,clearStorage,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function Ne(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function Pe(e,t){return je.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||Me.has(e)}function Fe(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:w.getPageInfo().id,params:t}};return n===`container`?C.invoke(r):C.send(r)}function Ie(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{x.remove(a),x.remove(o)};a=x.store(e=>{s(),r(e)}),o=x.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{Fe(e,t,n)}catch(e){s(),i(e)}})}function T(e,t,r=`container`){let i=Ae[e];if(r===`container`&&i){let e=i();if(e)return e}let a;if(t===void 0){if(Pe(e,t))return Ie(e,{},r);a=t}else if(typeof t==`string`||Array.isArray(t))a=t;else if(n(t))a={success:x.store(t,!0)};else if(Ne(t)){let{success:e,fail:r,complete:i,keep:o,evtId:s,...c}=t;a=c,s!==void 0&&(a.evtId=s),n(e)?a.success=x.store(e,o,s):a.success=e,n(r)&&(a.fail=x.store(r,o,s)),n(i)&&(a.complete=x.store(i,o,s))}else{let{keep:n,...i}=t;if(delete i.evtId,!n&&Pe(e,t))return a={...i},Ie(e,a,r);a=i}return Fe(e,a,r)}var Le=t({navigateBack:()=>He,navigateTo:()=>Ve,reLaunch:()=>ze,redirectTo:()=>Be,switchTab:()=>Re});function Re(e){return e.url=te(w.getPageInfo().route,e.url),T(`switchTab`,e)}function ze(e){return e.url=te(w.getPageInfo().route,e.url),T(`reLaunch`,e)}function Be(e){let t=te(w.getPageInfo().route,e.url);if(w.getPageInfo().route!==t)return e.url=t,T(`redirectTo`,e)}function Ve(e){return e.url=te(w.getPageInfo().route,e.url),T(`navigateTo`,e)}function He(e){return T(`navigateBack`,e)}var Ue=t({offAppHide:()=>Ye,offAppShow:()=>Je,offError:()=>Ge,onAppHide:()=>qe,onAppRoute:()=>Qe,onAppShow:()=>Ke,onError:()=>We,onPageNotFound:()=>Ze,onUnhandledRejection:()=>Xe});function We(e){return T(`onError`,e)}function Ge(e){return T(`offError`,e)}function Ke(e){return T(`onAppShow`,e)}function qe(e){return T(`onAppHide`,e)}function Je(e){return T(`offAppShow`,e)}function Ye(e){return T(`offAppHide`,e)}function Xe(){}function Ze(){}function Qe(){}var $e=`__diminaArrayBufferBase64`,et=`__diminaFileDataBase64`,tt=`__diminaFileDataType`,E=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,nt=(()=>{let e={};for(let t=0;t<64;t++)e[E[t]]=t;return e})();function rt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function it(e){return e&&e.buffer&&rt(e.buffer)}function at(e){return rt(e)?e:it(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function ot(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=E[t[r]>>2],n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2|t[r+2]>>6],n+=E[t[r+2]&63];return r<t.length&&(n+=E[t[r]>>2],r+1<t.length?(n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2],n+=`=`):(n+=E[(t[r]&3)<<4],n+=`==`)),n}function st(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=nt[t[e]],o=nt[t[e+1]],s=t[e+2]===`=`?0:nt[t[e+2]],c=t[e+3]===`=`?0:nt[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function ct(e){let t=at(e);return t?{[tt]:`base64`,[et]:ot(t)}:e}function D(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=ct(n[e]));return n}function lt(e){return e&&typeof e==`object`&&e[$e]!==void 0?st(e[$e]):e}function ut(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:lt(e.data)}:e}function dt(e){if(!e||typeof e!=`object`||!e.entries||typeof e.entries!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.entries))t[n]=r&&typeof r==`object`&&r.data!==void 0?{...r,data:lt(r.data)}:r;return{...e,entries:t}}function ft(e,t,n=0){if(!e||typeof e!=`object`||!t||e[$e]===void 0)return e;let r=new Uint8Array(st(e[$e]));new Uint8Array(t).set(r,n);let{[$e]:i,...a}=e;return{...a,arrayBuffer:t}}function pt(e){let t={...e},n=at(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var mt=class{constructor(e={}){this.mode=e.mode,this.size=e.size,this.lastAccessedTime=e.lastAccessedTime,this.lastModifiedTime=e.lastModifiedTime,this._isDirectory=!!e.isDirectory,this._isFile=!!e.isFile}isDirectory(){return this._isDirectory}isFile(){return this._isFile}};function ht(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function gt(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if(ht(e))return new mt(e);if(Array.isArray(e))return e.map(e=>gt(e));let t={};for(let[n,r]of Object.entries(e))t[n]=gt(r);return t}function _t(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:gt(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:gt(e.statsMap)}}return gt(e)}function vt(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function O(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=T(e,r(vt(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function yt(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return O(e,t,{prepare:pt,transform:e=>ft(e,n,r)})}var bt=class{access(e){return O(`FileSystemManager.access`,e)}accessSync(e){return T(`FileSystemManager.accessSync`,e)}appendFile(e){return O(`FileSystemManager.appendFile`,e,{prepare:D})}appendFileSync(e,t,n){return T(`FileSystemManager.appendFileSync`,D({filePath:e,data:t,encoding:n}))}close(e){return O(`FileSystemManager.close`,e)}closeSync(e){return T(`FileSystemManager.closeSync`,e)}copyFile(e){return O(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return T(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return O(`FileSystemManager.fstat`,e,{transform:_t})}fstatSync(e){return _t(T(`FileSystemManager.fstatSync`,e))}ftruncate(e){return O(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return T(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return O(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return O(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return O(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return T(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return O(`FileSystemManager.open`,e)}openSync(e){return T(`FileSystemManager.openSync`,e)}read(e){return yt(`FileSystemManager.read`,e)}readSync(e){return ft(T(`FileSystemManager.readSync`,pt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return O(`FileSystemManager.readCompressedFile`,e,{transform:ut})}readCompressedFileSync(e){return lt(T(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return O(`FileSystemManager.readdir`,e)}readdirSync(e){return T(`FileSystemManager.readdirSync`,e)}readFile(e){return O(`FileSystemManager.readFile`,e,{transform:ut})}readFileSync(e,t,n,r){return lt(T(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return O(`FileSystemManager.readZipEntry`,e,{transform:dt})}removeSavedFile(e){return O(`FileSystemManager.removeSavedFile`,e)}rename(e){return O(`FileSystemManager.rename`,e)}renameSync(e,t){return T(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return O(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return T(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return O(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return T(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return O(`FileSystemManager.stat`,e,{transform:_t})}statSync(e,t){return _t(T(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return O(`FileSystemManager.truncate`,e)}truncateSync(e,t){return T(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return O(`FileSystemManager.unlink`,e)}unlinkSync(e){return T(`FileSystemManager.unlinkSync`,e)}unzip(e){return O(`FileSystemManager.unzip`,e)}write(e){return O(`FileSystemManager.write`,e,{prepare:e=>D(e,[`arrayBuffer`,`data`])})}writeSync(e){return T(`FileSystemManager.writeSync`,D(e,[`arrayBuffer`,`data`]))}writeFile(e){return O(`FileSystemManager.writeFile`,e,{prepare:D})}writeFileSync(e,t,n){return T(`FileSystemManager.writeFileSync`,D({filePath:e,data:t,encoding:n}))}};Object.getOwnPropertyNames(bt.prototype).filter(e=>e!==`constructor`);var xt=null;function St(){return xt||=new bt,xt}var Ct=t({USER_DATA_PATH:()=>wt,fileSystemManagerAPINames:()=>Tt,getFileSystemManager:()=>Mt}),wt=`difile://usr`,Tt=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],Et=`is not supported by the devtools simulator: the service thread talks to the container over an asynchronous postMessage bridge, so a synchronous return value is impossible — use the async variant`,Dt=`not supported by the devtools simulator (no container backend)`;function Ot(e){return function(){throw Error(`FileSystemManager.${e} ${Et}`)}}function kt(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${Dt}`}),t.complete?.()}}function At(e){let t=Object.getPrototypeOf(e),n=new Set(Tt);for(let e of Object.getOwnPropertyNames(t))e===`constructor`||n.has(e)||(t[e]=e.endsWith(`Sync`)?Ot(e):kt(e));return e}var jt;function Mt(){return jt||=At(St()),jt}var Nt=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],Pt=t({canIUse:()=>Rt,env:()=>Ft}),Ft={USER_DATA_PATH:`difile://usr`},It=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,...Nt.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...Tt.map(e=>`FileSystemManager.${e}`)]),Lt={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function Rt(e){if(It.has(e))return!0;try{return T(`canIUse`,Object.hasOwn(Lt,e)?Lt[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var zt=t({getPerformance:()=>Bt});function Bt(){return Vt.getInstance()}var Vt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Ht,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new Ut(this,e)}getEntries(){return this.entryList.getEntries()}getEntriesByName(e,t){return this.entryList.getEntriesByName(e,t)}getEntriesByType(e){return this.entryList.getEntriesByType(e)}setBufferSize(e){this.entryList.maxEntrySize=e}},Ht=class{constructor(){this._list=[],this.maxEntrySize=30}push(e){for(let t of e)this._list.length>=this.maxEntrySize&&this._list.shift(),this._list.push(t)}getEntriesByName(e,t){return this._entryFilter(e,t)}getEntriesByType(e){return this._entryFilter(null,e)}_entryFilter(e,t){return this._list.filter(n=>!(e&&e!==n.name||t&&t!==n.entryType))}getEntries(){return this._list}},Ut=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=x.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){T(`removePerformanceObserver`,{observerId:e.observerId},`render`),x.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),T(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new Ht;t.push(e.filter(e=>{let t=!1;return this.entryTypes&&this.entryTypes.length>0&&this.entryTypes.forEach(n=>{e.entryType===n&&(t=!0)}),t})),typeof this.callback==`function`&&this.callback(t)}}disconnect(){this.connected=!1,this.observerId&&T(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&x.remove(this.callbackId),this.observerId=null,this.callbackId=null}},Wt=t({loadSubpackage:()=>Kt,preDownloadSubpackage:()=>Gt});function Gt(e){return T(`preDownloadSubpackage`,e)}function Kt(e){return T(`loadSubpackage`,e)}var qt=t({getAppBaseInfo:()=>tn,getDeviceInfo:()=>nn,getSystemInfo:()=>Qt,getSystemInfoAsync:()=>en,getSystemInfoSync:()=>$t,getWindowInfo:()=>Xt,offThemeChange:()=>an,onThemeChange:()=>rn,openAppAuthorizeSetting:()=>Zt,openSystemBluetoothSetting:()=>Yt}),Jt=new Set;S.onUpdate(e=>{let t=e.systemInfo?.theme;t&&Jt.forEach(e=>e({theme:t}))});function Yt(e){return T(`openSystemBluetoothSetting`,e)}function Xt(e){return T(`getWindowInfo`,e)}function Zt(e){return T(`openAppAuthorizeSetting`,e)}function Qt(e){return new Promise(t=>{t(T(`getSystemInfo`,e))})}function $t(){return T(`getSystemInfoSync`)}function en(e){return T(`getSystemInfoAsync`,e)}function tn(){return T(`getAppBaseInfo`)}function nn(){return T(`getDeviceInfo`)}function rn(e){n(e)&&Jt.add(e)}function an(e){n(e)?Jt.delete(e):Jt.clear()}var on=t({getUpdateManager:()=>fn}),sn=`onUpdateStatusChange`,cn=`updatefail`,ln=`updateready`,un=`noupdate`,dn=`updating`;function fn(){return pn.getInstance()}var pn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],C.on(sn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===cn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===ln){let e=this.checkForUpdateResult?.hasUpdate!==!0,t=!this.updateReady;this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},e&&this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),t&&this.emit(this.updateReadyListeners);return}if(t===dn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===un){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,T(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};pn.getInstance();var mn=t({createCameraContext:()=>hn});function hn(){return new gn}var gn=class{takePhoto(e={}){return T(`takePhoto`,e)}startRecord(e={}){return T(`startRecordCamera`,e)}stopRecord(e={}){return T(`stopRecordCamera`,e)}},_n=t({reportAnalytics:()=>vn,reportEvent:()=>yn});function vn(...e){return T(`reportAnalytics`,e)}function yn(e,t){return T(`reportAnalytics`,{eventId:e,data:t})}var bn=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,xn=(()=>{let e={};for(let t=0;t<64;t++)e[k[t]]=t;return e})();function Sn(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Cn(e){return Sn(e)?e:e&&e.buffer&&Sn(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function wn(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=k[t[r]>>2],n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=k[(t[r+1]&15)<<2|t[r+2]>>6],n+=k[t[r+2]&63];return r<t.length&&(n+=k[t[r]>>2],r+1<t.length?(n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=`${k[(t[r+1]&15)<<2]}=`):n+=`${k[(t[r]&3)<<4]}==`),n}function Tn(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=xn[t[e]],o=xn[t[e+1]],s=t[e+2]===`=`?0:xn[t[e+2]],c=t[e+3]===`=`?0:xn[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function En(e){let t=Cn(e);return t?{[bn]:wn(t)}:e}function Dn(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?Tn(e[bn]):e}function On(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=Dn(r);return{...e,advertisData:Dn(e.advertisData),serviceData:t}}function kn(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(On)}}function An(e){return!e||typeof e!=`object`?e:{...e,value:Dn(e.value)}}function jn(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function Mn(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=T(e,n(jn(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function A(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=x.store(e=>t(n(e)),!0);return r.set(t,i),T(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),x.remove(n),T(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())x.remove(e);return r.clear(),T(t)}}}var Nn=t({closeBluetoothAdapter:()=>Kn,getBluetoothAdapterState:()=>Gn,getBluetoothDevices:()=>Wn,getConnectedBluetoothDevices:()=>Un,isBluetoothDevicePaired:()=>qn,makeBluetoothPair:()=>Jn,offBluetoothAdapterStateChange:()=>Hn,offBluetoothDeviceFound:()=>Vn,onBluetoothAdapterStateChange:()=>Bn,onBluetoothDeviceFound:()=>zn,openBluetoothAdapter:()=>Rn,startBluetoothDevicesDiscovery:()=>Ln,stopBluetoothDevicesDiscovery:()=>In}),Pn=A(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,kn),Fn=A(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function In(e){return T(`stopBluetoothDevicesDiscovery`,e)}function Ln(e){return T(`startBluetoothDevicesDiscovery`,e)}function Rn(e){return T(`openBluetoothAdapter`,e)}function zn(e){return Pn.on(e)}function Bn(e){return Fn.on(e)}function Vn(e){return Pn.off(e)}function Hn(e){return Fn.off(e)}function Un(e){return Mn(`getConnectedBluetoothDevices`,e,{transform:kn})}function Wn(e){return Mn(`getBluetoothDevices`,e,{transform:kn})}function Gn(e){return T(`getBluetoothAdapterState`,e)}function Kn(e){return T(`closeBluetoothAdapter`,e)}function qn(e){return T(`isBluetoothDevicePaired`,e)}function Jn(e){return T(`makeBluetoothPair`,e)}var Yn=t({closeBLEConnection:()=>dr,createBLEConnection:()=>ur,getBLEDeviceCharacteristics:()=>lr,getBLEDeviceRSSI:()=>cr,getBLEDeviceServices:()=>sr,getBLEMTU:()=>fr,notifyBLECharacteristicValueChange:()=>or,offBLECharacteristicValueChange:()=>ar,offBLEConnectionStateChange:()=>ir,offBLEMTUChange:()=>mr,onBLECharacteristicValueChange:()=>rr,onBLEConnectionStateChange:()=>nr,onBLEMTUChange:()=>pr,readBLECharacteristicValue:()=>tr,setBLEMTU:()=>er,writeBLECharacteristicValue:()=>$n}),Xn=A(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Zn=A(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,An),Qn=A(`onBLEMTUChange`,`offBLEMTUChange`);function $n(e){return Mn(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:En(e.value)}:e}})}function er(e){return T(`setBLEMTU`,e)}function tr(e){return T(`readBLECharacteristicValue`,e)}function nr(e){return Xn.on(e)}function rr(e){return Zn.on(e)}function ir(e){return Xn.off(e)}function ar(e){return Zn.off(e)}function or(e){return T(`notifyBLECharacteristicValueChange`,e)}function sr(e){return T(`getBLEDeviceServices`,e)}function cr(e){return T(`getBLEDeviceRSSI`,e)}function lr(e){return T(`getBLEDeviceCharacteristics`,e)}function ur(e){return T(`createBLEConnection`,e)}function dr(e){return T(`closeBLEConnection`,e)}function fr(e){return T(`getBLEMTU`,e)}function pr(e){return Qn.on(e)}function mr(e){return Qn.off(e)}var hr=t({getClipboardData:()=>_r,setClipboardData:()=>gr});function gr(e){return T(`setClipboardData`,e)}function _r(e){return T(`getClipboardData`,e)}var vr=t({addPhoneContact:()=>br,chooseContact:()=>yr});function yr(e){return T(`chooseContact`,e)}function br(e){return T(`addPhoneContact`,e)}var xr=t({hideKeyboard:()=>Sr});function Sr(e){return T(`hideKeyboard`,e)}var Cr=t({offMemoryWarning:()=>Tr,onMemoryWarning:()=>wr});function wr(e){return T(`onMemoryWarning`,e)}function Tr(e){return T(`offMemoryWarning`,e)}var Er=t({getNetworkType:()=>Dr});function Dr(e){return T(`getNetworkType`,e)}var Or=t({makePhoneCall:()=>kr});function kr(e){return T(`makePhoneCall`,e)}var Ar=t({scanCode:()=>jr});function jr(e){return T(`scanCode`,e)}var Mr=t({offUserCaptureScreen:()=>Fr,onUserCaptureScreen:()=>Pr}),Nr=A(`onUserCaptureScreen`,`offUserCaptureScreen`),j;function Pr(e){if(typeof e==`function`)return j&&j!==e&&Nr.off(j),j=e,Nr.on(e)}function Fr(e){if(typeof e!=`function`||e===j)return j=void 0,Nr.off(e)}var Ir=t({vibrateLong:()=>Rr,vibrateShort:()=>Lr});function Lr(e){return T(`vibrateShort`,e)}function Rr(e){return T(`vibrateLong`,e)}var zr=t({extBridge:()=>Br,extOffBridge:()=>Hr,extOnBridge:()=>Vr,offLoginStatusChanged:()=>Wr,onLoginStatusChanged:()=>Ur});function Br({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),T(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function Vr({event:e,module:t,callBack:n,isSustain:r=!0}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOnBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOnBridge 参数 event 为空`);return}if(!n){console.error(`[ERROR]: extOnBridge 参数 callBack 为空`);return}let i=`${t}_${e}`;T(i,{evtId:i,keep:r,success:n})}function Hr({event:e,module:t,callBack:n}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOffBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOffBridge 参数 event 为空`);return}let r=`${t}_${e}`;T(r,{evtId:r,success:n})}function Ur(e){C.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function Wr(){C.off(`notifyLoginStatusChanged`)}var Gr=new WeakSet;function Kr(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!Gr.has(e)){Gr.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{Gr.delete(e)}}console.error(`[service] ${r} error:`,t)}function M(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?Kr(e,t,i):console.error(`[service] ${i} error:`,t);return}}function N(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])M(e,a,n,r,i)}var qr=[`onLaunch`,`onShow`,`onHide`],Jr=[`globalData`],Yr=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){qr.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)qr.includes(t)||Jr.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){M(this,this.onLaunch,[this.options],`onLaunch`),M(this,this.onShow,[this.options],`onShow`)}appShow(){M(this,this.onShow,[this.options],`onShow`)}appHide(){M(this,this.onHide,[],`onHide`)}},Xr=new Set([`2d`]),Zr=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Qr=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),$r=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),ei=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),ti=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),ni=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),ri={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},ii=new Map,P={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function ai(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function oi(e,t){!e||!t||ii.set(e,t)}function si(e){return ii.get(e)||null}function ci(e,t){return e&&e[ai(t)]||null}function F(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>F(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}let t={};for(let[n,r]of Object.entries(e))t[n]=F(r);return t}C.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{oi(e,t)}),C.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{oi(e,t)});var li=1,ui=1;function di(){let e=w.getPageInfo();return e?.bridgeId||e?.id||``}function I(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)&&n>=0?Math.floor(n):t}function fi(e,t,n){C.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function pi(e){Promise.resolve().then(e)}function mi(e){return Object.prototype.toString.call(e)===`[object Object]`}function hi(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function L(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=hi(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>L(e));if(mi(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}return e}function R(e){return Array.from(e).map(e=>L(e))}function z(e=`canvas_resource`){return`${e}_${p()}`}var B=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=li++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:R(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},gi=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=x.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=x.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},_i=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}async getImageData(e,t,n,r){return await this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};if(e===`createImageData`){let e=t[0],n=t[1];return{width:e,height:n,data:new Uint8ClampedArray(e*n*4)}}let n=Qr.has(e)?z():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:n}),n)return new B(this.canvas,n)}},vi=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=z(`webgl_extension_resource`),n=new B(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof B)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:R(t),resultId:r}),n}},yi=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...ri,...mi(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(P,t))return P[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(P.VIEWPORT,[0,0,e,t]),this.state.set(P.SCISSOR_BOX,[0,0,e,t]),this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(P.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(P.DEPTH_CLEAR_VALUE,1),this.state.set(P.DEPTH_WRITEMASK,!0),this.state.set(P.DEPTH_FUNC,P.LESS),this.state.set(P.STENCIL_CLEAR_VALUE,0),this.state.set(P.LINE_WIDTH,1),this.state.set(P.CULL_FACE_MODE,P.BACK),this.state.set(P.FRONT_FACE,P.CCW),this.state.set(P.ACTIVE_TEXTURE,P.TEXTURE0),this.state.set(P.PACK_ALIGNMENT,4),this.state.set(P.UNPACK_ALIGNMENT,4),this.state.set(P.CURRENT_PROGRAM,null),this.state.set(P.ARRAY_BUFFER_BINDING,null),this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(P.TEXTURE_BINDING_2D,null),this.state.set(P.FRAMEBUFFER_BINDING,null),this.state.set(P.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=F(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(F(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return F(e)}queueError(e){e&&e!==P.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(R(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:R(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=z(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new B(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),P.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,P.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t)}let n=$r.get(e)||ei.get(e);if(n)return this.createResource(e,t,n);if(ni.has(e)){let n=t[0];return n instanceof B&&n.resourceType===ni.get(e)&&!n.deleted}ti.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:R(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(P.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(P.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(P.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(P.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(P.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(P.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(P.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(P.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(P.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(P.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(P.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(P.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===P.ARRAY_BUFFER?this.state.set(P.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===P.ELEMENT_ARRAY_BUFFER&&this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===P.TEXTURE_2D&&this.state.set(P.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(P.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(P.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?F(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof B)||e.resourceType!==`shader`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.SHADER_TYPE:return e.metadata.shaderType;case P.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof B)||e.resourceType!==`program`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.LINK_STATUS:return!!e.metadata.linkStatus;case P.VALIDATE_STATUS:return!!e.metadata.validateStatus;case P.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=z(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new vi(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},bi=class{constructor({nodeId:e,bridgeId:t=di(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1,webglCapabilities:o}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.webglCapabilities=o||si(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=I(n,300),this._height=I(r,150)}get width(){return this._width}set width(e){this._width=I(e,300),this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width})}get height(){return this._height}set height(e){this._height=I(e,150),this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height})}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=ai(n),i=Zr.has(n);if(!Xr.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?ci(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=z(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:L(t)});let s=i?new yi(this,o,r,t,a):new _i(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=z(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=F(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new gi(this,z(`canvas_image`))}requestAnimationFrame(e){let t=ui++,r=x.store(t=>{n(e)&&e(t)});return fi(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){fi(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){return new Promise((a,o)=>{let s=x.store(e=>{a(e)});this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s})})}toDataURL(e=`image/png`,t){return new Promise(n=>{let r=x.store(e=>{n(e)});this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:r})})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,pi(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback||e.typedArrayUpdateId)?x.store(e=>this.applyFlushFeedback(e)):void 0;fi(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:t})}};function xi(e,t=di()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(oi(t,e.webglCapabilities),new bi({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function Si(e,t=di()){return Array.isArray(e)?e.map(e=>Si(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:xi(e.node,t)}:e}function Ci(e={}){let t=I(e.width,300),n=I(e.height,150),r=e.type||`2d`,i=z(`offscreen_canvas`),a=di();return fi(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new bi({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:si(a)})}var wi=t({createSelectorQuery:()=>Ti});function Ti(){return new ki}function Ei(){return w.getPageInfo()}function Di(){let e=Ei();return e?.__id__||e?.id}function Oi(){let e=Ei();return e?.bridgeId||e?.id}var ki=class{constructor(){this.__componentId=Di(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Ai(this,this.__componentId,e,!0)}selectAll(e){return new Ai(this,this.__componentId,e,!1)}selectViewport(){return new Ai(this,Di(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=Oi();T(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Si(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Ai=class{constructor(e,t,n,r){this.__selectorQuery=e,this.__moduleId=t,this.__selector=n,this.__single=r}fields(e,t){return this.__selectorQuery.__push(this.__selector,this.__moduleId,this.__single,e,t),this.__selectorQuery}boundingClientRect(e){return this.fields({id:!0,dataset:!0,rect:!0,size:!0},e)}context(e){return this.fields({context:!0},e)}node(e){return this.fields({node:!0},e)}scrollOffset(e){return this.fields({id:!0,dataset:!0,scrollOffset:!0},e)}},ji=t({createIntersectionObserver:()=>Mi});function Mi(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Ni(e,{thresholds:n,initialRatio:r,observeAll:i})}var Ni=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=x.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);T(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){T(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Pi=t({createMediaQueryObserver:()=>Ii});function Fi(e={}){let t={};for(let n of[`minWidth`,`maxWidth`,`width`,`minHeight`,`maxHeight`,`height`]){let r=Number(e[n]);Number.isFinite(r)&&r>=0&&(t[n]=r)}return typeof e.orientation==`string`&&/^[-_a-z0-9]+$/i.test(e.orientation)&&(t.orientation=e.orientation),t}function Ii(e,t={}){return new Li(e,t)}var Li=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=x.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){T(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),x.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),T(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:Fi(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,T(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(x.remove(this._callbackId),this._callbackId=null)}};function Ri(e){if(typeof e!=`string`||e.length===0)return null;let t=[],n=``,r=0,i=()=>{n.length>0&&(t.push(n),n=``)};for(;r<e.length;){let a=e[r];if(a===`\\`){let t=e[r+1];if(t===`.`||t===`[`||t===`]`||t===`\\`){n+=t,r+=2;continue}n+=a,r++;continue}if(a===`.`){i(),r++;continue}if(a===`[`){if(t.length===0&&n.length===0)return null;i();let a=e.indexOf(`]`,r+1);if(a===-1)return null;let o=e.slice(r+1,a);if(!/^\d+$/.test(o))return null;t.push(Number(o)),r=a+1;continue}if(a===`]`)return null;n+=a,r++}return i(),t.length>0?t:null}function zi(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1],a=Object.prototype.hasOwnProperty.call(r,n);typeof i==`number`?(!a||!Array.isArray(r[n]))&&(r[n]=[]):(!a||r[n]===null||typeof r[n]!=`object`||Array.isArray(r[n]))&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Bi(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Vi(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){if(e===`**`){n.push({path:[],wildcard:!0});continue}let t=e.endsWith(`.**`),r=Ri(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Hi(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Bi(e.path,t)||Bi(t,e.path)}function Ui(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:Vi(e.expression)}))}function Wi(e,t,r=e.data,i=e.__info__||{}){for(let a of Ui(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Hi(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));M(e,a.observer,i,`data observer`)}}function Gi(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Ki(e,t){let n=e.__info__?.properties||{};return t.flatMap(e=>{let t=e.path[0];return typeof t!=`string`||!Object.prototype.hasOwnProperty.call(n,t)?[]:[{propertyName:t,oldValue:e.path.length===1?e.oldValue:void 0,path:e.path,value:e.value}]})}function qi(e,t,r){if(!t||typeof t!=`object`||Array.isArray(t))return console.warn(`[service] setData data must be an object`),null;let i=!e.__dataUpdateTransaction__,a=e.__dataUpdateTransaction__||{changes:[],pendingPaths:[],callbacks:[]};e.__dataUpdateTransaction__=a,n(r)&&a.callbacks.push(r);for(let r of Object.keys(t)){let i=Ri(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=y(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;zi(e.data,i,o),a.changes.push({key:r,path:i,oldValue:s,value:o}),a.pendingPaths.push(i)}if(!i)return null;try{for(;a.pendingPaths.length>0;){let t=a.pendingPaths;a.pendingPaths=[],Wi(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:Gi(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Ki(e,a.changes)}}function V(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);s.length===1&&c===a.oldValue&&!t?.observeAssignments||(r(o)?M(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&M(e,o,[c,a.oldValue,s],`property observer`))}}var Ji=new Map;function Yi(e){return Ji.has(e)||Ji.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Ji.get(e)}function Xi(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return x.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function Zi(e){let t=Yi(e);t.depth++}function Qi(e){let t=Yi(e);t.depth>0&&t.depth--,t.depth===0&&ea(e)}function $i(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Ri(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(De({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function H(e,t,n,r,i=[]){let a=Yi(e),o=a.byModuleId.get(t),s=$i(n,i);if(o)Object.assign(o.data,s.data),o.changes.push(...s.changes);else{let e={moduleId:t,data:s.data,changes:s.changes};a.byModuleId.set(t,e),a.updates.push(e)}r&&a.callbackIds.push(r),a.depth===0&&!a.scheduled&&(a.scheduled=!0,Promise.resolve().then(()=>{a.scheduled=!1,a.depth===0&&ea(e)}))}function ea(e){let t=Ji.get(e);if(!t||t.updates.length===0)return;let n=t.updates,r=t.callbackIds;t.updates=[],t.byModuleId=new Map,t.callbackIds=[],t.scheduled=!1,C.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function ta(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>ta(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=ta(n)),e),{}):e}function na(e){if(e){let t={};for(let n in e){let r=ge(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ia),default:r.value}}return t}}var ra=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ia(e){return Array.isArray(e)?e.map(e=>ia(e)):e===null||e===``?null:ra.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function aa(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,m(n),h(n),r];for(let t of i)if(t&&e[t]!==void 0){let n=e[t];if(typeof n==`string`)return{bind:n};if(n&&typeof n==`object`)return n}}function oa(e,t){if(!Array.isArray(t))return;let r=new WeakMap,i=new WeakSet,a=e.properties,o=e.data,s=e.methods,c=e.relations,l=Object.prototype.hasOwnProperty.call(e,`export`),u=e.export,d,f,p,m,h;function g(e,t){let n=Array.isArray(e)?[...e]:{...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],i=t[e];n[e]=typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?g(r,i):i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function U(e,t,n){let r=e;for(;r&&r.__parentId__;){if(r.__parentId__===t)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}function sa(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function ca(e,t){if(!e||!Array.isArray(e.dependencies))return!1;for(let n of e.dependencies){if(n in t)return!0;for(let e of Object.keys(t))if(e.startsWith(n+`.`)||e.startsWith(n+`[`)||n.startsWith(e+`.`)||n.startsWith(e+`[`))return!0}return!1}function la(e,t){if(!(!e||!e.expression)){if(e.isSimple)return f(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function ua(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!U(t,e.__id__,r)||t.__parentId__!==e.__id__)continue;let a=t.__info__?.properties||{},o={};for(let r in a){let i=e.__childPropsBindings__?.[t.__id__]?.[r];i&&ca(i,n)&&(o[r]=y(la(i,e.data)))}if(Object.keys(o).length>0){let e=t.normalizePropertyValues?.(o,{applyFilter:!1})||o,n=t.tO?.(e)||t.normalizePropertyValues?.(e)||e;t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,e),i.push({child:t,data:n})}}return i}var da=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],fa=[`show`,`hide`,`resize`,`routeDone`],pa=class e{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=y(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__eventAttr__=t.eventAttr,this.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,ge(t)]))}init({deferInitialData:e=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=xe(n,void 0,{absent:!0});if(this.data[t]=r,this.__initialPropertyNames__.has(t)){let n=this.normalizePropertyValue(t,e[t],{applyFilter:!1});this.__initialPropertyValues__[t]=n,this.__initialPropertyChanges__.push({propertyName:t,oldValue:void 0,path:[t],value:n})}}}this.#u(),this.#t(),this.#e(),this.#m(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],H(this.bridgeId,this.__id__,{},Xi(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(!(!e||typeof e!=`object`))for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}if(e.startsWith(`../`)){let t=this.is.split(`/`),n=e.split(`/`),r=t.slice(0,-1);for(let e of n)e===`..`?r.pop():e!==`.`&&r.push(e);return r.join(`/`)}return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(q.instances[this.bridgeId]||{}).filter(e=>e===this||!e.__isComponent__||e.__componentAttached__||e.__componentAttaching__);for(let[n,r]of Object.entries(e)){let{type:e,target:i}=r,a=this.__relationPaths__.get(n),o=t.filter(e=>i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`)).filter(t=>this.#a(t,e));for(let e of o)this.#s(n,e,r)}this.#i()}#i(){let e=Object.values(q.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`),o&&this.#a(e,t)&&this.#s(n,e,r)}}#a(e,t){let n=Object.values(q.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#o(e.__id__,this.__id__,n);case`descendant`:return this.#o(this.__id__,e.__id__,n);default:return!1}}#o(e,t,n){let r=n.find(e=>e.__id__===t);for(;r&&r.__parentId__;){if(r.__parentId__===e)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}#s(e,t,n){let r=this.__relations__.get(e)||[];r.includes(t)||(r.push(t),this.__relations__.set(e,r),M(this,n.linked,[t],`relation linked callback`))}#c(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),M(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){M(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=qi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}let r=ua(this,q.instances[this.bridgeId],n.changedData);H(this.bridgeId,this.__id__,n.changedData,Xi(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)}),V(this,n.propertyChanges)}#u(){da.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&fa.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#d(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#f(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=this.__initialPropertyChanges__.map(e=>e.path);e.length>0&&(Wi(this,e),V(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),M(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return Wi(this,o),V(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=xe(s,t,{absent:r});if(r||!i||!this.hasPropertyFilter(e))return c;let l=this.__info__.properties[e],u=n(l.filter)?l.filter:this.__info__.methods?.[l.filter];if(!n(u))return c;let d=M(this,u,[c,a,o],`property filter`);return d===void 0?c:d}normalizePropertyValues(e,{applyFilter:t=!0}={}){let n={};for(let[r,i]of Object.entries(e||{}))n[r]=this.normalizePropertyValue(r,i,{applyFilter:t});return n}getPageId(){return this.__id__}hasBehavior(e){let t=function(n){if(!Array.isArray(n))return!1;if(n.includes(e))return!0;for(let e of n)if(e&&e.behaviors&&t(e.behaviors))return!0;return!1};return t(this.behaviors)}createSelectorQuery(){return Ti().in(this)}selectComponent(e){let t=Object.values(q.instances[this.bridgeId]),n=t.find(n=>U(n,this.__id__,t)&&sa(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(q.instances[this.bridgeId]);return t.filter(n=>U(n,this.__id__,t)&&sa(e,n))}selectOwnerComponent(){let e=Object.values(q.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Mi(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Zi(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{M(this,e,[],`groupSetData callback`)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__,n=this.__groupSetDataChanges__;this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];let r=ua(this,q.instances[this.bridgeId],e);H(this.bridgeId,this.__id__,e,Xi(this,t),n),r.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];Qi(this.bridgeId)}}createMediaQueryObserver(e){return Ii(this,e)}getRelationNodes(e){let t=this.__relations__.get(e);return t?[...t]:null}animate(e,t,r,i,a){n(i)&&(a=i,i=void 0),T(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),T(`componentClearAnimation`,{moduleId:this.__id__,selector:e,options:t||{},success:r},`render`)}async triggerEvent(t,n,r={}){if(!t)return;let i=t.trim();if(!i)return;let a={bubbles:r.bubbles===!0,composed:r.composed===!0,capturePhase:r.capturePhase===!0},o={id:this.id,dataset:this.dataset||{}},s=!1,c=!1,l={type:i,timeStamp:Date.now(),detail:n,bubbles:a.bubbles,composed:a.composed,currentTarget:null,target:o,preventDefault(){c=!0},stopPropagation(){s=!0}};Object.defineProperty(l,"defaultPrevented",{enumerable:!0,get:()=>c});let u=e.prototype.getCustomEventPath.call(this,a.composed),d=async(e,t)=>{let n=aa(e.eventAttr,i);if(!n)return;let r=t?n.captureCatch??n.captureBind:n.catch??n.bind;if(!r)return;l.currentTarget=e.currentTarget;let a=await q.triggerEvent({bridgeId:this.bridgeId,moduleId:e.moduleId,methodName:r,event:l});(t?n.captureCatch:n.catch)&&l.stopPropagation(),a===!1&&(l.preventDefault(),l.stopPropagation())};if(a.capturePhase)for(let e=u.length-1;e>=0&&!s;e--)await d(u[e],!0);if(s)return;let f=a.bubbles?u:u.slice(0,1);for(let e of f)if(await d(e,!1),s)break}getCustomEventPath(e){let t=[{moduleId:this.__pageId__,eventAttr:this.__eventAttr__||{},currentTarget:{id:this.id,dataset:this.dataset||{}}}];if(Array.isArray(this.__eventPath__)){let n=this.__eventPath__.filter(e=>e?.moduleId).map(e=>{let t=e.isComponentHost&&e.nodeModuleId?q.instances[this.bridgeId]?.[e.nodeModuleId]:null;return{moduleId:e.moduleId,nodeModuleId:e.nodeModuleId,isComponentHost:e.isComponentHost===!0,eventAttr:e.eventAttr||{},currentTarget:{id:t?.id??e.targetInfo?.id,dataset:t?.dataset||e.targetInfo?.dataset||{}}}}),r=q.instances[this.bridgeId]||{},i=new Set([this.__id__]),a=0,o=r[this.__parentId__];for(;o?.__isComponent__&&!i.has(o.__id__);){i.add(o.__id__);let e=n.findIndex(e=>e.isComponentHost&&e.nodeModuleId===o.__id__);if(e>=0)a=Math.max(a,e+1);else if(Object.keys(o.__eventAttr__||{}).length>0){let e=-1;for(let t=0;t<n.length;t++)n[t].moduleId===o.__id__&&(e=t);let t=Math.max(a,e+1);n.splice(t,0,{moduleId:o.__pageId__,nodeModuleId:o.__id__,isComponentHost:!0,eventAttr:o.__eventAttr__,currentTarget:{id:o.id,dataset:o.dataset||{}}}),a=t+1}o=r[o.__parentId__]}for(let r of n)(e||r.moduleId===this.__pageId__)&&t.push(r);return t}let n=q.instances[this.bridgeId]||{},r=new Set([this.__id__]),i=n[this.__parentId__];for(;i?.__isComponent__&&!r.has(i.__id__);)r.add(i.__id__),(e||i.__pageId__===this.__pageId__)&&t.push({moduleId:i.__pageId__,eventAttr:i.__eventAttr__||{},currentTarget:{id:i.id,dataset:i.dataset||{}}}),i=n[i.__parentId__];return t}pageReady(){this.__isComponent__||M(this,this.ready,[],`ready lifetime`)}pageUnload(){this.__isComponent__||M(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`page show lifetime`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`page hide lifetime`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.resize,[e],`page resize lifetime`)}componentRouteDone(){N(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),M(this,this.routeDone,[],`page routeDone lifetime`)}componentCreated(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`)}componentAttached(){N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`)}componentMoved(){N(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),M(this,this.moved,[],`moved lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=this.__relations__.get(t)||[];for(let r of e)this.#l(t,r,n)}}componentDetached(){this.__componentAttached__=!1,N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=[...this.__relations__.get(t)||[]];for(let r of e)this.#c(t,r,n)}this.#h(),this.initd=!1}#h(){let e=Object.values(q.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,n]of t.__relations__.entries()){let r=n.indexOf(this);if(r!==-1){n.splice(r,1),t.__relations__.set(e,n);let i=t.__info__.relations?.[e];M(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){N(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),M(this,this.error,[e],`error lifetime`,!1)}},W=class e{static type=`component`;constructor(t,n){this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.isComponent=this.extraInfo.component,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,oa(this.moduleInfo,this.behaviors),this.noReferenceData=ta(this.moduleInfo.data||{})}getProps(){let e=na(this.moduleInfo.properties),t=Array.isArray(this.behaviors)?this.behaviors.filter(e=>typeof e==`string`&&e.startsWith(`wx://`)):[];if(Array.isArray(this.moduleInfo.externalClasses)&&this.moduleInfo.externalClasses.length>0){e||={};for(let t of this.moduleInfo.externalClasses)e[t]={type:[`s`],cls:!0}}return t.length&&(e||={},e.__diminaMeta={builtinBehaviors:t}),e}},ma=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=y(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1}={}){this.#e(),this.#t(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],H(this.bridgeId,this.__id__,{},Xi(this,e))}setData(e,t){let n=qi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=ua(this,q.instances[this.bridgeId],n.changedData);H(this.bridgeId,this.__id__,n.changedData,Xi(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Ti().in(this)}getTabBar(){let e=Object.values(q.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&U(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(q.instances[this.bridgeId]||{}),n=t.find(n=>U(n,this.__id__,t)&&sa(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(q.instances[this.bridgeId]||{});return t.filter(n=>U(n,this.__id__,t)&&sa(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){let t=this.__info__[e];this[e]=n(t)?t.bind(this):t}}#t(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`),N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),M(this,this.onLoad,[this.opts.query||{}],`onLoad`),this.initd=!0}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`onShow`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`onHide`)}pageReady(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`),M(this,this.onReady,[],`onReady`)}pageUnload(){N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`),M(this,this.onUnload,[],`onUnload`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.onResize,[e],`onResize`)}},G=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,oa(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=ta(this.moduleInfo.data||{})}},ha=class{static type=`app`;constructor(e){this.moduleInfo=e}},K=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}w.setInitId(n),b(`app`),b(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}})}createAppModule(e){let t=new ha(e);this.staticModules[ha.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))b(e);if(n===G.type){let n=new G(e,t);this.staticModules[r]=n}else if(n===W.type){let n=new W(e,t);this.staticModules[r]=n}else console.error(`[service] createModule ${n} error`)}}getPropsByPath(e){let t={};return this.getComponentProps(t,e),t}getComponentProps(e,t){if(t)for(let n of Object.values(t)){let t=this.staticModules[n];!t||e[n]||(e[n]=t.getProps(),this.getComponentProps(e,t.usingComponents))}}getAppModule(){return this.staticModules[ha.type]}getModuleByPath(e){return this.staticModules[e]}},q=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.instances={},this.pageStates=new Map}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=e)}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e||{},i=K.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(i.moduleInfo,this.defaultApp),this.defaultApp={},this.app=new Yr(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){w.pushStack(e)}stackHide(e){w.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u,stackId:d,isCustomTabBar:f=!1,deferInitialData:p=!1}=e,m=K.getModuleByPath(r);if(!m){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},m.type===W.type){let e=new pa(m,{bridgeId:t,moduleId:n,path:r,isCustomTabBar:f,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u});this.instances[t][n]=e,m.isComponent||w.push(e,d),e.init({deferInitialData:p});let h=this.getPageState(t);return!m.isComponent&&h.pendingShow&&!h.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(m.type===G.type){let e=new ma(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,w.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${m.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==W.type||!i.__isComponent__||i.__componentAttached__||i.__componentAttaching__)return;r&&this.instances[t]?.[r]&&(i.__parentId__=r);let a=this.instances[t]?.[i.__parentId__];if(a?.__isComponent__&&!a.__componentAttached__){i.__componentAttachPending__=!0;return}i.__componentAttachPending__=!1,i.__componentAttaching__=!0;try{i.__componentAttached__=!0,i.componentAttached(),i.__componentAttaching__=!1,this.getPageState(t).shown&&!i.__pageShown__&&(i.__pageShown__=!0,i.pageShow());let e=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let n of e)this.moduleAttached({bridgeId:t,moduleId:n.__id__});if(i.__pendingReadyOpts__){let e=i.__pendingReadyOpts__;delete i.__pendingReadyOpts__,this.moduleReady(e)}}finally{i.__componentAttaching__=!1}}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r,eventPath:i}=e,a=this.instances[t]?.[n];if(a){if(Array.isArray(i)&&(a.__eventPath__=i),r&&a.__parentId__){let e=this.instances[t]?.[a.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(a.__type__===W.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;if(Object.values(this.instances[t]||{}).some(e=>e?.__isComponent__&&e.__componentAttached__&&!e.__componentReadied__&&this.isDescendantInstance(e,a,t))){a.__pendingReadyOpts__=e;return}a.__componentReadied__=!0,a.componentReadied(),this.flushPendingEvents(a),a.flushInitSetDataCallbacks?.();let n=this.getPageInstance(t);n&&this.checkAndCallPageReady(t,n.__id__);let r=this.instances[t]?.[a.__parentId__];for(;r?.__isComponent__;){if(r.__pendingReadyOpts__){let e=r.__pendingReadyOpts__;delete r.__pendingReadyOpts__,this.moduleReady(e)}r=this.instances[t]?.[r.__parentId__]}}}}isDescendantInstance(e,t,n){let r=e;for(;r?.__parentId__;){if(r.__parentId__===t.__id__)return!0;r=this.instances[n]?.[r.__parentId__]}return!1}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t]?.[n];r&&(r.__type__===W.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.componentDetached(),r.__componentDetached__=!0),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!1,n.pendingShow=!0,!this.instances[t])return;let r=this.getPageInstance(t);if(!r?.initd)return;if(n.shown){n.pendingShow=!1;return}n.shown=!0,n.pendingShow=!1;let i=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===G.type?i.push(e):e.__type__===W.type&&(e.__isComponent__?e.__componentAttached__&&!e.__pageShown__&&(e.__pageShown__=!0,e.pageShow()):i.push(e)))}),i.forEach(e=>{e.pageShow()}),n.pendingReady&&this.pageReady({...e,moduleId:r.__id__})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.getPageState(t);r.pendingReady=!0;let i=this.instances[t]?.[n];i&&(r.hidden||!r.shown||r.ready||(i.__pageReadyPending__=!0,i.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n)))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===G.type||e.__type__===W.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.getPageState(e),r=this.instances[e]?.[t];if(!r||!r.__pageReadyPending__||!n.shown||n.ready)return;let i=this.instances[e];if(!i){r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady();return}Object.values(i).filter(e=>e&&e.__type__===W.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!0,n.pendingShow=!1,!n.shown||(n.shown=!1,!this.instances[t]))return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===G.type?r.push(e):e.__type__===W.type&&(e.__isComponent__?e.__componentAttached__&&e.__pageShown__&&(e.__pageShown__=!1,e.pageHide()):r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e;if(!this.instances[t])return;let n=this.getInstancesInTreeOrder(t);this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===W.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===W.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),w.remove(t),delete this.instances[t],this.pageStates.delete(t)}getInstancesInTreeOrder(e,{postOrder:t=!1}={}){let n=Object.values(this.instances[e]||{}).filter(Boolean),r=new Map(n.map(e=>[e.__id__,e])),i=new Map,a=[];for(let e of n)if(e.__parentId__&&r.has(e.__parentId__)){let t=i.get(e.__parentId__)||[];t.push(e),i.set(e.__parentId__,t)}else a.push(e);let o=[],s=new Set,c=e=>{if(!(!e||s.has(e))){s.add(e),t||o.push(e);for(let t of i.get(e.__id__)||[])c(t);t&&o.push(e)}};return a.forEach(c),n.forEach(c),o}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t]?.[n];i&&i.pageScrollTop({scrollTop:r})}pagePullDownRefresh({bridgeId:e}){this.getPageInstance(e)?.pagePullDownRefresh()}pageReachBottom({bridgeId:e}){this.getPageInstance(e)?.pageReachBottom()}pageShareAppMessage({bridgeId:e,...t}){return this.getPageInstance(e)?.pageShareAppMessage(t)}pageTabItemTap({bridgeId:e,...t}){this.getPageInstance(e)?.pageTabItemTap(t)}pageResize(e){let{bridgeId:t,size:n}=e;if(!this.instances[t])return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===G.type?r.push(e):e.__type__===W.type&&(e.__isComponent__?e.__componentAttached__&&e.pageResize(n):r.push(e)))}),r.forEach(e=>e.pageResize(n))}componentError(e){let{bridgeId:t,moduleId:n,error:r}=e,i=this.instances[t]?.[n];i&&i.__type__===W.type&&i.componentError(r)}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===W.type&&(!e.__isComponent__||e.__componentAttached__)&&e.componentRouteDone()})}async triggerEvent(e){let{bridgeId:t,moduleId:n,methodName:r,event:i}=e;if(r===void 0)return;let a=this.instances[t];if(!a){console.warn(`[service] No instances found for bridgeId: ${t}`);return}let o=a[n];if(!o){console.warn(`[service] triggerEvent ${t} ${n} ${r}, instance is not exist`);return}return o.__type__===W.type&&o.__isComponent__&&!o.__componentReadied__?this.queuePendingEvent(o,{instance:o,bridgeId:t,moduleId:n,methodName:r,event:i}):this.dispatchEvent({instance:o,bridgeId:t,moduleId:n,methodName:r,event:i})}},ga=t({getEnterOptionsSync:()=>va,getLaunchOptionsSync:()=>_a});function _a(){return q.app?.options}function va(){return q.app?.options}var ya=t({getLocation:()=>ba,offLocationChange:()=>Ta,onLocationChange:()=>wa,openLocation:()=>Sa,startLocationUpdate:()=>xa,stopLocationUpdate:()=>Ca});function ba(e){return T(`getLocation`,e)}function xa(e){return T(`startLocationUpdate`,e)}function Sa(e){return T(`openLocation`,e)}function Ca(e){return T(`stopLocationUpdate`,e)}function wa(e){e&&T(`onLocationChange`,{success:x.store(e,!0)})}function Ta(e){if(e){let t=x.store(e,!0);T(`offLocationChange`,{success:t}),x.remove(t)}else T(`offLocationChange`),x.remove()}var Ea=t({createMapContext:()=>Da});function Da(e,t){return new Oa({mapId:e,obj:t})}var Oa=class{constructor(e){this.opts=e}addMarkers(e){return this.invoke(`addMarkers`,e)}removeMarkers(e){return this.invoke(`removeMarkers`,e)}includePoints(e){return this.invoke(`includePoints`,e)}setCenterOffset(e){return this.invoke(`setCenterOffset`,e)}getCenterLocation(e){return this.invoke(`getCenterLocation`,e)}getScale(e){return this.invoke(`getScale`,e)}moveToLocation(e){return this.invoke(`moveToLocation`,e)}translateMarker(e){return this.invoke(`translateMarker`,e)}addArc(e){return this.invoke(`addArc`,e)}removeArc(e){return this.invoke(`removeArc`,e)}invoke(e,t={}){return T(e,{mapId:this.opts.mapId,...t})}},ka=t({createInnerAudioContext:()=>Ma}),Aa=1,ja=class{constructor(){this._audioId=Aa++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},T(`audioCreate`,{audioId:this._audioId}),T(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,T(`audioSetProp`,{audioId:this._audioId,prop:`src`,value:e,startTime:this._startTime,loop:this._loop,volume:this._volume,playbackRate:this._playbackRate,autoplay:this._autoplay})}get startTime(){return this._startTime}set startTime(e){this._startTime=Number(e)||0,T(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`loop`,value:this._loop})}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),T(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,T(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,T(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,T(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,T(`audioStop`,{audioId:this._audioId})}seek(e){T(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){T(`audioDestroy`,{audioId:this._audioId}),this._listeners={}}_on(e,t){typeof t==`function`&&(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t))}_off(e,t){this._listeners[e]&&(t?this._listeners[e]=this._listeners[e].filter(e=>e!==t):this._listeners[e]=[])}onPlay(e){this._on(`play`,e)}onPause(e){this._on(`pause`,e)}onStop(e){this._on(`stop`,e)}onEnded(e){this._on(`ended`,e)}onError(e){this._on(`error`,e)}onTimeUpdate(e){this._on(`timeUpdate`,e)}onWaiting(e){this._on(`waiting`,e)}onSeeking(e){this._on(`seeking`,e)}onSeeked(e){this._on(`seeked`,e)}onCanplay(e){this._on(`canplay`,e)}offPlay(e){this._off(`play`,e)}offPause(e){this._off(`pause`,e)}offStop(e){this._off(`stop`,e)}offEnded(e){this._off(`ended`,e)}offError(e){this._off(`error`,e)}offTimeUpdate(e){this._off(`timeUpdate`,e)}offWaiting(e){this._off(`waiting`,e)}offSeeking(e){this._off(`seeking`,e)}offSeeked(e){this._off(`seeked`,e)}offCanplay(e){this._off(`canplay`,e)}};function Ma(){return new ja}var Na=t({chooseImage:()=>La,compressImage:()=>Ia,previewImage:()=>Fa,saveImageToPhotosAlbum:()=>Pa});function Pa(e){return T(`saveImageToPhotosAlbum`,e)}function Fa(e){return T(`previewImage`,e)}function Ia(e){return T(`compressImage`,e)}function La(e){return T(`chooseImage`,e)}var Ra=t({chooseMedia:()=>Va,chooseVideo:()=>Ba,createVideoContext:()=>za});function za(e,t){return new Ha({videoId:e,obj:t})}function Ba(e){return T(`chooseVideo`,e)}function Va(e){return T(`chooseMedia`,e)}var Ha=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){T(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Ua=t({exitMiniProgram:()=>qa,navigateBackMiniProgram:()=>Ka,navigateToMiniProgram:()=>Ga,restartMiniProgram:()=>Wa});function Wa(e){return T(`restartMiniProgram`,e)}function Ga(e){return T(`navigateToMiniProgram`,e)}function Ka(e){return T(`navigateBackMiniProgram`,e)}function qa(e){return T(`exitMiniProgram`,e)}var Ja=t({downloadFile:()=>Ya});function Ya(e){return T(`downloadFile`,e)}var Xa=`__diminaArrayBufferBase64`,J=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Za=Object.fromEntries([...J].map((e,t)=>[e,t]));function Qa(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function $a(e){return Qa(e)?e:e&&Qa(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function eo(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=J[t[r]>>2],n+=J[(t[r]&3)<<4|t[r+1]>>4],n+=J[(t[r+1]&15)<<2|t[r+2]>>6],n+=J[t[r+2]&63];return r<t.length&&(n+=J[t[r]>>2],r+1<t.length?(n+=J[(t[r]&3)<<4|t[r+1]>>4],n+=`${J[(t[r+1]&15)<<2]}=`):n+=`${J[(t[r]&3)<<4]}==`),n}function to(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=Za[t[e]],o=Za[t[e+1]],s=t[e+2]===`=`?0:Za[t[e+2]],c=t[e+3]===`=`?0:Za[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function no(e){let t=$a(e);return t?{[Xa]:eo(t)}:e}function ro(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:to(t[Xa])}}function io(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function Y(e,t,n={}){return T(e,{socketId:t,...n,keep:!0})}function X(e,t,n={},r=e=>e){let i=new Set,a,o;function s(){if(!a)return;let e=a;a=void 0,x.remove(e),T(t,{...n,callbackId:e,keep:!0})}return{on(t){if(!(typeof t!=`function`||i.has(t))&&(i.add(t),!a))return a=x.store(e=>{let t=r(e);for(let e of[...i])e(t);o?.()},!0),T(e,{...n,callbackId:a,success:a,keep:!0})},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return s()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return s();a&&x.remove(a),a=void 0},hasListeners(){return i.size>0},setAfterEmit(e){o=e}}}var ao=t({offLocalServiceDiscoveryStop:()=>mo,offLocalServiceFound:()=>go,offLocalServiceLost:()=>vo,offLocalServiceResolveFail:()=>bo,onLocalServiceDiscoveryStop:()=>po,onLocalServiceFound:()=>ho,onLocalServiceLost:()=>_o,onLocalServiceResolveFail:()=>yo,startLocalServiceDiscovery:()=>uo,stopLocalServiceDiscovery:()=>fo}),oo=X(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),so=X(`onLocalServiceFound`,`offLocalServiceFound`),co=X(`onLocalServiceLost`,`offLocalServiceLost`),lo=X(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function uo(e={}){return T(`startLocalServiceDiscovery`,e)}function fo(e={}){return T(`stopLocalServiceDiscovery`,e)}function po(e){return oo.on(e)}function mo(e){return oo.off(e)}function ho(e){return so.on(e)}function go(e){return so.off(e)}function _o(e){return co.on(e)}function vo(e){return co.off(e)}function yo(e){return lo.on(e)}function bo(e){return lo.off(e)}var xo=t({request:()=>So});function So(e){return T(`request`,e)}var Co=t({createTCPSocket:()=>To}),wo=class{constructor(e){this.socketId=e,this.events={bindWifi:X(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:X(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:X(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:X(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:X(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},ro)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return Y(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=Y(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return Y(`TCPSocket.connect`,this.socketId,e)}write(e){return Y(`TCPSocket.write`,this.socketId,{data:no(e)})}onBindWifi(e){return this.events.bindWifi.on(e)}offBindWifi(e){return this.events.bindWifi.off(e)}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onConnect(e){return this.events.connect.on(e)}offConnect(e){return this.events.connect.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}};function To(){return new wo(io(`tcp`))}var Eo=t({createUDPSocket:()=>Oo}),Do=class{constructor(e){this.socketId=e,this.events={close:X(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:X(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:X(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:X(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},ro)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return Y(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=Y(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return Y(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return Y(`UDPSocket.setTTL`,this.socketId,{ttl:e})}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onListening(e){return this.events.listening.on(e)}offListening(e){return this.events.listening.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}sendWithName(e,t){return Y(e,this.socketId,{...t,message:no(t.message)})}};function Oo(){return new Do(io(`udp`))}var ko=t({uploadFile:()=>No}),Ao=1;function jo(){return`upload_${Date.now()}_${Ao++}`}function Mo(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function No(e={}){let t=jo(),n=Mo(),r=Mo(),i=x.store(e=>n.dispatch(e),!0,`${t}_progress`),a=x.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,x.remove(i),x.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{T(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||T(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var Po=t({closeSocket:()=>Qo,connectSocket:()=>Xo,offSocketClose:()=>os,offSocketError:()=>is,offSocketMessage:()=>ns,offSocketOpen:()=>es,onSocketClose:()=>as,onSocketError:()=>rs,onSocketMessage:()=>ts,onSocketOpen:()=>$o,sendSocketMessage:()=>Zo}),Fo=0,Io=1,Lo=2,Z=3,Ro=1,Q=null,zo=!1,Bo=new Map;function Vo(e){return typeof e==`function`}function Ho(e,t){if(Vo(e))try{e(t)}catch(e){queueMicrotask(()=>{throw e})}}function $(e,t,n){Ho(t===`success`?e.success:e.fail,n),Ho(e.complete,n)}function Uo(){let e=[];return{add(t){!Vo(t)||e.includes(t)||e.push(t)},remove(t){e=Vo(t)?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())Ho(n,t)}}}var Wo={open:null,message:null,error:null,close:null};function Go(e,t){Vo(t)&&(Wo[e]=t)}function Ko(e,t){(t===void 0||Wo[e]===t)&&(Wo[e]=null)}function qo(e){if(!e||typeof e!=`object`)return;let t=Bo.get(e.socketId);t&&t._dispatchNative(e)}function Jo(){zo||(zo=!0,T(`socketListen`,{evtId:`websocket_native_events`,keep:!0,success:qo}))}var Yo=class{constructor(e,t){this.socketId=e,this.socketTaskId=e,this.CONNECTING=Fo,this.OPEN=Io,this.CLOSING=Lo,this.CLOSED=Z,this._readyState=Fo,this._opts=t,this._opened=!1,this._started=!1,this._connectSettled=!1,this._terminal=!1,this._listeners={open:Uo(),message:Uo(),error:Uo(),close:Uo()}}get readyState(){return this._readyState}_dispatch(e,t){this._listeners[e].dispatch(t),this===Q&&Wo[e]&&Ho(Wo[e],t)}_settleConnect(e,t){this._connectSettled||(this._connectSettled=!0,$(this._opts,e,t))}_cleanup(){Bo.delete(this.socketId)}_failConnect(e){this._terminal||(this._terminal=!0,this._readyState=Z,this._settleConnect(`fail`,e),this._dispatch(`error`,e),this._cleanup())}_start(){if(!this._terminal){this._started=!0;try{Jo(),T(`connectSocket`,{...this._opts,socketId:this.socketId,success:e=>this._settleConnect(`success`,e),fail:e=>this._failConnect(e),complete:void 0})}catch(e){this._failConnect({errMsg:`connectSocket:fail ${e&&e.message?e.message:e}`})}}}_dispatchNative(e){let{event:t}=e;if(t===`open`){if(this._terminal)return;this._opened=!0,this._readyState=Io,this._dispatch(`open`,{header:e.header||{},profile:e.profile});return}if(t===`message`){if(this._terminal)return;this._dispatch(`message`,{data:e.data});return}if(t===`error`){if(this._terminal)return;this._readyState=Z,this._dispatch(`error`,{errMsg:e.errMsg||`connectSocket:fail WebSocket connection failed`}),this._opened||(this._terminal=!0,this._cleanup());return}if(t===`close`){if(this._terminal)return;this._terminal=!0,this._readyState=Z,this._dispatch(`close`,{code:Number(e.code)||0,reason:e.reason||``}),this._cleanup()}}send(e={}){let t=e&&typeof e==`object`?e:{};if(this._readyState!==Io){$(t,`fail`,{errMsg:`SocketTask.send:fail SocketTask.readyState is not OPEN`});return}let n=t.data;if(typeof n!=`string`&&!(n instanceof ArrayBuffer)&&!ArrayBuffer.isView(n)){$(t,`fail`,{errMsg:`sendSocketMessage:fail data must be string or ArrayBuffer`});return}T(`sendSocketMessage`,{...t,socketId:this.socketId})}close(e={}){let t=e&&typeof e==`object`?e:{};if(this._readyState===Z){$(t,`fail`,{errMsg:`closeSocket:fail WebSocket is not connected`});return}if(t.reason!==void 0&&(typeof t.reason!=`string`||new TextEncoder().encode(t.reason).byteLength>123)){$(t,`fail`,{errMsg:`closeSocket:fail reason must not exceed 123 UTF-8 bytes`});return}let n=this._readyState;if(this._readyState=Lo,!this._started){this._terminal=!0,this._readyState=Z;let e=typeof t.code==`number`?t.code:1e3,n=typeof t.reason==`string`?t.reason:``;this._settleConnect(`success`,{errMsg:`connectSocket:ok`}),$(t,`success`,{errMsg:`closeSocket:ok`}),queueMicrotask(()=>{this._dispatch(`close`,{code:e,reason:n})}),this._cleanup();return}T(`closeSocket`,{...t,socketId:this.socketId,fail:e=>{this._terminal||(this._readyState=n),Ho(t.fail,e)}})}onOpen(e){this._listeners.open.add(e)}offOpen(e){this._listeners.open.remove(e)}onMessage(e){this._listeners.message.add(e)}offMessage(e){this._listeners.message.remove(e)}onError(e){this._listeners.error.add(e)}offError(e){this._listeners.error.remove(e)}onClose(e){this._listeners.close.add(e)}offClose(e){this._listeners.close.remove(e)}};Yo.CONNECTING=Fo,Yo.OPEN=Io,Yo.CLOSING=Lo,Yo.CLOSED=Z;function Xo(e={}){let t=`socket_${Date.now()}_${Ro++}`,n=new Yo(t,e&&typeof e==`object`?e:{});return Bo.set(t,n),(!Q||Q.readyState===Z)&&(Q=n),queueMicrotask(()=>n._start()),n}function Zo(e={}){if(!Q||Q.readyState!==Io){$(e,`fail`,{errMsg:`sendSocketMessage:fail WebSocket is not connected`});return}return Q.send(e)}function Qo(e={}){Q&&Q.readyState!==Z?Q.close(e):$(e,`fail`,{errMsg:`closeSocket:fail WebSocket is not connected`});for(let e of Bo.values())e!==Q&&e.readyState!==Z&&e.close({})}function $o(e){Go(`open`,e)}function es(e){Ko(`open`,e)}function ts(e){Go(`message`,e)}function ns(e){Ko(`message`,e)}function rs(e){Go(`error`,e)}function is(e){Ko(`error`,e)}function as(e){Go(`close`,e)}function os(e){Ko(`close`,e)}var ss=t({getAccountInfoSync:()=>cs});function cs(){return T(`getAccountInfoSync`)}var ls=t({authorize:()=>us});function us(e){return T(`authorize`,e)}var ds=t({login:()=>fs});function fs(e){return T(`login`,e)}var ps=t({login:()=>ms});function ms(e){return T(`login`,e)}var hs=t({getPrivacySetting:()=>gs});function gs(e){return T(`getPrivacySetting`,e)}var _s=t({getSetting:()=>ys,openSetting:()=>vs});function vs(e){return T(`openSetting`,e)}function ys(e){return T(`getSetting`,e)}var bs=t({getUserInfo:()=>xs});function xs(e){return T(`getUserInfo`,e)}var Ss=t({requestPayment:()=>Cs});function Cs(e){return T(`requestPayment`,e)}var ws=t({hideShareMenu:()=>Ds,showShareImageMenu:()=>Es,showShareMenu:()=>Ts});function Ts(e){return T(`shareShareMenu`,e)}function Es(e){return T(`showShareImageMenu`,e)}function Ds(e){return T(`hideShareMenu`,e)}var Os=t({clearStorage:()=>Is,clearStorageSync:()=>Ms,getStorage:()=>Ps,getStorageInfo:()=>Rs,getStorageInfoSync:()=>Ls,getStorageSync:()=>As,removeStorage:()=>Fs,removeStorageSync:()=>js,setStorage:()=>Ns,setStorageSync:()=>ks});function ks(...e){return T(`setStorageSync`,e)}function As(e){return T(`getStorageSync`,e)}function js(e){return T(`removeStorageSync`,e)}function Ms(){return T(`clearStorageSync`)}function Ns(e){return T(`setStorage`,e)}function Ps(e){return T(`getStorage`,e)}function Fs(e){return T(`removeStorage`,e)}function Is(){return T(`clearStorage`)}function Ls(){return T(`getStorageInfoSync`)}function Rs(e){return T(`getStorageInfo`,e)}var zs=t({createAnimation:()=>Bs});function Bs(e={}){return new Vs(e)}var Vs=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,v(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,v(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,v(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,v(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,v(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,v(e)]}),this}},Hs=t({setBackgroundColor:()=>Ws,setBackgroundTextStyle:()=>Us});function Us(e){return T(`setBackgroundTextStyle`,e)}function Ws(e){return T(`setBackgroundColor`,e)}var Gs=t({canvasToTempFilePath:()=>Ys,createCanvasContext:()=>qs,createContext:()=>Ks,createOffscreenCanvas:()=>Ci,drawCanvas:()=>Js});function Ks(){return new Zs}function qs(e,t){return new Zs(e,Xs(t))}function Js(e={}){let t={...e,moduleId:e.moduleId||Xs(e.component)};delete t.component,T(`drawCanvas`,t,`render`)}function Ys(e={},t){let n={...e,moduleId:e.moduleId||Xs(t||e.component)};return delete n.component,T(`canvasToTempFilePath`,n,`render`)}function Xs(e){return e?.__id__||w.getPageInfo()?.id}var Zs=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(Js({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},Qs=t({nextTick:()=>nc}),$s=[],ec=null;function tc(){let e=$s;$s=[],ec=null;for(let t=0;t<e.length;t++)e[t]()}function nc(e){n(e)&&($s.push(e),ec||=setTimeout(tc,0))}var rc=t({disableAlertBeforeUnload:()=>dc,enableAlertBeforeUnload:()=>uc,hideLoading:()=>lc,hideToast:()=>ac,showActionSheet:()=>cc,showLoading:()=>sc,showModal:()=>oc,showToast:()=>ic});function ic(e){return T(`showToast`,e)}function ac(e){return T(`hideToast`,e)}function oc(e){return T(`showModal`,e)}function sc(e){return T(`showLoading`,e)}function cc(e){return T(`showActionSheet`,e)}function lc(e){return T(`hideLoading`,e)}function uc(e){return T(`enableAlertBeforeUnload`,e)}function dc(e){return T(`disableAlertBeforeUnload`,e)}var fc=t({getMenuButtonBoundingClientRect:()=>mc,offMenuButtonBoundingClientRectWeightChange:()=>gc,onMenuButtonBoundingClientRectWeightChange:()=>hc}),pc=new Set;S.onUpdate(e=>{e.menuRect&&pc.forEach(t=>t(e.menuRect))});function mc(){return T(`getMenuButtonBoundingClientRect`)}function hc(e){n(e)&&pc.add(e)}function gc(e){n(e)?pc.delete(e):pc.clear()}var _c=t({hideHomeButton:()=>Sc,hideNavigationBarLoading:()=>xc,setNavigationBarColor:()=>bc,setNavigationBarTitle:()=>yc,showNavigationBarLoading:()=>vc});function vc(e){return T(`showNavigationBarLoading`,e)}function yc(e){return T(`setNavigationBarTitle`,e)}function bc(e){return T(`setNavigationBarColor`,e)}function xc(e){return T(`hideNavigationBarLoading`,e)}function Sc(e){return T(`hideHomeButton`,e)}var Cc=t({startPullDownRefresh:()=>Tc,stopPullDownRefresh:()=>wc});function wc(e){return T(`stopPullDownRefresh`,e)}function Tc(e){return T(`startPullDownRefresh`,e)}var Ec=t({pageScrollTo:()=>Dc});function Dc(e){return T(`pageScrollTo`,e)}var Oc=t({hideTabBar:()=>Mc,hideTabBarRedDot:()=>Ic,removeTabBarBadge:()=>Pc,setTabBarBadge:()=>Nc,setTabBarItem:()=>Ac,setTabBarStyle:()=>kc,showTabBar:()=>jc,showTabBarRedDot:()=>Fc});function kc(e){return T(`setTabBarStyle`,e)}function Ac(e){return T(`setTabBarItem`,e)}function jc(e){return T(`showTabBar`,e)}function Mc(e){return T(`hideTabBar`,e)}function Nc(e){return T(`setTabBarBadge`,e)}function Pc(e){return T(`removeTabBarBadge`,e)}function Fc(e){return T(`showTabBarRedDot`,e)}function Ic(e){return T(`hideTabBarRedDot`,e)}var Lc=t({onWindowResize:()=>Rc});function Rc(e){e&&T(`onWindowResize`,{success:e})}var zc=Object.assign({"./core/base/app-event/index.js":Ue,"./core/base/index.js":Pt,"./core/base/performance/index.js":zt,"./core/base/subpackage/index.js":Wt,"./core/base/system/index.js":qt,"./core/base/update/index.js":on,"./core/camera/index.js":mn,"./core/data-analysis/index.js":_n,"./core/device/bluetooth/index.js":Nn,"./core/device/bluetooth-ble/index.js":Yn,"./core/device/clipboard/index.js":hr,"./core/device/contact/index.js":vr,"./core/device/keyboard/index.js":xr,"./core/device/memory/index.js":Cr,"./core/device/network/index.js":Er,"./core/device/phone/index.js":Or,"./core/device/scan/index.js":Ar,"./core/device/screen/index.js":Mr,"./core/device/vibrate/index.js":Ir,"./core/ext/index.js":zr,"./core/file/index.js":Ct,"./core/life-cycle/index.js":ga,"./core/location/index.js":ya,"./core/map/index.js":Ea,"./core/media/audio/index.js":ka,"./core/media/image/index.js":Na,"./core/media/video/index.js":Ra,"./core/navigate/index.js":Ua,"./core/network/download/index.js":Ja,"./core/network/mdns/index.js":ao,"./core/network/request/index.js":xo,"./core/network/tcp/index.js":Co,"./core/network/udp/index.js":Eo,"./core/network/upload/index.js":ko,"./core/network/websocket/index.js":Po,"./core/open-api/account-info/index.js":ss,"./core/open-api/authorize/index.js":ls,"./core/open-api/index.js":ds,"./core/open-api/login/index.js":ps,"./core/open-api/privacy/index.js":hs,"./core/open-api/setting/index.js":_s,"./core/open-api/user-info/index.js":bs,"./core/payment/index.js":Ss,"./core/route/index.js":Le,"./core/share/index.js":ws,"./core/storage/index.js":Os,"./core/ui/animation/index.js":zs,"./core/ui/background/index.js":Hs,"./core/ui/canvas/index.js":Gs,"./core/ui/custom-component/index.js":Qs,"./core/ui/interaction/index.js":rc,"./core/ui/menu/index.js":fc,"./core/ui/navigation-bar/index.js":_c,"./core/ui/pull-down-refresh/index.js":Cc,"./core/ui/scroll/index.js":Ec,"./core/ui/tab-bar/index.js":Oc,"./core/ui/window/index.js":Lc,"./core/wxml/intersection-observer/index.js":ji,"./core/wxml/media-query-observer/index.js":Pi,"./core/wxml/selector-query/index.js":wi}),Bc={};for(let e of Object.values(zc))for(let[t,n]of Object.entries(e))Bc[t]=n;function Vc(e){for(let t of e||[])typeof t!=`string`||Object.prototype.hasOwnProperty.call(Bc,t)||t in Object.prototype||Object.defineProperty(Bc,t,{value:(...e)=>T(t,...e),writable:!0,enumerable:!0,configurable:!0})}var Hc=new Proxy(Bc,{get(e,t,n){let r=Reflect.get(e,t,n);return typeof r==`function`||r!==void 0||t===`webpackJsonp`?r:(...e)=>T(t,...e)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),Uc=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}Vc(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=Hc;globalThis.modRequire=b,globalThis.modDefine=ae,globalThis.global={},globalThis.App=(e={})=>{K.createAppModule(e),q.createApp()},globalThis.Page=e=>{K.createModule(e,globalThis.__extraInfo,G.type)},globalThis.Component=e=>{K.createModule(e,globalThis.__extraInfo,W.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>q.getApp(e),globalThis.getCurrentPages=()=>w.stack()}},Wc={navigateBack:He,navigateTo:Ve,reLaunch:ze,redirectTo:Be,switchTab:Re};return new class{constructor(){console.log(`[service] init`),this.env=Uc,this.message=C,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,scene:l}=e;o&&S.init(o),q.setAppLaunchOptions({scene:l,pagePath:r,query:s}),K.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c})}),this.message.on(`hostEnvUpdate`,e=>{S.update(e)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await q.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;x.invoke(t,n)}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=x.store(e=>s(r.success,e))),r.fail&&(o=x.store(e=>s(r.fail,e)));let c=x.store(e=>{s(r.complete,e),x.remove(a),x.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e,a=K.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=K.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=q.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});C.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,()=>{q.appShow()}),this.message.on(`appHide`,()=>{q.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{q.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{q.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{q.createInstance(e)}),this.message.on(`mA`,e=>{q.moduleAttached(e)}),this.message.on(`mR`,e=>{q.moduleReady(e)}),this.message.on(`mU`,e=>{q.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{q.pageUnload(e)}),this.message.on(`pageShow`,e=>{q.pageShow(e)}),this.message.on(`pageReady`,e=>{q.pageReady(e)}),this.message.on(`pageHide`,e=>{q.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{q.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{q.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=q.pageShareAppMessage(e);e?.success&&this.message.send({type:`triggerCallback`,target:`container`,body:{bridgeId:e.bridgeId,id:e.success,args:[t],data:t}})}),this.message.on(`pageScroll`,e=>{q.pageScroll(e)}),this.message.on(`pageResize`,e=>{q.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{q.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;q.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{q.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await q.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}Wc[t]?.({url:n,...e.params})})}}})();
|
|
6
|
+
`;console.error(`require ${e} error: ${a}`),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}b.async=async e=>new Promise((t,n)=>{try{t(b(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var x=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},oe=`__dimina_data_function_reference__`,se=1;function ce(e){return{[oe]:e,version:se}}function le(e){return typeof e==`object`&&!!e&&e.version===se&&typeof e[oe]==`string`&&Object.keys(e).length===2}function ue(e){return le(e)?e[oe]:void 0}function de(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(le(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=de(e[a],{mapFunction:t,mapReference:n},r);return i}var fe=new Set([String,Number,Boolean,Object,Array,null]);function pe(e){return fe.has(e)}function me(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function he(e){return Array.isArray(e)?e.filter(pe):[]}function ge(e){let t,n=[],r;return pe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=he(e.optionalTypes),r=e.value),pe(t)||(t=n[0]??null),r===void 0&&(r=me(t)),{type:t,optionalTypes:n,value:y(r)}}function _e(e){return Array.isArray(e)}function ve(e){return _e(e)&&e?.constructor?.name===Array.name}function ye(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?ve(t):t!==void 0}function be(e,t){typeof e==`function`&&e(t)}function xe(e,t,{absent:n=!1,warn:r}={}){if(n)return y(e.value);for(let n of e.optionalTypes||[])if(ye(n,t))return t;let i=e.type;if(i===String)return t==null?(be(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&be(r,`property received type-uncompatible value: expected <String> but got object-typed value. Forcely converted.`),String(t));if(i===Number){try{if(Number.isFinite(Number(t)))return Number(t)}catch{}return be(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?_e(t)?t:(be(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(be(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var S=new class{constructor(){this.listeners=new Set,this.reset()}reset(){this.active=!1,this.snapshot={systemInfo:null,menuRect:null}}init(e={}){this.active=!0,this.snapshot={...this.snapshot,...e}}update(e={}){this.snapshot={...this.snapshot,...e},this.listeners.forEach(t=>t(e,this.snapshot))}onUpdate(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function Se(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var Ce=new WeakMap,we=new Map;function Te(e){let t=Ce.get(e);if(t)return we.set(t,e),t;let n;do n=`data-function-${p()}`;while(we.has(n));return Ce.set(e,n),we.set(n,e),n}function Ee(e){return we.get(e)}function De(e){return de(e,{mapFunction(e){return ce(Te(e))}})}function Oe(e){return de(e,{mapReference(e){return Ee(ue(e))||e}})}var C=new class e{constructor(){this.event=Se(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){let t=Oe(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=De(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=De(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return _?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},w=new class{#e=[];#t=``;setInitId(e){this.#t=e}push(e,t){this.stack(t).push(e)}pop(){this.stack().length>0&&this.stack().pop()}remove(e){for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t].pages,r=n.findIndex(t=>t.id===e);if(r!==-1){n.splice(r,1);return}}}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function ke(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var Ae={getWindowInfo:()=>ke(S.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>S.getSystemInfo(),getAppBaseInfo:()=>ke(S.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>ke(S.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>S.getMenuRect()},je=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),Me=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function Ne(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function Pe(e,t){return je.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||Me.has(e)}function Fe(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:w.getPageInfo().id,params:t}};return n===`container`?C.invoke(r):C.send(r)}function Ie(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{x.remove(a),x.remove(o)};a=x.store(e=>{s(),r(e)}),o=x.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{Fe(e,t,n)}catch(e){s(),i(e)}})}function Le(e,t,r){let i,a,o=()=>{x.remove(i),x.remove(a)};i=x.store(e=>{o(),n(t)&&t(e)}),a=x.store(e=>{o(),n(r)&&r(e)}),e.success=i,e.fail=a}function Re(e){return i(e)||e===``}function ze({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||Re(e))&&(n(t)||Re(t))}function T(e,t,r=`container`,i=!0){let a=Ae[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&Pe(e,t))return Ie(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:x.store(t,!0)};else if(Ne(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;if(o=l,c!==void 0&&(o.evtId=c),ze({success:e,fail:r,keep:a,evtId:c}))Le(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=x.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=x.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=x.store(i,a,c),!a&&c===void 0&&s.push(o.complete)):o.complete=i}else{let{keep:n,...a}=t;if(delete a.evtId,!n&&i&&Pe(e,t))return o={...a},Ie(e,o,r);o=a}try{return Fe(e,o,r)}catch(e){for(let e of s)x.remove(e);throw e}}function Be(e,t,n=`container`){return T(e,t,n,!1)}var Ve=t({navigateBack:()=>Ke,navigateTo:()=>Ge,reLaunch:()=>Ue,redirectTo:()=>We,switchTab:()=>He});function He(e){return e.url=te(w.getPageInfo().route,e.url),T(`switchTab`,e)}function Ue(e){return e.url=te(w.getPageInfo().route,e.url),T(`reLaunch`,e)}function We(e){let t=te(w.getPageInfo().route,e.url);if(w.getPageInfo().route!==t)return e.url=t,T(`redirectTo`,e)}function Ge(e){return e.url=te(w.getPageInfo().route,e.url),T(`navigateTo`,e)}function Ke(e){return T(`navigateBack`,e)}var qe=t({offAppHide:()=>$e,offAppShow:()=>Qe,offError:()=>Ye,onAppHide:()=>Ze,onAppRoute:()=>nt,onAppShow:()=>Xe,onError:()=>Je,onPageNotFound:()=>tt,onUnhandledRejection:()=>et});function Je(e){return T(`onError`,e)}function Ye(e){return T(`offError`,e)}function Xe(e){return T(`onAppShow`,e)}function Ze(e){return T(`onAppHide`,e)}function Qe(e){return T(`offAppShow`,e)}function $e(e){return T(`offAppHide`,e)}function et(){}function tt(){}function nt(){}var rt=`__diminaArrayBufferBase64`,it=`__diminaFileDataBase64`,at=`__diminaFileDataType`,E=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ot=(()=>{let e={};for(let t=0;t<64;t++)e[E[t]]=t;return e})();function st(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function ct(e){return e&&e.buffer&&st(e.buffer)}function lt(e){return st(e)?e:ct(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function ut(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=E[t[r]>>2],n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2|t[r+2]>>6],n+=E[t[r+2]&63];return r<t.length&&(n+=E[t[r]>>2],r+1<t.length?(n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2],n+=`=`):(n+=E[(t[r]&3)<<4],n+=`==`)),n}function dt(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=ot[t[e]],o=ot[t[e+1]],s=t[e+2]===`=`?0:ot[t[e+2]],c=t[e+3]===`=`?0:ot[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function ft(e){let t=lt(e);return t?{[at]:`base64`,[it]:ut(t)}:e}function D(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=ft(n[e]));return n}function pt(e){return e&&typeof e==`object`&&e[rt]!==void 0?dt(e[rt]):e}function mt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:pt(e.data)}:e}function ht(e){if(!e||typeof e!=`object`||!e.entries||typeof e.entries!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.entries))t[n]=r&&typeof r==`object`&&r.data!==void 0?{...r,data:pt(r.data)}:r;return{...e,entries:t}}function gt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[rt]===void 0)return e;let r=new Uint8Array(dt(e[rt]));new Uint8Array(t).set(r,n);let{[rt]:i,...a}=e;return{...a,arrayBuffer:t}}function _t(e){let t={...e},n=lt(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var vt=class{constructor(e={}){this.mode=e.mode,this.size=e.size,this.lastAccessedTime=e.lastAccessedTime,this.lastModifiedTime=e.lastModifiedTime,this._isDirectory=!!e.isDirectory,this._isFile=!!e.isFile}isDirectory(){return this._isDirectory}isFile(){return this._isFile}};function yt(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function bt(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if(yt(e))return new vt(e);if(Array.isArray(e))return e.map(e=>bt(e));let t={};for(let[n,r]of Object.entries(e))t[n]=bt(r);return t}function xt(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:bt(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:bt(e.statsMap)}}return bt(e)}function St(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function O(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=T(e,r(St(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function Ct(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return O(e,t,{prepare:_t,transform:e=>gt(e,n,r)})}var wt=class{access(e){return O(`FileSystemManager.access`,e)}accessSync(e){return T(`FileSystemManager.accessSync`,e)}appendFile(e){return O(`FileSystemManager.appendFile`,e,{prepare:D})}appendFileSync(e,t,n){return T(`FileSystemManager.appendFileSync`,D({filePath:e,data:t,encoding:n}))}close(e){return O(`FileSystemManager.close`,e)}closeSync(e){return T(`FileSystemManager.closeSync`,e)}copyFile(e){return O(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return T(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return O(`FileSystemManager.fstat`,e,{transform:xt})}fstatSync(e){return xt(T(`FileSystemManager.fstatSync`,e))}ftruncate(e){return O(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return T(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return O(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return O(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return O(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return T(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return O(`FileSystemManager.open`,e)}openSync(e){return T(`FileSystemManager.openSync`,e)}read(e){return Ct(`FileSystemManager.read`,e)}readSync(e){return gt(T(`FileSystemManager.readSync`,_t(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return O(`FileSystemManager.readCompressedFile`,e,{transform:mt})}readCompressedFileSync(e){return pt(T(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return O(`FileSystemManager.readdir`,e)}readdirSync(e){return T(`FileSystemManager.readdirSync`,e)}readFile(e){return O(`FileSystemManager.readFile`,e,{transform:mt})}readFileSync(e,t,n,r){return pt(T(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return O(`FileSystemManager.readZipEntry`,e,{transform:ht})}removeSavedFile(e){return O(`FileSystemManager.removeSavedFile`,e)}rename(e){return O(`FileSystemManager.rename`,e)}renameSync(e,t){return T(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return O(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return T(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return O(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return T(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return O(`FileSystemManager.stat`,e,{transform:xt})}statSync(e,t){return xt(T(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return O(`FileSystemManager.truncate`,e)}truncateSync(e,t){return T(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return O(`FileSystemManager.unlink`,e)}unlinkSync(e){return T(`FileSystemManager.unlinkSync`,e)}unzip(e){return O(`FileSystemManager.unzip`,e)}write(e){return O(`FileSystemManager.write`,e,{prepare:e=>D(e,[`arrayBuffer`,`data`])})}writeSync(e){return T(`FileSystemManager.writeSync`,D(e,[`arrayBuffer`,`data`]))}writeFile(e){return O(`FileSystemManager.writeFile`,e,{prepare:D})}writeFileSync(e,t,n){return T(`FileSystemManager.writeFileSync`,D({filePath:e,data:t,encoding:n}))}};Object.getOwnPropertyNames(wt.prototype).filter(e=>e!==`constructor`);var Tt=null;function Et(){return Tt||=new wt,Tt}var Dt=t({USER_DATA_PATH:()=>Ot,fileSystemManagerAPINames:()=>kt,getFileSystemManager:()=>It}),Ot=`difile://usr`,kt=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],At=`is not supported by the devtools simulator: the service thread talks to the container over an asynchronous postMessage bridge, so a synchronous return value is impossible — use the async variant`,jt=`not supported by the devtools simulator (no container backend)`;function Mt(e){return function(){throw Error(`FileSystemManager.${e} ${At}`)}}function Nt(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${jt}`}),t.complete?.()}}function Pt(e){let t=Object.getPrototypeOf(e),n=new Set(kt);for(let e of Object.getOwnPropertyNames(t))e===`constructor`||n.has(e)||(t[e]=e.endsWith(`Sync`)?Mt(e):Nt(e));return e}var Ft;function It(){return Ft||=Pt(Et()),Ft}var Lt=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],Rt=t({canIUse:()=>Ht,env:()=>zt}),zt={USER_DATA_PATH:`difile://usr`},Bt=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,...Lt.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...kt.map(e=>`FileSystemManager.${e}`)]),Vt={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function Ht(e){if(Bt.has(e))return!0;try{return T(`canIUse`,Object.hasOwn(Vt,e)?Vt[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Ut=t({getPerformance:()=>Wt});function Wt(){return Gt.getInstance()}var Gt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Kt,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new qt(this,e)}getEntries(){return this.entryList.getEntries()}getEntriesByName(e,t){return this.entryList.getEntriesByName(e,t)}getEntriesByType(e){return this.entryList.getEntriesByType(e)}setBufferSize(e){this.entryList.maxEntrySize=e}},Kt=class{constructor(){this._list=[],this.maxEntrySize=30}push(e){for(let t of e)this._list.length>=this.maxEntrySize&&this._list.shift(),this._list.push(t)}getEntriesByName(e,t){return this._entryFilter(e,t)}getEntriesByType(e){return this._entryFilter(null,e)}_entryFilter(e,t){return this._list.filter(n=>!(e&&e!==n.name||t&&t!==n.entryType))}getEntries(){return this._list}},qt=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=x.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){T(`removePerformanceObserver`,{observerId:e.observerId},`render`),x.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),T(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new Kt;t.push(e.filter(e=>{let t=!1;return this.entryTypes&&this.entryTypes.length>0&&this.entryTypes.forEach(n=>{e.entryType===n&&(t=!0)}),t})),typeof this.callback==`function`&&this.callback(t)}}disconnect(){this.connected=!1,this.observerId&&T(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&x.remove(this.callbackId),this.observerId=null,this.callbackId=null}},Jt=t({loadSubpackage:()=>Xt,preDownloadSubpackage:()=>Yt});function Yt(e){return T(`preDownloadSubpackage`,e)}function Xt(e){return T(`loadSubpackage`,e)}var Zt=t({getAppBaseInfo:()=>on,getDeviceInfo:()=>sn,getSystemInfo:()=>nn,getSystemInfoAsync:()=>an,getSystemInfoSync:()=>rn,getWindowInfo:()=>en,offThemeChange:()=>ln,onThemeChange:()=>cn,openAppAuthorizeSetting:()=>tn,openSystemBluetoothSetting:()=>$t}),Qt=new Set;S.onUpdate(e=>{let t=e.systemInfo?.theme;t&&Qt.forEach(e=>e({theme:t}))});function $t(e){return T(`openSystemBluetoothSetting`,e)}function en(e){return T(`getWindowInfo`,e)}function tn(e){return T(`openAppAuthorizeSetting`,e)}function nn(e){return new Promise(t=>{t(T(`getSystemInfo`,e))})}function rn(){return T(`getSystemInfoSync`)}function an(e){return T(`getSystemInfoAsync`,e)}function on(){return T(`getAppBaseInfo`)}function sn(){return T(`getDeviceInfo`)}function cn(e){n(e)&&Qt.add(e)}function ln(e){n(e)?Qt.delete(e):Qt.clear()}var un=t({getUpdateManager:()=>gn}),dn=`onUpdateStatusChange`,fn=`updatefail`,pn=`updateready`,mn=`noupdate`,hn=`updating`;function gn(){return _n.getInstance()}var _n=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],C.on(dn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===fn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===pn){let e=this.checkForUpdateResult?.hasUpdate!==!0,t=!this.updateReady;this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},e&&this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),t&&this.emit(this.updateReadyListeners);return}if(t===hn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===mn){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,T(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};_n.getInstance();var vn=t({createCameraContext:()=>yn});function yn(){return new bn}var bn=class{takePhoto(e={}){return T(`takePhoto`,e)}startRecord(e={}){return T(`startRecordCamera`,e)}stopRecord(e={}){return T(`stopRecordCamera`,e)}},xn=t({reportAnalytics:()=>Sn,reportEvent:()=>Cn});function Sn(...e){return T(`reportAnalytics`,e)}function Cn(e,t){return T(`reportAnalytics`,{eventId:e,data:t})}var wn=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Tn=(()=>{let e={};for(let t=0;t<64;t++)e[k[t]]=t;return e})();function En(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Dn(e){return En(e)?e:e&&e.buffer&&En(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function On(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=k[t[r]>>2],n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=k[(t[r+1]&15)<<2|t[r+2]>>6],n+=k[t[r+2]&63];return r<t.length&&(n+=k[t[r]>>2],r+1<t.length?(n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=`${k[(t[r+1]&15)<<2]}=`):n+=`${k[(t[r]&3)<<4]}==`),n}function kn(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=Tn[t[e]],o=Tn[t[e+1]],s=t[e+2]===`=`?0:Tn[t[e+2]],c=t[e+3]===`=`?0:Tn[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function An(e){let t=Dn(e);return t?{[wn]:On(t)}:e}function jn(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?kn(e[wn]):e}function Mn(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=jn(r);return{...e,advertisData:jn(e.advertisData),serviceData:t}}function Nn(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(Mn)}}function Pn(e){return!e||typeof e!=`object`?e:{...e,value:jn(e.value)}}function Fn(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function In(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=T(e,n(Fn(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function A(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=x.store(e=>t(n(e)),!0);return r.set(t,i),T(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),x.remove(n),T(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())x.remove(e);return r.clear(),T(t)}}}var Ln=t({closeBluetoothAdapter:()=>Xn,getBluetoothAdapterState:()=>Yn,getBluetoothDevices:()=>Jn,getConnectedBluetoothDevices:()=>qn,isBluetoothDevicePaired:()=>Zn,makeBluetoothPair:()=>Qn,offBluetoothAdapterStateChange:()=>Kn,offBluetoothDeviceFound:()=>Gn,onBluetoothAdapterStateChange:()=>Wn,onBluetoothDeviceFound:()=>Un,openBluetoothAdapter:()=>Hn,startBluetoothDevicesDiscovery:()=>Vn,stopBluetoothDevicesDiscovery:()=>Bn}),Rn=A(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,Nn),zn=A(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function Bn(e){return T(`stopBluetoothDevicesDiscovery`,e)}function Vn(e){return T(`startBluetoothDevicesDiscovery`,e)}function Hn(e){return T(`openBluetoothAdapter`,e)}function Un(e){return Rn.on(e)}function Wn(e){return zn.on(e)}function Gn(e){return Rn.off(e)}function Kn(e){return zn.off(e)}function qn(e){return In(`getConnectedBluetoothDevices`,e,{transform:Nn})}function Jn(e){return In(`getBluetoothDevices`,e,{transform:Nn})}function Yn(e){return T(`getBluetoothAdapterState`,e)}function Xn(e){return T(`closeBluetoothAdapter`,e)}function Zn(e){return T(`isBluetoothDevicePaired`,e)}function Qn(e){return T(`makeBluetoothPair`,e)}var $n=t({closeBLEConnection:()=>hr,createBLEConnection:()=>mr,getBLEDeviceCharacteristics:()=>pr,getBLEDeviceRSSI:()=>fr,getBLEDeviceServices:()=>dr,getBLEMTU:()=>gr,notifyBLECharacteristicValueChange:()=>ur,offBLECharacteristicValueChange:()=>lr,offBLEConnectionStateChange:()=>cr,offBLEMTUChange:()=>vr,onBLECharacteristicValueChange:()=>sr,onBLEConnectionStateChange:()=>or,onBLEMTUChange:()=>_r,readBLECharacteristicValue:()=>ar,setBLEMTU:()=>ir,writeBLECharacteristicValue:()=>rr}),er=A(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),tr=A(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,Pn),nr=A(`onBLEMTUChange`,`offBLEMTUChange`);function rr(e){return In(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:An(e.value)}:e}})}function ir(e){return T(`setBLEMTU`,e)}function ar(e){return T(`readBLECharacteristicValue`,e)}function or(e){return er.on(e)}function sr(e){return tr.on(e)}function cr(e){return er.off(e)}function lr(e){return tr.off(e)}function ur(e){return T(`notifyBLECharacteristicValueChange`,e)}function dr(e){return T(`getBLEDeviceServices`,e)}function fr(e){return T(`getBLEDeviceRSSI`,e)}function pr(e){return T(`getBLEDeviceCharacteristics`,e)}function mr(e){return T(`createBLEConnection`,e)}function hr(e){return T(`closeBLEConnection`,e)}function gr(e){return T(`getBLEMTU`,e)}function _r(e){return nr.on(e)}function vr(e){return nr.off(e)}var yr=t({getClipboardData:()=>xr,setClipboardData:()=>br});function br(e){return T(`setClipboardData`,e)}function xr(e){return T(`getClipboardData`,e)}var Sr=t({addPhoneContact:()=>wr,chooseContact:()=>Cr});function Cr(e){return T(`chooseContact`,e)}function wr(e){return T(`addPhoneContact`,e)}var Tr=t({hideKeyboard:()=>Er});function Er(e){return T(`hideKeyboard`,e)}var Dr=t({offMemoryWarning:()=>kr,onMemoryWarning:()=>Or});function Or(e){return T(`onMemoryWarning`,e)}function kr(e){return T(`offMemoryWarning`,e)}var Ar=t({getNetworkType:()=>jr});function jr(e){return T(`getNetworkType`,e)}var Mr=t({makePhoneCall:()=>Nr});function Nr(e){return T(`makePhoneCall`,e)}var Pr=t({scanCode:()=>Fr});function Fr(e){return T(`scanCode`,e)}var Ir=t({offUserCaptureScreen:()=>zr,onUserCaptureScreen:()=>Rr}),Lr=A(`onUserCaptureScreen`,`offUserCaptureScreen`),j;function Rr(e){if(typeof e==`function`)return j&&j!==e&&Lr.off(j),j=e,Lr.on(e)}function zr(e){if(typeof e!=`function`||e===j)return j=void 0,Lr.off(e)}var Br=t({vibrateLong:()=>Hr,vibrateShort:()=>Vr});function Vr(e){return T(`vibrateShort`,e)}function Hr(e){return T(`vibrateLong`,e)}var Ur=t({extBridge:()=>Wr,extOffBridge:()=>Kr,extOnBridge:()=>Gr,offLoginStatusChanged:()=>Jr,onLoginStatusChanged:()=>qr});function Wr({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),T(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function Gr({event:e,module:t,callBack:n,isSustain:r=!0}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOnBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOnBridge 参数 event 为空`);return}if(!n){console.error(`[ERROR]: extOnBridge 参数 callBack 为空`);return}let i=`${t}_${e}`;T(i,{evtId:i,keep:r,success:n})}function Kr({event:e,module:t,callBack:n}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOffBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOffBridge 参数 event 为空`);return}let r=`${t}_${e}`;T(r,{evtId:r,success:n})}function qr(e){C.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function Jr(){C.off(`notifyLoginStatusChanged`)}var Yr=new WeakSet;function Xr(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!Yr.has(e)){Yr.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{Yr.delete(e)}}console.error(`[service] ${r} error:`,t)}function M(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?Xr(e,t,i):console.error(`[service] ${i} error:`,t);return}}function N(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])M(e,a,n,r,i)}var Zr=[`onLaunch`,`onShow`,`onHide`],Qr=[`globalData`],$r=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){Zr.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)Zr.includes(t)||Qr.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){M(this,this.onLaunch,[this.options],`onLaunch`),M(this,this.onShow,[this.options],`onShow`)}appShow(){M(this,this.onShow,[this.options],`onShow`)}appHide(){M(this,this.onHide,[],`onHide`)}},ei=new Set([`2d`]),ti=new Set([`webgl`,`experimental-webgl`,`webgl2`]),ni=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),ri=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),ii=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),ai=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),oi=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),si={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},ci=new Map,P={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function li(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function ui(e,t){!e||!t||ci.set(e,t)}function di(e){return ci.get(e)||null}function fi(e,t){return e&&e[li(t)]||null}function F(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>F(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}let t={};for(let[n,r]of Object.entries(e))t[n]=F(r);return t}C.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{ui(e,t)}),C.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{ui(e,t)});var pi=1,mi=1;function hi(){let e=w.getPageInfo();return e?.bridgeId||e?.id||``}function I(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)&&n>=0?Math.floor(n):t}function gi(e,t,n){C.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function _i(e){Promise.resolve().then(e)}function vi(e){return Object.prototype.toString.call(e)===`[object Object]`}function yi(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function L(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=yi(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>L(e));if(vi(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}return e}function R(e){return Array.from(e).map(e=>L(e))}function z(e=`canvas_resource`){return`${e}_${p()}`}var B=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=pi++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:R(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},bi=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=x.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=x.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},xi=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}async getImageData(e,t,n,r){return await this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};if(e===`createImageData`){let e=t[0],n=t[1];return{width:e,height:n,data:new Uint8ClampedArray(e*n*4)}}let n=ni.has(e)?z():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:n}),n)return new B(this.canvas,n)}},Si=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=z(`webgl_extension_resource`),n=new B(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof B)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:R(t),resultId:r}),n}},Ci=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...si,...vi(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(P,t))return P[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(P.VIEWPORT,[0,0,e,t]),this.state.set(P.SCISSOR_BOX,[0,0,e,t]),this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(P.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(P.DEPTH_CLEAR_VALUE,1),this.state.set(P.DEPTH_WRITEMASK,!0),this.state.set(P.DEPTH_FUNC,P.LESS),this.state.set(P.STENCIL_CLEAR_VALUE,0),this.state.set(P.LINE_WIDTH,1),this.state.set(P.CULL_FACE_MODE,P.BACK),this.state.set(P.FRONT_FACE,P.CCW),this.state.set(P.ACTIVE_TEXTURE,P.TEXTURE0),this.state.set(P.PACK_ALIGNMENT,4),this.state.set(P.UNPACK_ALIGNMENT,4),this.state.set(P.CURRENT_PROGRAM,null),this.state.set(P.ARRAY_BUFFER_BINDING,null),this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(P.TEXTURE_BINDING_2D,null),this.state.set(P.FRAMEBUFFER_BINDING,null),this.state.set(P.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=F(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(F(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return F(e)}queueError(e){e&&e!==P.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(R(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:R(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=z(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new B(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),P.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,P.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t)}let n=ri.get(e)||ii.get(e);if(n)return this.createResource(e,t,n);if(oi.has(e)){let n=t[0];return n instanceof B&&n.resourceType===oi.get(e)&&!n.deleted}ai.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:R(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(P.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(P.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(P.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(P.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(P.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(P.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(P.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(P.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(P.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(P.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(P.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(P.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===P.ARRAY_BUFFER?this.state.set(P.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===P.ELEMENT_ARRAY_BUFFER&&this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===P.TEXTURE_2D&&this.state.set(P.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(P.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(P.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?F(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof B)||e.resourceType!==`shader`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.SHADER_TYPE:return e.metadata.shaderType;case P.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof B)||e.resourceType!==`program`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.LINK_STATUS:return!!e.metadata.linkStatus;case P.VALIDATE_STATUS:return!!e.metadata.validateStatus;case P.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=z(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new Si(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},wi=class{constructor({nodeId:e,bridgeId:t=hi(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1,webglCapabilities:o}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.webglCapabilities=o||di(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=I(n,300),this._height=I(r,150)}get width(){return this._width}set width(e){this._width=I(e,300),this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width})}get height(){return this._height}set height(e){this._height=I(e,150),this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height})}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=li(n),i=ti.has(n);if(!ei.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?fi(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=z(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:L(t)});let s=i?new Ci(this,o,r,t,a):new xi(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=z(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=F(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new bi(this,z(`canvas_image`))}requestAnimationFrame(e){let t=mi++,r=x.store(t=>{n(e)&&e(t)});return gi(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){gi(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){return new Promise((a,o)=>{let s=x.store(e=>{a(e)});this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s})})}toDataURL(e=`image/png`,t){return new Promise(n=>{let r=x.store(e=>{n(e)});this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:r})})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,_i(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback||e.typedArrayUpdateId)?x.store(e=>this.applyFlushFeedback(e)):void 0;gi(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:t})}};function Ti(e,t=hi()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(ui(t,e.webglCapabilities),new wi({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function Ei(e,t=hi()){return Array.isArray(e)?e.map(e=>Ei(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:Ti(e.node,t)}:e}function Di(e={}){let t=I(e.width,300),n=I(e.height,150),r=e.type||`2d`,i=z(`offscreen_canvas`),a=hi();return gi(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new wi({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:di(a)})}var Oi=t({createSelectorQuery:()=>ki});function ki(){return new Ni}function Ai(){return w.getPageInfo()}function ji(){let e=Ai();return e?.__id__||e?.id}function Mi(){let e=Ai();return e?.bridgeId||e?.id}var Ni=class{constructor(){this.__componentId=ji(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Pi(this,this.__componentId,e,!0)}selectAll(e){return new Pi(this,this.__componentId,e,!1)}selectViewport(){return new Pi(this,ji(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=Mi();T(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Ei(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Pi=class{constructor(e,t,n,r){this.__selectorQuery=e,this.__moduleId=t,this.__selector=n,this.__single=r}fields(e,t){return this.__selectorQuery.__push(this.__selector,this.__moduleId,this.__single,e,t),this.__selectorQuery}boundingClientRect(e){return this.fields({id:!0,dataset:!0,rect:!0,size:!0},e)}context(e){return this.fields({context:!0},e)}node(e){return this.fields({node:!0},e)}scrollOffset(e){return this.fields({id:!0,dataset:!0,scrollOffset:!0},e)}},Fi=t({createIntersectionObserver:()=>Ii});function Ii(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Li(e,{thresholds:n,initialRatio:r,observeAll:i})}var Li=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=x.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);T(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){T(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Ri=t({createMediaQueryObserver:()=>Bi});function zi(e={}){let t={};for(let n of[`minWidth`,`maxWidth`,`width`,`minHeight`,`maxHeight`,`height`]){let r=Number(e[n]);Number.isFinite(r)&&r>=0&&(t[n]=r)}return typeof e.orientation==`string`&&/^[-_a-z0-9]+$/i.test(e.orientation)&&(t.orientation=e.orientation),t}function Bi(e,t={}){return new Vi(e,t)}var Vi=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=x.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){T(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),x.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),T(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:zi(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,T(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(x.remove(this._callbackId),this._callbackId=null)}};function Hi(e){if(typeof e!=`string`||e.length===0)return null;let t=[],n=``,r=0,i=()=>{n.length>0&&(t.push(n),n=``)};for(;r<e.length;){let a=e[r];if(a===`\\`){let t=e[r+1];if(t===`.`||t===`[`||t===`]`||t===`\\`){n+=t,r+=2;continue}n+=a,r++;continue}if(a===`.`){i(),r++;continue}if(a===`[`){if(t.length===0&&n.length===0)return null;i();let a=e.indexOf(`]`,r+1);if(a===-1)return null;let o=e.slice(r+1,a);if(!/^\d+$/.test(o))return null;t.push(Number(o)),r=a+1;continue}if(a===`]`)return null;n+=a,r++}return i(),t.length>0?t:null}function Ui(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1],a=Object.prototype.hasOwnProperty.call(r,n);typeof i==`number`?(!a||!Array.isArray(r[n]))&&(r[n]=[]):(!a||r[n]===null||typeof r[n]!=`object`||Array.isArray(r[n]))&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Wi(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Gi(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){if(e===`**`){n.push({path:[],wildcard:!0});continue}let t=e.endsWith(`.**`),r=Hi(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Ki(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Wi(e.path,t)||Wi(t,e.path)}function qi(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:Gi(e.expression)}))}function Ji(e,t,r=e.data,i=e.__info__||{}){for(let a of qi(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Ki(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));M(e,a.observer,i,`data observer`)}}function Yi(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Xi(e,t){let n=e.__info__?.properties||{};return t.flatMap(e=>{let t=e.path[0];return typeof t!=`string`||!Object.prototype.hasOwnProperty.call(n,t)?[]:[{propertyName:t,oldValue:e.path.length===1?e.oldValue:void 0,path:e.path,value:e.value}]})}function Zi(e,t,r){if(!t||typeof t!=`object`||Array.isArray(t))return console.warn(`[service] setData data must be an object`),null;let i=!e.__dataUpdateTransaction__,a=e.__dataUpdateTransaction__||{changes:[],pendingPaths:[],callbacks:[]};e.__dataUpdateTransaction__=a,n(r)&&a.callbacks.push(r);for(let r of Object.keys(t)){let i=Hi(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=y(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;Ui(e.data,i,o),a.changes.push({key:r,path:i,oldValue:s,value:o}),a.pendingPaths.push(i)}if(!i)return null;try{for(;a.pendingPaths.length>0;){let t=a.pendingPaths;a.pendingPaths=[],Ji(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:Yi(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Xi(e,a.changes)}}function Qi(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);s.length===1&&c===a.oldValue&&!t?.observeAssignments||(r(o)?M(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&M(e,o,[c,a.oldValue,s],`property observer`))}}var $i=new Map;function ea(e){return $i.has(e)||$i.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),$i.get(e)}function ta(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return x.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function na(e){let t=ea(e);t.depth++}function ra(e){let t=ea(e);t.depth>0&&t.depth--,t.depth===0&&aa(e)}function ia(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Hi(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(De({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function V(e,t,n,r,i=[]){let a=ea(e),o=a.byModuleId.get(t),s=ia(n,i);if(o)Object.assign(o.data,s.data),o.changes.push(...s.changes);else{let e={moduleId:t,data:s.data,changes:s.changes};a.byModuleId.set(t,e),a.updates.push(e)}r&&a.callbackIds.push(r),a.depth===0&&!a.scheduled&&(a.scheduled=!0,Promise.resolve().then(()=>{a.scheduled=!1,a.depth===0&&aa(e)}))}function aa(e){let t=$i.get(e);if(!t||t.updates.length===0)return;let n=t.updates,r=t.callbackIds;t.updates=[],t.byModuleId=new Map,t.callbackIds=[],t.scheduled=!1,C.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function oa(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>oa(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=oa(n)),e),{}):e}function sa(e){if(e){let t={};for(let n in e){let r=ge(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(la),default:r.value}}return t}}var ca=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function la(e){return Array.isArray(e)?e.map(e=>la(e)):e===null||e===``?null:ca.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function ua(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,m(n),h(n),r];for(let t of i)if(t&&e[t]!==void 0){let n=e[t];if(typeof n==`string`)return{bind:n};if(n&&typeof n==`object`)return n}}function da(e,t){if(!Array.isArray(t))return;let r=new WeakMap,i=new WeakSet,a=e.properties,o=e.data,s=e.methods,c=e.relations,l=Object.prototype.hasOwnProperty.call(e,`export`),u=e.export,d,f,p,m,h;function g(e,t){let n=Array.isArray(e)?[...e]:{...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],i=t[e];n[e]=typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?g(r,i):i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function H(e,t,n){let r=e;for(;r&&r.__parentId__;){if(r.__parentId__===t)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}function fa(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function pa(e,t){if(!e||!Array.isArray(e.dependencies))return!1;for(let n of e.dependencies){if(n in t)return!0;for(let e of Object.keys(t))if(e.startsWith(n+`.`)||e.startsWith(n+`[`)||n.startsWith(e+`.`)||n.startsWith(e+`[`))return!0}return!1}function ma(e,t){if(!(!e||!e.expression)){if(e.isSimple)return f(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function ha(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!H(t,e.__id__,r)||t.__parentId__!==e.__id__)continue;let a=t.__info__?.properties||{},o={};for(let r in a){let i=e.__childPropsBindings__?.[t.__id__]?.[r];i&&pa(i,n)&&(o[r]=y(ma(i,e.data)))}if(Object.keys(o).length>0){let e=t.normalizePropertyValues?.(o,{applyFilter:!1})||o,n=t.tO?.(e)||t.normalizePropertyValues?.(e)||e;t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,e),i.push({child:t,data:n})}}return i}var ga=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],_a=[`show`,`hide`,`resize`,`routeDone`],va=class e{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=y(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__eventAttr__=t.eventAttr,this.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,ge(t)]))}init({deferInitialData:e=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=xe(n,void 0,{absent:!0});if(this.data[t]=r,this.__initialPropertyNames__.has(t)){let n=this.normalizePropertyValue(t,e[t],{applyFilter:!1});this.__initialPropertyValues__[t]=n,this.__initialPropertyChanges__.push({propertyName:t,oldValue:void 0,path:[t],value:n})}}}this.#u(),this.#t(),this.#e(),this.#m(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],V(this.bridgeId,this.__id__,{},ta(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(!(!e||typeof e!=`object`))for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}if(e.startsWith(`../`)){let t=this.is.split(`/`),n=e.split(`/`),r=t.slice(0,-1);for(let e of n)e===`..`?r.pop():e!==`.`&&r.push(e);return r.join(`/`)}return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(K.instances[this.bridgeId]||{}).filter(e=>e===this||!e.__isComponent__||e.__componentAttached__||e.__componentAttaching__);for(let[n,r]of Object.entries(e)){let{type:e,target:i}=r,a=this.__relationPaths__.get(n),o=t.filter(e=>i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`)).filter(t=>this.#a(t,e));for(let e of o)this.#s(n,e,r)}this.#i()}#i(){let e=Object.values(K.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`),o&&this.#a(e,t)&&this.#s(n,e,r)}}#a(e,t){let n=Object.values(K.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#o(e.__id__,this.__id__,n);case`descendant`:return this.#o(this.__id__,e.__id__,n);default:return!1}}#o(e,t,n){let r=n.find(e=>e.__id__===t);for(;r&&r.__parentId__;){if(r.__parentId__===e)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}#s(e,t,n){let r=this.__relations__.get(e)||[];r.includes(t)||(r.push(t),this.__relations__.set(e,r),M(this,n.linked,[t],`relation linked callback`))}#c(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),M(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){M(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=Zi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Qi(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),Qi(this,n.propertyChanges);return}let r=ha(this,K.instances[this.bridgeId],n.changedData);V(this.bridgeId,this.__id__,n.changedData,ta(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)}),Qi(this,n.propertyChanges)}#u(){ga.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&_a.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#d(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#f(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=this.__initialPropertyChanges__.map(e=>e.path);e.length>0&&(Ji(this,e),Qi(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),M(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return Ji(this,o),Qi(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=xe(s,t,{absent:r});if(r||!i||!this.hasPropertyFilter(e))return c;let l=this.__info__.properties[e],u=n(l.filter)?l.filter:this.__info__.methods?.[l.filter];if(!n(u))return c;let d=M(this,u,[c,a,o],`property filter`);return d===void 0?c:d}normalizePropertyValues(e,{applyFilter:t=!0}={}){let n={};for(let[r,i]of Object.entries(e||{}))n[r]=this.normalizePropertyValue(r,i,{applyFilter:t});return n}getPageId(){return this.__id__}hasBehavior(e){let t=function(n){if(!Array.isArray(n))return!1;if(n.includes(e))return!0;for(let e of n)if(e&&e.behaviors&&t(e.behaviors))return!0;return!1};return t(this.behaviors)}createSelectorQuery(){return ki().in(this)}selectComponent(e){let t=Object.values(K.instances[this.bridgeId]),n=t.find(n=>H(n,this.__id__,t)&&fa(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(K.instances[this.bridgeId]);return t.filter(n=>H(n,this.__id__,t)&&fa(e,n))}selectOwnerComponent(){let e=Object.values(K.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Ii(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,na(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{M(this,e,[],`groupSetData callback`)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__,n=this.__groupSetDataChanges__;this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];let r=ha(this,K.instances[this.bridgeId],e);V(this.bridgeId,this.__id__,e,ta(this,t),n),r.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];ra(this.bridgeId)}}createMediaQueryObserver(e){return Bi(this,e)}getRelationNodes(e){let t=this.__relations__.get(e);return t?[...t]:null}animate(e,t,r,i,a){n(i)&&(a=i,i=void 0),T(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),T(`componentClearAnimation`,{moduleId:this.__id__,selector:e,options:t||{},success:r},`render`)}async triggerEvent(t,n,r={}){if(!t)return;let i=t.trim();if(!i)return;let a={bubbles:r.bubbles===!0,composed:r.composed===!0,capturePhase:r.capturePhase===!0},o={id:this.id,dataset:this.dataset||{}},s=!1,c=!1,l={type:i,timeStamp:Date.now(),detail:n,bubbles:a.bubbles,composed:a.composed,currentTarget:null,target:o,preventDefault(){c=!0},stopPropagation(){s=!0}};Object.defineProperty(l,"defaultPrevented",{enumerable:!0,get:()=>c});let u=e.prototype.getCustomEventPath.call(this,a.composed),d=async(e,t)=>{let n=ua(e.eventAttr,i);if(!n)return;let r=t?n.captureCatch??n.captureBind:n.catch??n.bind;if(!r)return;l.currentTarget=e.currentTarget;let a=await K.triggerEvent({bridgeId:this.bridgeId,moduleId:e.moduleId,methodName:r,event:l});(t?n.captureCatch:n.catch)&&l.stopPropagation(),a===!1&&(l.preventDefault(),l.stopPropagation())};if(a.capturePhase)for(let e=u.length-1;e>=0&&!s;e--)await d(u[e],!0);if(s)return;let f=a.bubbles?u:u.slice(0,1);for(let e of f)if(await d(e,!1),s)break}getCustomEventPath(e){let t=[{moduleId:this.__pageId__,eventAttr:this.__eventAttr__||{},currentTarget:{id:this.id,dataset:this.dataset||{}}}];if(Array.isArray(this.__eventPath__)){let n=this.__eventPath__.filter(e=>e?.moduleId).map(e=>{let t=e.isComponentHost&&e.nodeModuleId?K.instances[this.bridgeId]?.[e.nodeModuleId]:null;return{moduleId:e.moduleId,nodeModuleId:e.nodeModuleId,isComponentHost:e.isComponentHost===!0,eventAttr:e.eventAttr||{},currentTarget:{id:t?.id??e.targetInfo?.id,dataset:t?.dataset||e.targetInfo?.dataset||{}}}}),r=K.instances[this.bridgeId]||{},i=new Set([this.__id__]),a=0,o=r[this.__parentId__];for(;o?.__isComponent__&&!i.has(o.__id__);){i.add(o.__id__);let e=n.findIndex(e=>e.isComponentHost&&e.nodeModuleId===o.__id__);if(e>=0)a=Math.max(a,e+1);else if(Object.keys(o.__eventAttr__||{}).length>0){let e=-1;for(let t=0;t<n.length;t++)n[t].moduleId===o.__id__&&(e=t);let t=Math.max(a,e+1);n.splice(t,0,{moduleId:o.__pageId__,nodeModuleId:o.__id__,isComponentHost:!0,eventAttr:o.__eventAttr__,currentTarget:{id:o.id,dataset:o.dataset||{}}}),a=t+1}o=r[o.__parentId__]}for(let r of n)(e||r.moduleId===this.__pageId__)&&t.push(r);return t}let n=K.instances[this.bridgeId]||{},r=new Set([this.__id__]),i=n[this.__parentId__];for(;i?.__isComponent__&&!r.has(i.__id__);)r.add(i.__id__),(e||i.__pageId__===this.__pageId__)&&t.push({moduleId:i.__pageId__,eventAttr:i.__eventAttr__||{},currentTarget:{id:i.id,dataset:i.dataset||{}}}),i=n[i.__parentId__];return t}pageReady(){this.__isComponent__||M(this,this.ready,[],`ready lifetime`)}pageUnload(){this.__isComponent__||M(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`page show lifetime`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`page hide lifetime`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.resize,[e],`page resize lifetime`)}componentRouteDone(){N(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),M(this,this.routeDone,[],`page routeDone lifetime`)}componentCreated(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`)}componentAttached(){N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`)}componentMoved(){N(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),M(this,this.moved,[],`moved lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=this.__relations__.get(t)||[];for(let r of e)this.#l(t,r,n)}}componentDetached(){this.__componentAttached__=!1,N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=[...this.__relations__.get(t)||[]];for(let r of e)this.#c(t,r,n)}this.#h(),this.initd=!1}#h(){let e=Object.values(K.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,n]of t.__relations__.entries()){let r=n.indexOf(this);if(r!==-1){n.splice(r,1),t.__relations__.set(e,n);let i=t.__info__.relations?.[e];M(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){N(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),M(this,this.error,[e],`error lifetime`,!1)}},U=class e{static type=`component`;constructor(t,n){this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.isComponent=this.extraInfo.component,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,da(this.moduleInfo,this.behaviors),this.noReferenceData=oa(this.moduleInfo.data||{})}getProps(){let e=sa(this.moduleInfo.properties),t=Array.isArray(this.behaviors)?this.behaviors.filter(e=>typeof e==`string`&&e.startsWith(`wx://`)):[];if(Array.isArray(this.moduleInfo.externalClasses)&&this.moduleInfo.externalClasses.length>0){e||={};for(let t of this.moduleInfo.externalClasses)e[t]={type:[`s`],cls:!0}}return t.length&&(e||={},e.__diminaMeta={builtinBehaviors:t}),e}},ya=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=y(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1}={}){this.#e(),this.#t(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],V(this.bridgeId,this.__id__,{},ta(this,e))}setData(e,t){let n=Zi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=ha(this,K.instances[this.bridgeId],n.changedData);V(this.bridgeId,this.__id__,n.changedData,ta(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return ki().in(this)}getTabBar(){let e=Object.values(K.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&H(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(K.instances[this.bridgeId]||{}),n=t.find(n=>H(n,this.__id__,t)&&fa(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(K.instances[this.bridgeId]||{});return t.filter(n=>H(n,this.__id__,t)&&fa(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){let t=this.__info__[e];this[e]=n(t)?t.bind(this):t}}#t(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`),N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),M(this,this.onLoad,[this.opts.query||{}],`onLoad`),this.initd=!0}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`onShow`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`onHide`)}pageReady(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`),M(this,this.onReady,[],`onReady`)}pageUnload(){N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`),M(this,this.onUnload,[],`onUnload`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.onResize,[e],`onResize`)}},W=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,da(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=oa(this.moduleInfo.data||{})}},ba=class{static type=`app`;constructor(e){this.moduleInfo=e}},G=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}w.setInitId(n),b(`app`),b(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}})}createAppModule(e){let t=new ba(e);this.staticModules[ba.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))b(e);if(n===W.type){let n=new W(e,t);this.staticModules[r]=n}else if(n===U.type){let n=new U(e,t);this.staticModules[r]=n}else console.error(`[service] createModule ${n} error`)}}getPropsByPath(e){let t={};return this.getComponentProps(t,e),t}getComponentProps(e,t){if(t)for(let n of Object.values(t)){let t=this.staticModules[n];!t||e[n]||(e[n]=t.getProps(),this.getComponentProps(e,t.usingComponents))}}getAppModule(){return this.staticModules[ba.type]}getModuleByPath(e){return this.staticModules[e]}},K=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.instances={},this.pageStates=new Map}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=e)}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e||{},i=G.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(i.moduleInfo,this.defaultApp),this.defaultApp={},this.app=new $r(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){w.pushStack(e)}stackHide(e){w.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u,stackId:d,isCustomTabBar:f=!1,deferInitialData:p=!1}=e,m=G.getModuleByPath(r);if(!m){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},m.type===U.type){let e=new va(m,{bridgeId:t,moduleId:n,path:r,isCustomTabBar:f,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u});this.instances[t][n]=e,m.isComponent||w.push(e,d),e.init({deferInitialData:p});let h=this.getPageState(t);return!m.isComponent&&h.pendingShow&&!h.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(m.type===W.type){let e=new ya(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,w.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${m.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==U.type||!i.__isComponent__||i.__componentAttached__||i.__componentAttaching__)return;r&&this.instances[t]?.[r]&&(i.__parentId__=r);let a=this.instances[t]?.[i.__parentId__];if(a?.__isComponent__&&!a.__componentAttached__){i.__componentAttachPending__=!0;return}i.__componentAttachPending__=!1,i.__componentAttaching__=!0;try{i.__componentAttached__=!0,i.componentAttached(),i.__componentAttaching__=!1,this.getPageState(t).shown&&!i.__pageShown__&&(i.__pageShown__=!0,i.pageShow());let e=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let n of e)this.moduleAttached({bridgeId:t,moduleId:n.__id__});if(i.__pendingReadyOpts__){let e=i.__pendingReadyOpts__;delete i.__pendingReadyOpts__,this.moduleReady(e)}}finally{i.__componentAttaching__=!1}}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r,eventPath:i}=e,a=this.instances[t]?.[n];if(a){if(Array.isArray(i)&&(a.__eventPath__=i),r&&a.__parentId__){let e=this.instances[t]?.[a.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(a.__type__===U.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;if(Object.values(this.instances[t]||{}).some(e=>e?.__isComponent__&&e.__componentAttached__&&!e.__componentReadied__&&this.isDescendantInstance(e,a,t))){a.__pendingReadyOpts__=e;return}a.__componentReadied__=!0,a.componentReadied(),this.flushPendingEvents(a),a.flushInitSetDataCallbacks?.();let n=this.getPageInstance(t);n&&this.checkAndCallPageReady(t,n.__id__);let r=this.instances[t]?.[a.__parentId__];for(;r?.__isComponent__;){if(r.__pendingReadyOpts__){let e=r.__pendingReadyOpts__;delete r.__pendingReadyOpts__,this.moduleReady(e)}r=this.instances[t]?.[r.__parentId__]}}}}isDescendantInstance(e,t,n){let r=e;for(;r?.__parentId__;){if(r.__parentId__===t.__id__)return!0;r=this.instances[n]?.[r.__parentId__]}return!1}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t]?.[n];r&&(r.__type__===U.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.componentDetached(),r.__componentDetached__=!0),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!1,n.pendingShow=!0,!this.instances[t])return;let r=this.getPageInstance(t);if(!r?.initd)return;if(n.shown){n.pendingShow=!1;return}n.shown=!0,n.pendingShow=!1;let i=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===W.type?i.push(e):e.__type__===U.type&&(e.__isComponent__?e.__componentAttached__&&!e.__pageShown__&&(e.__pageShown__=!0,e.pageShow()):i.push(e)))}),i.forEach(e=>{e.pageShow()}),n.pendingReady&&this.pageReady({...e,moduleId:r.__id__})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.getPageState(t);r.pendingReady=!0;let i=this.instances[t]?.[n];i&&(r.hidden||!r.shown||r.ready||(i.__pageReadyPending__=!0,i.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n)))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===W.type||e.__type__===U.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.getPageState(e),r=this.instances[e]?.[t];if(!r||!r.__pageReadyPending__||!n.shown||n.ready)return;let i=this.instances[e];if(!i){r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady();return}Object.values(i).filter(e=>e&&e.__type__===U.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!0,n.pendingShow=!1,!n.shown||(n.shown=!1,!this.instances[t]))return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===W.type?r.push(e):e.__type__===U.type&&(e.__isComponent__?e.__componentAttached__&&e.__pageShown__&&(e.__pageShown__=!1,e.pageHide()):r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e;if(!this.instances[t])return;let n=this.getInstancesInTreeOrder(t);this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===U.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===U.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),w.remove(t),delete this.instances[t],this.pageStates.delete(t)}getInstancesInTreeOrder(e,{postOrder:t=!1}={}){let n=Object.values(this.instances[e]||{}).filter(Boolean),r=new Map(n.map(e=>[e.__id__,e])),i=new Map,a=[];for(let e of n)if(e.__parentId__&&r.has(e.__parentId__)){let t=i.get(e.__parentId__)||[];t.push(e),i.set(e.__parentId__,t)}else a.push(e);let o=[],s=new Set,c=e=>{if(!(!e||s.has(e))){s.add(e),t||o.push(e);for(let t of i.get(e.__id__)||[])c(t);t&&o.push(e)}};return a.forEach(c),n.forEach(c),o}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t]?.[n];i&&i.pageScrollTop({scrollTop:r})}pagePullDownRefresh({bridgeId:e}){this.getPageInstance(e)?.pagePullDownRefresh()}pageReachBottom({bridgeId:e}){this.getPageInstance(e)?.pageReachBottom()}pageShareAppMessage({bridgeId:e,...t}){return this.getPageInstance(e)?.pageShareAppMessage(t)}pageTabItemTap({bridgeId:e,...t}){this.getPageInstance(e)?.pageTabItemTap(t)}pageResize(e){let{bridgeId:t,size:n}=e;if(!this.instances[t])return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===W.type?r.push(e):e.__type__===U.type&&(e.__isComponent__?e.__componentAttached__&&e.pageResize(n):r.push(e)))}),r.forEach(e=>e.pageResize(n))}componentError(e){let{bridgeId:t,moduleId:n,error:r}=e,i=this.instances[t]?.[n];i&&i.__type__===U.type&&i.componentError(r)}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===U.type&&(!e.__isComponent__||e.__componentAttached__)&&e.componentRouteDone()})}async triggerEvent(e){let{bridgeId:t,moduleId:n,methodName:r,event:i}=e;if(r===void 0)return;let a=this.instances[t];if(!a){console.warn(`[service] No instances found for bridgeId: ${t}`);return}let o=a[n];if(!o){console.warn(`[service] triggerEvent ${t} ${n} ${r}, instance is not exist`);return}return o.__type__===U.type&&o.__isComponent__&&!o.__componentReadied__?this.queuePendingEvent(o,{instance:o,bridgeId:t,moduleId:n,methodName:r,event:i}):this.dispatchEvent({instance:o,bridgeId:t,moduleId:n,methodName:r,event:i})}},xa=t({getEnterOptionsSync:()=>Ca,getLaunchOptionsSync:()=>Sa});function Sa(){return K.app?.options}function Ca(){return K.app?.options}var wa=t({getLocation:()=>Ta,offLocationChange:()=>Aa,onLocationChange:()=>ka,openLocation:()=>Da,startLocationUpdate:()=>Ea,stopLocationUpdate:()=>Oa});function Ta(e){return T(`getLocation`,e)}function Ea(e){return T(`startLocationUpdate`,e)}function Da(e){return T(`openLocation`,e)}function Oa(e){return T(`stopLocationUpdate`,e)}function ka(e){e&&T(`onLocationChange`,{success:x.store(e,!0)})}function Aa(e){if(e){let t=x.store(e,!0);T(`offLocationChange`,{success:t}),x.remove(t)}else T(`offLocationChange`),x.remove()}var ja=t({createMapContext:()=>Ma});function Ma(e,t){return new Na({mapId:e,obj:t})}var Na=class{constructor(e){this.opts=e}addMarkers(e){return this.invoke(`addMarkers`,e)}removeMarkers(e){return this.invoke(`removeMarkers`,e)}includePoints(e){return this.invoke(`includePoints`,e)}setCenterOffset(e){return this.invoke(`setCenterOffset`,e)}getCenterLocation(e){return this.invoke(`getCenterLocation`,e)}getScale(e){return this.invoke(`getScale`,e)}moveToLocation(e){return this.invoke(`moveToLocation`,e)}translateMarker(e){return this.invoke(`translateMarker`,e)}addArc(e){return this.invoke(`addArc`,e)}removeArc(e){return this.invoke(`removeArc`,e)}invoke(e,t={}){return T(e,{mapId:this.opts.mapId,...t})}},Pa=t({createInnerAudioContext:()=>La}),Fa=1,Ia=class{constructor(){this._audioId=Fa++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},T(`audioCreate`,{audioId:this._audioId}),T(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,T(`audioSetProp`,{audioId:this._audioId,prop:`src`,value:e,startTime:this._startTime,loop:this._loop,volume:this._volume,playbackRate:this._playbackRate,autoplay:this._autoplay})}get startTime(){return this._startTime}set startTime(e){this._startTime=Number(e)||0,T(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`loop`,value:this._loop})}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),T(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,T(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,T(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,T(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,T(`audioStop`,{audioId:this._audioId})}seek(e){T(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){T(`audioDestroy`,{audioId:this._audioId}),this._listeners={}}_on(e,t){typeof t==`function`&&(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t))}_off(e,t){this._listeners[e]&&(t?this._listeners[e]=this._listeners[e].filter(e=>e!==t):this._listeners[e]=[])}onPlay(e){this._on(`play`,e)}onPause(e){this._on(`pause`,e)}onStop(e){this._on(`stop`,e)}onEnded(e){this._on(`ended`,e)}onError(e){this._on(`error`,e)}onTimeUpdate(e){this._on(`timeUpdate`,e)}onWaiting(e){this._on(`waiting`,e)}onSeeking(e){this._on(`seeking`,e)}onSeeked(e){this._on(`seeked`,e)}onCanplay(e){this._on(`canplay`,e)}offPlay(e){this._off(`play`,e)}offPause(e){this._off(`pause`,e)}offStop(e){this._off(`stop`,e)}offEnded(e){this._off(`ended`,e)}offError(e){this._off(`error`,e)}offTimeUpdate(e){this._off(`timeUpdate`,e)}offWaiting(e){this._off(`waiting`,e)}offSeeking(e){this._off(`seeking`,e)}offSeeked(e){this._off(`seeked`,e)}offCanplay(e){this._off(`canplay`,e)}};function La(){return new Ia}var Ra=t({chooseImage:()=>Ha,compressImage:()=>Va,previewImage:()=>Ba,saveImageToPhotosAlbum:()=>za});function za(e){return T(`saveImageToPhotosAlbum`,e)}function Ba(e){return T(`previewImage`,e)}function Va(e){return T(`compressImage`,e)}function Ha(e){return T(`chooseImage`,e)}var Ua=t({chooseMedia:()=>Ka,chooseVideo:()=>Ga,createVideoContext:()=>Wa});function Wa(e,t){return new qa({videoId:e,obj:t})}function Ga(e){return T(`chooseVideo`,e)}function Ka(e){return T(`chooseMedia`,e)}var qa=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){T(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Ja=t({exitMiniProgram:()=>Qa,navigateBackMiniProgram:()=>Za,navigateToMiniProgram:()=>Xa,restartMiniProgram:()=>Ya});function Ya(e){return T(`restartMiniProgram`,e)}function Xa(e){return T(`navigateToMiniProgram`,e)}function Za(e){return T(`navigateBackMiniProgram`,e)}function Qa(e){return T(`exitMiniProgram`,e)}var $a=t({downloadFile:()=>eo});function eo(e){return T(`downloadFile`,e)}var to=`__diminaArrayBufferBase64`,q=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,no=Object.fromEntries([...q].map((e,t)=>[e,t]));function ro(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function io(e){if(ro(e))return e;if(ArrayBuffer.isView(e)){let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Uint8Array(t.length);return n.set(t),n.buffer}return null}function ao(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=q[t[r]>>2],n+=q[(t[r]&3)<<4|t[r+1]>>4],n+=q[(t[r+1]&15)<<2|t[r+2]>>6],n+=q[t[r+2]&63];return r<t.length&&(n+=q[t[r]>>2],r+1<t.length?(n+=q[(t[r]&3)<<4|t[r+1]>>4],n+=`${q[(t[r+1]&15)<<2]}=`):n+=`${q[(t[r]&3)<<4]}==`),n}function oo(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=no[t[e]],o=no[t[e+1]],s=t[e+2]===`=`?0:no[t[e+2]],c=t[e+3]===`=`?0:no[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function so(e){let t=io(e);return t?{[to]:ao(t)}:e}function co(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:oo(t[to])}}function lo(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function J(e,t,n={}){return T(e,{socketId:t,...n,keep:!0})}function Y(e,t,n={},r=e=>e){let i=new Set,a,o;function s(){if(!a)return;let e=a;a=void 0,x.remove(e),T(t,{...n,callbackId:e,keep:!0})}return{on(t){if(!(typeof t!=`function`||i.has(t))&&(i.add(t),!a))return a=x.store(e=>{let t=r(e);for(let e of[...i])e(t);o?.()},!0),T(e,{...n,callbackId:a,success:a,keep:!0})},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return s()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return s();a&&x.remove(a),a=void 0},hasListeners(){return i.size>0},setAfterEmit(e){o=e}}}var uo=t({offLocalServiceDiscoveryStop:()=>yo,offLocalServiceFound:()=>xo,offLocalServiceLost:()=>Co,offLocalServiceResolveFail:()=>To,onLocalServiceDiscoveryStop:()=>vo,onLocalServiceFound:()=>bo,onLocalServiceLost:()=>So,onLocalServiceResolveFail:()=>wo,startLocalServiceDiscovery:()=>go,stopLocalServiceDiscovery:()=>_o}),fo=Y(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),po=Y(`onLocalServiceFound`,`offLocalServiceFound`),mo=Y(`onLocalServiceLost`,`offLocalServiceLost`),ho=Y(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function go(e={}){return T(`startLocalServiceDiscovery`,e)}function _o(e={}){return T(`stopLocalServiceDiscovery`,e)}function vo(e){return fo.on(e)}function yo(e){return fo.off(e)}function bo(e){return po.on(e)}function xo(e){return po.off(e)}function So(e){return mo.on(e)}function Co(e){return mo.off(e)}function wo(e){return ho.on(e)}function To(e){return ho.off(e)}var Eo=t({request:()=>Do});function Do(e){return T(`request`,e)}var Oo=t({createTCPSocket:()=>Ao}),ko=class{constructor(e){this.socketId=e,this.events={bindWifi:Y(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:Y(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:Y(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:Y(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:Y(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},co)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return J(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=J(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return J(`TCPSocket.connect`,this.socketId,e)}write(e){return J(`TCPSocket.write`,this.socketId,{data:so(e)})}onBindWifi(e){return this.events.bindWifi.on(e)}offBindWifi(e){return this.events.bindWifi.off(e)}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onConnect(e){return this.events.connect.on(e)}offConnect(e){return this.events.connect.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}};function Ao(){return new ko(lo(`tcp`))}var jo=t({createUDPSocket:()=>No}),Mo=class{constructor(e){this.socketId=e,this.events={close:Y(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:Y(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:Y(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:Y(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},co)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return J(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=J(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return J(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return J(`UDPSocket.setTTL`,this.socketId,{ttl:e})}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onListening(e){return this.events.listening.on(e)}offListening(e){return this.events.listening.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}sendWithName(e,t){return J(e,this.socketId,{...t,message:so(t.message)})}};function No(){return new Mo(lo(`udp`))}var Po=t({uploadFile:()=>Ro}),Fo=1;function Io(){return`upload_${Date.now()}_${Fo++}`}function Lo(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function Ro(e={}){let t=Io(),n=Lo(),r=Lo(),i=x.store(e=>n.dispatch(e),!0,`${t}_progress`),a=x.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,x.remove(i),x.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{T(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||T(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var zo=t({closeSocket:()=>ws,connectSocket:()=>Ss,onSocketClose:()=>Ms,onSocketError:()=>js,onSocketMessage:()=>As,onSocketOpen:()=>ks,sendSocketMessage:()=>Cs}),Bo=0,Vo=1,Ho=3,Uo=5,Wo=/^wss:\/\/.*/i,Go={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Ko={...Go,open:[`header`]};function qo(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:ao(e),isBuffer:!0}:{data:e}}function Jo(e,t){let n=qo(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function Yo(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n];t[n]=typeof r==`string`?r:typeof r==`number`?String(r):Object.prototype.toString.apply(r)}return t}function X(e,t){let n={};if(!e||typeof e!=`object`)return n;for(let r of t)r in e&&(n[r]=e[r]);return n}function Xo(e){let t=X(e,Go.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=oo(e.data)),t}function Zo(e){return Number.isFinite(e)?e:1e3}function Qo(e){return Number.isFinite(e)&&e>=1?e:0}function $o(e){return Object.prototype.toString.call(e).slice(8,-1)}function es(e){return!!e&&typeof e==`object`}function ts(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function Z(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function ns(e){return X(e,[`errMsg`])}function rs(){let e;function t(t){return e=ns(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function is(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var as=new Set,Q,os={open:void 0,message:void 0,error:void 0,close:void 0},ss=[],cs=!1;function ls(){cs=!1;let e=ss.splice(0,ss.length);for(let t of e)t()}function us(e,{defer:t=!1}={}){if(!t&&ss.length===0){e();return}ss.push(e),!cs&&(cs=!0,setTimeout(ls,0))}function ds(e,t,r){let i=os[t];if(!e||!n(i))return;let a=t===`message`?r:X(r,Ko[t]);N(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function fs(e,t,r,i){let a=new Set,o,s=!1;function c(e){if(!o)return;let n=o;e&&T(t,{...r,callback:n,keep:!0}),o=void 0,x.remove(n)}return{add(e){return!n(e)||a.has(e)?!1:(a.add(e),!0)},remove(e){a.delete(e)},activate(){if(o||s)return;let t=x.store(e=>i(e,[...a]),!0);o=t;try{T(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,x.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var ps=new WeakMap,ms=Symbol(`SocketTask constructor token`);function $(e){let t=ps.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function hs(e){if(as.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function gs(e){e.connectionState=Ho,e.terminalEvent=!0}function _s(e){gs(e),hs(e)}function vs(e){if(e.activated||e.terminal)return;e.activated=!0;let t=[];try{for(let n of Object.values(e.events)){if(e.terminal)break;n.activate(),t.push(n)}}catch(n){e.activated=!1;for(let e of t.reverse())try{e.rollback()}catch{}throw n}}function ys(e,t,n){let r=$(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||vs(r)}catch(e){throw i.remove(n),e}}function bs(e,t,n){N(void 0,t,[n],`SocketTask.${e}`,!1)}var xs=class{constructor(e,t){if(e!==ms)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Bo,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:fs(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=Vo,r.opened=!0;let i=n===Q;us(()=>{bs(`onOpen`,t,X(e,Go.open)),ds(i,`open`,e)})}),message:fs(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===Q,i=Xo(e);us(()=>{bs(`onMessage`,t,i),ds(r,`message`,i)})}),error:fs(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===Q;r.opened?gs(r):_s(r),us(()=>{bs(`onError`,t,X(e,Go.error)),ds(i,`error`,e)},{defer:!0})}),close:fs(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===Q;_s(r),us(()=>{bs(`onClose`,t,X(e,Go.close)),ds(i,`close`,e)})})},ps.set(this,r)}send(e={}){let t=$(this),n=es(e)?e:{};if(t.connectionState!==Vo){Z(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Jo({socketId:t.socketId},n.data);is(r,n,rs()),Be(`sendSocketMessage`,r)}close(e={}){let t=$(this),n=es(e)?e:{},r={socketId:t.socketId,code:Zo(n.code)};n.reason!==void 0&&(r.reason=n.reason),is(r,n,rs()),Be(`closeSocket`,r)}onOpen(e){ys(this,`open`,e)}onMessage(e){ys(this,`message`,e)}onError(e){ys(this,`error`,e)}onClose(e){ys(this,`close`,e)}};function Ss(e){if(!es(e))return;let{url:t}=e;if(typeof t!=`string`){Z(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${$o(t)};`});return}if(!Wo.test(t)){Z(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new xs(ms,r),a=$(i),o=Q;if((!Q||$(Q).connectionState===Ho)&&(Q=i),as.size>=Uo)return a.connectionState=Ho,hs(a),Z(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${Uo}`}),i;as.add(i);let s=rs(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Qo(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?Yo(a):{});for(let t of[`protocols`,`tcpNoDelay`,`perMessageDeflate`,`forceCellularNetwork`]){let n=e[t];n!==void 0&&(c[t]=n)}let o=e.success;l=e.fail;let u=e.complete;n(o)&&(c.success=s.wrap(`success`,o)),n(u)&&(c.complete=s.wrap(`complete`,u))}catch(e){throw _s(a),Q===i&&(Q=o),e}c.fail=e=>{_s(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{T(`connectSocket`,c),u=!0,vs(a)}catch(t){if(u)try{Be(`closeSocket`,{socketId:r,code:1e3})}catch{}_s(a),Q===i&&(Q=o),Z(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function Cs(e){let t=es(e)?e:{},n=ts(t);return!Q||$(Q).connectionState!==Vo?Ds(`sendSocketMessage:fail WebSocket is not connected`,t,n):Es(`sendSocketMessage`,Jo({socketId:$(Q).socketId},t.data),t,n)}function ws(e){let t=es(e)?e:{},n=ts(t),r;if(Q&&$(Q).connectionState===Vo){let e=$(Q),i=Ts(e);try{let a=Zo(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=Es(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=Ds(`closeSocket:fail WebSocket is not connected`,t,n);return r}function Ts(e){let t=e.connectionState;return e.connectionState=Ho,()=>{e.terminalEvent||(e.connectionState=t)}}function Es(e,t,r,i,a){if(!i)return T(e,t).then(e=>ns(e),e=>{throw a?.(e),ns(e)});let o=rs();for(let e of[`success`,`complete`])Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=n(r[e])?o.wrap(e,r[e]):void 0);let s=n(r.fail)?r.fail:void 0;a||s?t.fail=e=>{a?.(e);let t=o.settle(e);s?.(t)}:Object.prototype.hasOwnProperty.call(r,`fail`)&&(t.fail=void 0);try{T(e,t)}catch(e){throw a?.(e),e}}function Ds(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));Z(t,r)}function Os(e,t){n(t)&&(os[e]=t)}function ks(e){Os(`open`,e)}function As(e){Os(`message`,e)}function js(e){Os(`error`,e)}function Ms(e){Os(`close`,e)}var Ns=t({getAccountInfoSync:()=>Ps});function Ps(){return T(`getAccountInfoSync`)}var Fs=t({authorize:()=>Is});function Is(e){return T(`authorize`,e)}var Ls=t({login:()=>Rs});function Rs(e){return T(`login`,e)}var zs=t({login:()=>Bs});function Bs(e){return T(`login`,e)}var Vs=t({getPrivacySetting:()=>Hs});function Hs(e){return T(`getPrivacySetting`,e)}var Us=t({getSetting:()=>Gs,openSetting:()=>Ws});function Ws(e){return T(`openSetting`,e)}function Gs(e){return T(`getSetting`,e)}var Ks=t({getUserInfo:()=>qs});function qs(e){return T(`getUserInfo`,e)}var Js=t({requestPayment:()=>Ys});function Ys(e){return T(`requestPayment`,e)}var Xs=t({hideShareMenu:()=>$s,showShareImageMenu:()=>Qs,showShareMenu:()=>Zs});function Zs(e){return T(`shareShareMenu`,e)}function Qs(e){return T(`showShareImageMenu`,e)}function $s(e){return T(`hideShareMenu`,e)}var ec=t({clearStorage:()=>cc,clearStorageSync:()=>ic,getStorage:()=>oc,getStorageInfo:()=>uc,getStorageInfoSync:()=>lc,getStorageSync:()=>nc,removeStorage:()=>sc,removeStorageSync:()=>rc,setStorage:()=>ac,setStorageSync:()=>tc});function tc(...e){return T(`setStorageSync`,e)}function nc(e){return T(`getStorageSync`,e)}function rc(e){return T(`removeStorageSync`,e)}function ic(){return T(`clearStorageSync`)}function ac(e){return T(`setStorage`,e)}function oc(e){return T(`getStorage`,e)}function sc(e){return T(`removeStorage`,e)}function cc(){return T(`clearStorage`)}function lc(){return T(`getStorageInfoSync`)}function uc(e){return T(`getStorageInfo`,e)}var dc=t({createAnimation:()=>fc});function fc(e={}){return new pc(e)}var pc=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,v(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,v(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,v(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,v(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,v(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,v(e)]}),this}},mc=t({setBackgroundColor:()=>gc,setBackgroundTextStyle:()=>hc});function hc(e){return T(`setBackgroundTextStyle`,e)}function gc(e){return T(`setBackgroundColor`,e)}var _c=t({canvasToTempFilePath:()=>xc,createCanvasContext:()=>yc,createContext:()=>vc,createOffscreenCanvas:()=>Di,drawCanvas:()=>bc});function vc(){return new Cc}function yc(e,t){return new Cc(e,Sc(t))}function bc(e={}){let t={...e,moduleId:e.moduleId||Sc(e.component)};delete t.component,T(`drawCanvas`,t,`render`)}function xc(e={},t){let n={...e,moduleId:e.moduleId||Sc(t||e.component)};return delete n.component,T(`canvasToTempFilePath`,n,`render`)}function Sc(e){return e?.__id__||w.getPageInfo()?.id}var Cc=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(bc({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},wc=t({nextTick:()=>Oc}),Tc=[],Ec=null;function Dc(){let e=Tc;Tc=[],Ec=null;for(let t=0;t<e.length;t++)e[t]()}function Oc(e){n(e)&&(Tc.push(e),Ec||=setTimeout(Dc,0))}var kc=t({disableAlertBeforeUnload:()=>Lc,enableAlertBeforeUnload:()=>Ic,hideLoading:()=>Fc,hideToast:()=>jc,showActionSheet:()=>Pc,showLoading:()=>Nc,showModal:()=>Mc,showToast:()=>Ac});function Ac(e){return T(`showToast`,e)}function jc(e){return T(`hideToast`,e)}function Mc(e){return T(`showModal`,e)}function Nc(e){return T(`showLoading`,e)}function Pc(e){return T(`showActionSheet`,e)}function Fc(e){return T(`hideLoading`,e)}function Ic(e){return T(`enableAlertBeforeUnload`,e)}function Lc(e){return T(`disableAlertBeforeUnload`,e)}var Rc=t({getMenuButtonBoundingClientRect:()=>Bc,offMenuButtonBoundingClientRectWeightChange:()=>Hc,onMenuButtonBoundingClientRectWeightChange:()=>Vc}),zc=new Set;S.onUpdate(e=>{e.menuRect&&zc.forEach(t=>t(e.menuRect))});function Bc(){return T(`getMenuButtonBoundingClientRect`)}function Vc(e){n(e)&&zc.add(e)}function Hc(e){n(e)?zc.delete(e):zc.clear()}var Uc=t({hideHomeButton:()=>Jc,hideNavigationBarLoading:()=>qc,setNavigationBarColor:()=>Kc,setNavigationBarTitle:()=>Gc,showNavigationBarLoading:()=>Wc});function Wc(e){return T(`showNavigationBarLoading`,e)}function Gc(e){return T(`setNavigationBarTitle`,e)}function Kc(e){return T(`setNavigationBarColor`,e)}function qc(e){return T(`hideNavigationBarLoading`,e)}function Jc(e){return T(`hideHomeButton`,e)}var Yc=t({startPullDownRefresh:()=>Zc,stopPullDownRefresh:()=>Xc});function Xc(e){return T(`stopPullDownRefresh`,e)}function Zc(e){return T(`startPullDownRefresh`,e)}var Qc=t({pageScrollTo:()=>$c});function $c(e){return T(`pageScrollTo`,e)}var el=t({hideTabBar:()=>il,hideTabBarRedDot:()=>cl,removeTabBarBadge:()=>ol,setTabBarBadge:()=>al,setTabBarItem:()=>nl,setTabBarStyle:()=>tl,showTabBar:()=>rl,showTabBarRedDot:()=>sl});function tl(e){return T(`setTabBarStyle`,e)}function nl(e){return T(`setTabBarItem`,e)}function rl(e){return T(`showTabBar`,e)}function il(e){return T(`hideTabBar`,e)}function al(e){return T(`setTabBarBadge`,e)}function ol(e){return T(`removeTabBarBadge`,e)}function sl(e){return T(`showTabBarRedDot`,e)}function cl(e){return T(`hideTabBarRedDot`,e)}var ll=t({onWindowResize:()=>ul});function ul(e){e&&T(`onWindowResize`,{success:e})}var dl=Object.assign({"./core/base/app-event/index.js":qe,"./core/base/index.js":Rt,"./core/base/performance/index.js":Ut,"./core/base/subpackage/index.js":Jt,"./core/base/system/index.js":Zt,"./core/base/update/index.js":un,"./core/camera/index.js":vn,"./core/data-analysis/index.js":xn,"./core/device/bluetooth/index.js":Ln,"./core/device/bluetooth-ble/index.js":$n,"./core/device/clipboard/index.js":yr,"./core/device/contact/index.js":Sr,"./core/device/keyboard/index.js":Tr,"./core/device/memory/index.js":Dr,"./core/device/network/index.js":Ar,"./core/device/phone/index.js":Mr,"./core/device/scan/index.js":Pr,"./core/device/screen/index.js":Ir,"./core/device/vibrate/index.js":Br,"./core/ext/index.js":Ur,"./core/file/index.js":Dt,"./core/life-cycle/index.js":xa,"./core/location/index.js":wa,"./core/map/index.js":ja,"./core/media/audio/index.js":Pa,"./core/media/image/index.js":Ra,"./core/media/video/index.js":Ua,"./core/navigate/index.js":Ja,"./core/network/download/index.js":$a,"./core/network/mdns/index.js":uo,"./core/network/request/index.js":Eo,"./core/network/tcp/index.js":Oo,"./core/network/udp/index.js":jo,"./core/network/upload/index.js":Po,"./core/network/websocket/index.js":zo,"./core/open-api/account-info/index.js":Ns,"./core/open-api/authorize/index.js":Fs,"./core/open-api/index.js":Ls,"./core/open-api/login/index.js":zs,"./core/open-api/privacy/index.js":Vs,"./core/open-api/setting/index.js":Us,"./core/open-api/user-info/index.js":Ks,"./core/payment/index.js":Js,"./core/route/index.js":Ve,"./core/share/index.js":Xs,"./core/storage/index.js":ec,"./core/ui/animation/index.js":dc,"./core/ui/background/index.js":mc,"./core/ui/canvas/index.js":_c,"./core/ui/custom-component/index.js":wc,"./core/ui/interaction/index.js":kc,"./core/ui/menu/index.js":Rc,"./core/ui/navigation-bar/index.js":Uc,"./core/ui/pull-down-refresh/index.js":Yc,"./core/ui/scroll/index.js":Qc,"./core/ui/tab-bar/index.js":el,"./core/ui/window/index.js":ll,"./core/wxml/intersection-observer/index.js":Fi,"./core/wxml/media-query-observer/index.js":Ri,"./core/wxml/selector-query/index.js":Oi}),fl={},pl=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`]);for(let e of Object.values(dl))for(let[t,n]of Object.entries(e))fl[t]=n;function ml(e){for(let t of e||[])typeof t!=`string`||pl.has(t)||Object.prototype.hasOwnProperty.call(fl,t)||t in Object.prototype||Object.defineProperty(fl,t,{value:(...e)=>T(t,...e),writable:!0,enumerable:!0,configurable:!0})}var hl=new Proxy(fl,{get(e,t,n){return pl.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),gl=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}ml(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=hl;globalThis.modRequire=b,globalThis.modDefine=ae,globalThis.global={},globalThis.App=(e={})=>{G.createAppModule(e),K.createApp()},globalThis.Page=e=>{G.createModule(e,globalThis.__extraInfo,W.type)},globalThis.Component=e=>{G.createModule(e,globalThis.__extraInfo,U.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>K.getApp(e),globalThis.getCurrentPages=()=>w.stack()}},_l={navigateBack:Ke,navigateTo:Ge,reLaunch:Ue,redirectTo:We,switchTab:He};return new class{constructor(){console.log(`[service] init`),this.env=gl,this.message=C,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,scene:l}=e;o&&S.init(o),K.setAppLaunchOptions({scene:l,pagePath:r,query:s}),G.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c})}),this.message.on(`hostEnvUpdate`,e=>{S.update(e)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await K.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;x.invoke(t,n)}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=x.store(e=>s(r.success,e))),r.fail&&(o=x.store(e=>s(r.fail,e)));let c=x.store(e=>{s(r.complete,e),x.remove(a),x.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e,a=G.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=G.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=K.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});C.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,()=>{K.appShow()}),this.message.on(`appHide`,()=>{K.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{K.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{K.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{K.createInstance(e)}),this.message.on(`mA`,e=>{K.moduleAttached(e)}),this.message.on(`mR`,e=>{K.moduleReady(e)}),this.message.on(`mU`,e=>{K.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{K.pageUnload(e)}),this.message.on(`pageShow`,e=>{K.pageShow(e)}),this.message.on(`pageReady`,e=>{K.pageReady(e)}),this.message.on(`pageHide`,e=>{K.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{K.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{K.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=K.pageShareAppMessage(e);e?.success&&this.message.send({type:`triggerCallback`,target:`container`,body:{bridgeId:e.bridgeId,id:e.success,args:[t],data:t}})}),this.message.on(`pageScroll`,e=>{K.pageScroll(e)}),this.message.on(`pageResize`,e=>{K.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{K.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;K.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{K.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await K.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}_l[t]?.({url:n,...e.params})})}}})();
|