@dimina-kit/devtools 0.4.0-dev.20260907055341 → 0.5.0-dev.20260908120530
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/README.md +1 -1
- package/dist/main/app/window-runtime-services.d.ts +12 -12
- package/dist/main/app/window-runtime-services.js +34 -15
- package/dist/main/index.bundle.js +6307 -6050
- package/dist/main/services/elements-forward/index.d.ts +2 -2
- package/dist/main/services/elements-forward/index.js +6 -6
- package/dist/main/services/network-forward/body-cache.d.ts +2 -0
- package/dist/main/services/network-forward/body-cache.js +4 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +1 -1
- package/dist/main/services/network-forward/global-body-gate.js +4 -4
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +19 -13
- package/dist/main/services/network-forward/index.js +220 -134
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/safe-area/index.d.ts +7 -9
- package/dist/main/services/safe-area/index.js +7 -14
- package/dist/main/services/views/native-simulator-view.js +7 -8
- package/dist/main/services/workbench-context.d.ts +3 -3
- package/dist/main/services/workbench-context.js +7 -1
- package/dist/native-host/render/render.js +525 -482
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/main.cjs +15 -1
- package/dist/preload/windows/main.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs +55 -134
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +55 -134
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/entries/workbench/index.html +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +2 -2
- package/package.json +12 -12
- package/dist/renderer/assets/workbench-BLJ0wKsg.js +0 -5
- package/dist/shared/request-core.d.ts +0 -2
- package/dist/shared/request-core.js +0 -2
- package/dist/simulator/assets/device-shell-pxnZZp10.js +0 -431
- package/dist/simulator/assets/simulator-Dwp7lnvu.js +0 -10
- package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>a(e[n],t[n]))}function o(e){return e===`__proto__`}function s(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function c(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function l(e){if(Array.isArray(e))return e.map(c);if(typeof e==`symbol`)return[e];e=u(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function u(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(u).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function d(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||o(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function f(e,t){if(e!=null)switch(typeof t){case`string`:{if(o(t))return;let n=e[t];return n===void 0?s(t)?f(e,l(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=c(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return d(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),o(t))return;let n=e[t];return n===void 0?void 0:n}}}function p(){return Math.random().toString(36).slice(2,7)}function m(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function h(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var
|
|
1
|
+
var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>a(e[n],t[n]))}function o(e){return e===`__proto__`}function s(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function c(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function l(e){if(Array.isArray(e))return e.map(c);if(typeof e==`symbol`)return[e];e=u(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function u(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(u).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function d(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||o(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function f(e,t){if(e!=null)switch(typeof t){case`string`:{if(o(t))return;let n=e[t];return n===void 0?s(t)?f(e,l(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=c(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return d(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),o(t))return;let n=e[t];return n===void 0?void 0:n}}}function p(){return Math.random().toString(36).slice(2,7)}function m(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function h(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var g=typeof window<`u`&&typeof navigator<`u`;g&&/Android/i.test(navigator.userAgent),g&&/iPad|iPhone|iPod/.test(navigator.userAgent),g&&/OpenHarmony|harmony/.test(navigator.userAgent),g&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var _=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function ee(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function te(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=ee(n,i);return a&&(o+=`?${a}`),o}function ne(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function re(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var ie={},ae=1,oe=2;function se(e,t){ie[e]||(ie[e]={factory:t,status:ae,exports:void 0})}function ce(e){return Object.prototype.hasOwnProperty.call(ie,e)}function v(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ie[e];if(!i)throw Error(`module ${e} not found`);if(i.status===ae){i.status=oe;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,v,t,t.exports))}catch(t){i.status=ae;let a=`
|
|
2
2
|
name: ${t.name}
|
|
3
3
|
msg: ${t.message}
|
|
4
4
|
stack:
|
|
5
5
|
${t.stack}
|
|
6
|
-
`;console.error(`require ${e} error: ${a}`),n(globalThis.__diminaReportError)&&globalThis.__diminaReportError(t),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}_.async=async e=>new Promise((t,n)=>{try{t(_(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var v=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.keep||delete this.callbacks[e],r.callback(t))}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]})}},ue=33554432;ue/4;var de=Math.floor(ue/4/4);function fe(e){let t=Number(e);if(!Number.isFinite(t))return null;let n=Math.abs(Math.trunc(t));return Number.isSafeInteger(n)?n:null}function pe(e,t,{allowZero:n=!1,transferable:r=!1}={}){let i=fe(e),a=fe(t);return i===null||a===null?`pixel dimensions must be finite non-zero safe integers`:i>4096||a>4096?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:i===0||a===0?n?null:`pixel dimensions must be finite non-zero safe integers`:i>Math.floor((r?de:8388608)/a)?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:null}function y(e,t){if(e===void 0)return t;let n=Number(e);if(!Number.isFinite(n)||n<0)return t;let r=Math.floor(n);if(!Number.isSafeInteger(r)||r>4096)throw RangeError(`canvas dimensions exceed the maximum canvas bitmap`);return r}var me=`__dimina_data_function_reference__`,he=1;function ge(e){return{[me]:e,version:he}}function _e(e){return typeof e==`object`&&!!e&&e.version===he&&typeof e[me]==`string`&&Object.keys(e).length===2}function ve(e){return _e(e)?e[me]:void 0}function ye(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(_e(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]=ye(e[a],{mapFunction:t,mapReference:n},r);return i}var be=new Set([String,Number,Boolean,Object,Array,null]);function xe(e){return be.has(e)}function Se(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function Ce(e){return Array.isArray(e)?e.filter(xe):[]}function we(e){let t,n=[],r;return xe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=Ce(e.optionalTypes),r=e.value),xe(t)||(t=n[0]??null),r===void 0&&(r=Se(t)),{type:t,optionalTypes:n,value:ie(r)}}function Te(e){return Array.isArray(e)}function Ee(e){return Te(e)&&e?.constructor?.name===Array.name}function De(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?Ee(t):t!==void 0}function Oe(e,t){typeof e==`function`&&e(t)}function ke(e,t,{absent:n=!1,warn:r}={}){if(n)return ie(e.value);for(let n of e.optionalTypes||[])if(De(n,t))return t;let i=e.type;if(i===String)return t==null?(Oe(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&Oe(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 Oe(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?Te(t)?t:(Oe(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(Oe(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var b=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 Ae(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 je={error:[],show:[],hide:[]},Me,Ne=!1,Pe=!1;function Fe(e,t){return`${t}${e===`error`?`Error`:e===`show`?`AppShow`:`AppHide`}`}function Ie(e,t){if(typeof t!=`function`){console.error(`${Fe(e,`on`)} should accept a function instead of ${typeof t}`);return}je[e].push(t)}function Le(e,t){if(!t){je[e]=[];return}if(typeof t!=`function`){console.error(`${Fe(e,`off`)} should accept a function instead of ${typeof t}`);return}je[e]=je[e].filter(e=>e!==t)}function Re(e,t,n){try{e(...t)}catch(e){Ne||x(e),console.error(`[service] ${n} error:`,e)}}function ze(e,t,n){for(let r of[...je[e]])Re(r,t,n)}function Be(e){Ie(`error`,e)}function Ve(e){Le(`error`,e)}function He(e){Ie(`show`,e)}function Ue(e){Le(`show`,e)}function We(e){Ie(`hide`,e)}function Ge(e){Le(`hide`,e)}function Ke(e){ze(`show`,[e],`wx.onAppShow`)}function qe(){ze(`hide`,[],`wx.onAppHide`)}function Je(e){Me=typeof e==`function`?e:void 0}function Ye(e){if(typeof e==`string`)return e;if(e?.stack)return String(e.stack);if(e?.message)return String(e.message);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function x(e){let t=Ye(e);if(Ne)return console.error(`[service] error handler error:`,e),t;Ne=!0;try{Me&&Re(Me,[t],`App.onError`),ze(`error`,[t],`wx.onError`)}finally{Ne=!1}return t}function Xe(){if(Pe)return;Pe=!0;let e=e=>{x(e?.error||e?.message||e)};if(typeof globalThis.addEventListener==`function`){globalThis.addEventListener(`error`,e);return}let t=globalThis.onerror;globalThis.onerror=function(n,r,i,a,o){return e(o||n),typeof t==`function`&&t.call(this,n,r,i,a,o)}}var Ze=new WeakMap,Qe=new Map;function $e(e){let t=Ze.get(e);if(t)return Qe.set(t,e),t;let n;do n=`data-function-${p()}`;while(Qe.has(n));return Ze.set(e,n),Qe.set(n,e),n}function et(e){return Qe.get(e)}function tt(e){return ye(e,{mapFunction(e){return ge($e(e))}})}function nt(e){return ye(e,{mapReference(e){return et(ve(e))||e}})}var S=new class e{constructor(){this.event=Ae(),this.init()}init(){g?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){try{let t=nt(e);console.log(`[service] receive msg: `,g?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}catch(e){x(e),console.error(`[service] message handler error:`,e)}}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return g?e.prototype.send=function(e){let t=tt(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=tt(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return g?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},C=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 rt(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var it={getWindowInfo:()=>rt(b.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>b.getSystemInfo(),getAppBaseInfo:()=>rt(b.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>rt(b.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>b.getMenuRect()},at=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),ot=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,exitMiniProgram,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,navigateBackMiniProgram,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function st(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function ct(e,t){return at.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||ot.has(e)}function lt(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:C.getPageInfo().id,params:t}};return n===`container`?S.invoke(r):S.send(r)}function ut(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{v.remove(a),v.remove(o)};a=v.store(e=>{s(),r(e)}),o=v.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{lt(e,t,n)}catch(e){s(),i(e)}})}function dt(e,t,r){let i,a,o,s=()=>{v.remove(i),v.remove(a)},c=()=>{v.remove(o),queueMicrotask(s)};return i=v.store(e=>{s(),n(t)&&t(e)}),a=v.store(e=>{s(),n(r)&&r(e)}),e.success=i,e.fail=a,{registerComplete(t,n,r){return o=v.store(e=>{c(),t(e)},n,r),e.complete=o,o}}}function ft(e){return i(e)||e===``}function pt({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||ft(e))&&(n(t)||ft(t))}function w(e,t,r=`container`,i=!0){let a=it[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&ct(e,t))return ut(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:v.store(t,!0)};else if(st(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;o=l,c!==void 0&&(o.evtId=c);let u;if(pt({success:e,fail:r,keep:a,evtId:c}))u=dt(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=v.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=v.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=u?u.registerComplete(i,a,c):v.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&&ct(e,t))return o={...a},ut(e,o,r);o=a}try{return lt(e,o,r)}catch(e){for(let e of s)v.remove(e);throw e}}function mt(e,t,n=`container`){return w(e,t,n,!1)}var ht=t({navigateBack:()=>bt,navigateTo:()=>yt,reLaunch:()=>_t,redirectTo:()=>vt,switchTab:()=>gt});function gt(e){return e.url=ne(C.getPageInfo().route,e.url),w(`switchTab`,e)}function _t(e){return e.url=ne(C.getPageInfo().route,e.url),w(`reLaunch`,e)}function vt(e){let t=ne(C.getPageInfo().route,e.url);if(C.getPageInfo().route!==t)return e.url=t,w(`redirectTo`,e)}function yt(e){return e.url=ne(C.getPageInfo().route,e.url),w(`navigateTo`,e)}function bt(e){return w(`navigateBack`,e)}var xt=t({offAppHide:()=>Dt,offAppShow:()=>Et,offError:()=>Ct,offHide:()=>jt,offShow:()=>kt,onAppHide:()=>Tt,onAppShow:()=>wt,onError:()=>St,onHide:()=>At,onShow:()=>Ot});function St(e){Be(e)}function Ct(e){Ve(e)}function wt(e){He(e)}function Tt(e){We(e)}function Et(e){Ue(e)}function Dt(e){Ge(e)}function Ot(e){He(e)}function kt(e){Ue(e)}function At(e){We(e)}function jt(e){Ge(e)}var Mt=`__diminaArrayBufferBase64`,Nt=`__diminaFileDataBase64`,Pt=`__diminaFileDataType`,T=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ft=(()=>{let e={};for(let t=0;t<64;t++)e[T[t]]=t;return e})();function It(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Lt(e){return e&&e.buffer&&It(e.buffer)}function Rt(e){return It(e)?e:Lt(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function zt(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=T[t[r]>>2],n+=T[(t[r]&3)<<4|t[r+1]>>4],n+=T[(t[r+1]&15)<<2|t[r+2]>>6],n+=T[t[r+2]&63];return r<t.length&&(n+=T[t[r]>>2],r+1<t.length?(n+=T[(t[r]&3)<<4|t[r+1]>>4],n+=T[(t[r+1]&15)<<2],n+=`=`):(n+=T[(t[r]&3)<<4],n+=`==`)),n}function Bt(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=Ft[t[e]],o=Ft[t[e+1]],s=t[e+2]===`=`?0:Ft[t[e+2]],c=t[e+3]===`=`?0:Ft[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 Vt(e){let t=Rt(e);return t?{[Pt]:`base64`,[Nt]:zt(t)}:e}function Ht(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=Vt(n[e]));return n}function Ut(e){return e&&typeof e==`object`&&e[Mt]!==void 0?Bt(e[Mt]):e}function Wt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:Ut(e.data)}:e}function Gt(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:Ut(r.data)}:r;return{...e,entries:t}}function Kt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[Mt]===void 0)return e;let r=new Uint8Array(Bt(e[Mt]));new Uint8Array(t).set(r,n);let{[Mt]:i,...a}=e;return{...a,arrayBuffer:t}}function qt(e){let t={...e},n=Rt(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var Jt=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 Xt(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if(Yt(e))return new Jt(e);if(Array.isArray(e))return e.map(e=>Xt(e));let t={};for(let[n,r]of Object.entries(e))t[n]=Xt(r);return t}function Zt(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:Xt(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:Xt(e.statsMap)}}return Xt(e)}function Qt(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 E(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=w(e,r(Qt(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function $t(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return E(e,t,{prepare:qt,transform:e=>Kt(e,n,r)})}var en=class{access(e){return E(`FileSystemManager.access`,e)}accessSync(e){return w(`FileSystemManager.accessSync`,e)}appendFile(e){return E(`FileSystemManager.appendFile`,e,{prepare:Ht})}appendFileSync(e,t,n){return w(`FileSystemManager.appendFileSync`,Ht({filePath:e,data:t,encoding:n}))}close(e){return E(`FileSystemManager.close`,e)}closeSync(e){return w(`FileSystemManager.closeSync`,e)}copyFile(e){return E(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return w(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return E(`FileSystemManager.fstat`,e,{transform:Zt})}fstatSync(e){return Zt(w(`FileSystemManager.fstatSync`,e))}ftruncate(e){return E(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return w(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return E(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return E(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return E(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return w(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return E(`FileSystemManager.open`,e)}openSync(e){return w(`FileSystemManager.openSync`,e)}read(e){return $t(`FileSystemManager.read`,e)}readSync(e){return Kt(w(`FileSystemManager.readSync`,qt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return E(`FileSystemManager.readCompressedFile`,e,{transform:Wt})}readCompressedFileSync(e){return Ut(w(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return E(`FileSystemManager.readdir`,e)}readdirSync(e){return w(`FileSystemManager.readdirSync`,e)}readFile(e){return E(`FileSystemManager.readFile`,e,{transform:Wt})}readFileSync(e,t,n,r){return Ut(w(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return E(`FileSystemManager.readZipEntry`,e,{transform:Gt})}removeSavedFile(e){return E(`FileSystemManager.removeSavedFile`,e)}rename(e){return E(`FileSystemManager.rename`,e)}renameSync(e,t){return w(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return E(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return w(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return E(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return w(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return E(`FileSystemManager.stat`,e,{transform:Zt})}statSync(e,t){return Zt(w(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return E(`FileSystemManager.truncate`,e)}truncateSync(e,t){return w(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return E(`FileSystemManager.unlink`,e)}unlinkSync(e){return w(`FileSystemManager.unlinkSync`,e)}unzip(e){return E(`FileSystemManager.unzip`,e)}write(e){return E(`FileSystemManager.write`,e,{prepare:e=>Ht(e,[`arrayBuffer`,`data`])})}writeSync(e){return w(`FileSystemManager.writeSync`,Ht(e,[`arrayBuffer`,`data`]))}writeFile(e){return E(`FileSystemManager.writeFile`,e,{prepare:Ht})}writeFileSync(e,t,n){return w(`FileSystemManager.writeFileSync`,Ht({filePath:e,data:t,encoding:n}))}};Object.getOwnPropertyNames(en.prototype).filter(e=>e!==`constructor`);var tn=null;function nn(){return tn||=new en,tn}var rn=t({USER_DATA_PATH:()=>an,fileSystemManagerAPINames:()=>on,getFileSystemManager:()=>pn}),an=`difile://usr`,on=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],sn=`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`,cn=`not supported by the devtools simulator (no container backend)`;function ln(e){return function(){throw Error(`FileSystemManager.${e} ${sn}`)}}function un(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${cn}`}),t.complete?.()}}function dn(e){let t=Object.getPrototypeOf(e),n=new Set(on);for(let e of Object.getOwnPropertyNames(t))e===`constructor`||n.has(e)||(t[e]=e.endsWith(`Sync`)?ln(e):un(e));return e}var fn;function pn(){return fn||=dn(nn()),fn}var mn=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],hn=t({canIUse:()=>yn,env:()=>gn}),gn={USER_DATA_PATH:`difile://usr`},_n=new Set([`nextTick`,`onError`,`offError`,`onAppShow`,`onAppHide`,`offAppShow`,`offAppHide`,`onShow`,`offShow`,`onHide`,`offHide`,`createCanvas`,`createImage`,`onTouchStart`,`offTouchStart`,`onTouchMove`,`offTouchMove`,`onTouchEnd`,`offTouchEnd`,`onTouchCancel`,`offTouchCancel`,`getUpdateManager`,`UpdateManager`,...mn.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...on.map(e=>`FileSystemManager.${e}`)]),vn={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function yn(e){if(_n.has(e))return!0;try{return w(`canIUse`,Object.hasOwn(vn,e)?vn[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var bn=t({getPerformance:()=>xn});function xn(){return Sn.getInstance()}var Sn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Cn,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new wn(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}},Cn=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}},wn=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=v.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){w(`removePerformanceObserver`,{observerId:e.observerId},`render`),v.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),w(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new Cn;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&&w(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&v.remove(this.callbackId),this.observerId=null,this.callbackId=null}},Tn=t({loadSubpackage:()=>Dn,preDownloadSubpackage:()=>En});function En(e){return w(`preDownloadSubpackage`,e)}function Dn(e){return w(`loadSubpackage`,e)}var On=t({getAppBaseInfo:()=>In,getDeviceInfo:()=>Ln,getSystemInfo:()=>Nn,getSystemInfoAsync:()=>Fn,getSystemInfoSync:()=>Pn,getWindowInfo:()=>jn,offThemeChange:()=>zn,onThemeChange:()=>Rn,openAppAuthorizeSetting:()=>Mn,openSystemBluetoothSetting:()=>An}),kn=new Set;b.onUpdate(e=>{let t=e.systemInfo?.theme;t&&kn.forEach(e=>e({theme:t}))});function An(e){return w(`openSystemBluetoothSetting`,e)}function jn(e){return w(`getWindowInfo`,e)}function Mn(e){return w(`openAppAuthorizeSetting`,e)}function Nn(e){return new Promise(t=>{t(w(`getSystemInfo`,e))})}function Pn(){return w(`getSystemInfoSync`)}function Fn(e){return w(`getSystemInfoAsync`,e)}function In(){return w(`getAppBaseInfo`)}function Ln(){return w(`getDeviceInfo`)}function Rn(e){n(e)&&kn.add(e)}function zn(e){n(e)?kn.delete(e):kn.clear()}var Bn=t({getUpdateManager:()=>Kn}),Vn=`onUpdateStatusChange`,Hn=`updatefail`,Un=`updateready`,Wn=`noupdate`,Gn=`updating`;function Kn(){return qn.getInstance()}var qn=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=[],S.on(Vn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===Hn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Un){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===Gn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Wn){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,w(`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())}};qn.getInstance();var Jn=t({createCameraContext:()=>Yn});function Yn(){return new Xn}var Xn=class{takePhoto(e={}){return w(`takePhoto`,e)}startRecord(e={}){return w(`startRecordCamera`,e)}stopRecord(e={}){return w(`stopRecordCamera`,e)}},Zn=t({reportAnalytics:()=>Qn,reportEvent:()=>$n});function Qn(...e){return w(`reportAnalytics`,e)}function $n(e,t){return w(`reportAnalytics`,{eventId:e,data:t})}var er=`__diminaArrayBufferBase64`,D=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,tr=(()=>{let e={};for(let t=0;t<64;t++)e[D[t]]=t;return e})();function nr(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function rr(e){return nr(e)?e:e&&e.buffer&&nr(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function ir(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=D[t[r]>>2],n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=D[(t[r+1]&15)<<2|t[r+2]>>6],n+=D[t[r+2]&63];return r<t.length&&(n+=D[t[r]>>2],r+1<t.length?(n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=`${D[(t[r+1]&15)<<2]}=`):n+=`${D[(t[r]&3)<<4]}==`),n}function ar(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=tr[t[e]],o=tr[t[e+1]],s=t[e+2]===`=`?0:tr[t[e+2]],c=t[e+3]===`=`?0:tr[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 or(e){let t=rr(e);return t?{[er]:ir(t)}:e}function sr(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?ar(e[er]):e}function cr(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=sr(r);return{...e,advertisData:sr(e.advertisData),serviceData:t}}function lr(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(cr)}}function ur(e){return!e||typeof e!=`object`?e:{...e,value:sr(e.value)}}function dr(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 fr(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=w(e,n(dr(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function pr(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=v.store(e=>t(n(e)),!0);return r.set(t,i),w(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),v.remove(n),w(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())v.remove(e);return r.clear(),w(t)}}}var mr=t({closeBluetoothAdapter:()=>Dr,getBluetoothAdapterState:()=>Er,getBluetoothDevices:()=>Tr,getConnectedBluetoothDevices:()=>wr,isBluetoothDevicePaired:()=>Or,makeBluetoothPair:()=>kr,offBluetoothAdapterStateChange:()=>Cr,offBluetoothDeviceFound:()=>Sr,onBluetoothAdapterStateChange:()=>xr,onBluetoothDeviceFound:()=>br,openBluetoothAdapter:()=>yr,startBluetoothDevicesDiscovery:()=>vr,stopBluetoothDevicesDiscovery:()=>_r}),hr=pr(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,lr),gr=pr(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function _r(e){return w(`stopBluetoothDevicesDiscovery`,e)}function vr(e){return w(`startBluetoothDevicesDiscovery`,e)}function yr(e){return w(`openBluetoothAdapter`,e)}function br(e){return hr.on(e)}function xr(e){return gr.on(e)}function Sr(e){return hr.off(e)}function Cr(e){return gr.off(e)}function wr(e){return fr(`getConnectedBluetoothDevices`,e,{transform:lr})}function Tr(e){return fr(`getBluetoothDevices`,e,{transform:lr})}function Er(e){return w(`getBluetoothAdapterState`,e)}function Dr(e){return w(`closeBluetoothAdapter`,e)}function Or(e){return w(`isBluetoothDevicePaired`,e)}function kr(e){return w(`makeBluetoothPair`,e)}var Ar=t({closeBLEConnection:()=>Kr,createBLEConnection:()=>Gr,getBLEDeviceCharacteristics:()=>Wr,getBLEDeviceRSSI:()=>Ur,getBLEDeviceServices:()=>Hr,getBLEMTU:()=>qr,notifyBLECharacteristicValueChange:()=>Vr,offBLECharacteristicValueChange:()=>Br,offBLEConnectionStateChange:()=>zr,offBLEMTUChange:()=>Yr,onBLECharacteristicValueChange:()=>Rr,onBLEConnectionStateChange:()=>Lr,onBLEMTUChange:()=>Jr,readBLECharacteristicValue:()=>Ir,setBLEMTU:()=>Fr,writeBLECharacteristicValue:()=>Pr}),jr=pr(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Mr=pr(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,ur),Nr=pr(`onBLEMTUChange`,`offBLEMTUChange`);function Pr(e){return fr(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:or(e.value)}:e}})}function Fr(e){return w(`setBLEMTU`,e)}function Ir(e){return w(`readBLECharacteristicValue`,e)}function Lr(e){return jr.on(e)}function Rr(e){return Mr.on(e)}function zr(e){return jr.off(e)}function Br(e){return Mr.off(e)}function Vr(e){return w(`notifyBLECharacteristicValueChange`,e)}function Hr(e){return w(`getBLEDeviceServices`,e)}function Ur(e){return w(`getBLEDeviceRSSI`,e)}function Wr(e){return w(`getBLEDeviceCharacteristics`,e)}function Gr(e){return w(`createBLEConnection`,e)}function Kr(e){return w(`closeBLEConnection`,e)}function qr(e){return w(`getBLEMTU`,e)}function Jr(e){return Nr.on(e)}function Yr(e){return Nr.off(e)}var Xr=t({getClipboardData:()=>Qr,setClipboardData:()=>Zr});function Zr(e){return w(`setClipboardData`,e)}function Qr(e){return w(`getClipboardData`,e)}var $r=t({addPhoneContact:()=>ti,chooseContact:()=>ei});function ei(e){return w(`chooseContact`,e)}function ti(e){return w(`addPhoneContact`,e)}var ni=t({hideKeyboard:()=>ri});function ri(e){return w(`hideKeyboard`,e)}var ii=t({offMemoryWarning:()=>oi,onMemoryWarning:()=>ai});function ai(e){return w(`onMemoryWarning`,e)}function oi(e){return w(`offMemoryWarning`,e)}var si=`__diminaArrayBufferBase64`,O=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ci=Object.fromEntries([...O].map((e,t)=>[e,t]));function li(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function ui(e){if(li(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 di(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=O[t[r]>>2],n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=O[(t[r+1]&15)<<2|t[r+2]>>6],n+=O[t[r+2]&63];return r<t.length&&(n+=O[t[r]>>2],r+1<t.length?(n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=`${O[(t[r+1]&15)<<2]}=`):n+=`${O[(t[r]&3)<<4]}==`),n}function fi(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=ci[t[e]],o=ci[t[e+1]],s=t[e+2]===`=`?0:ci[t[e+2]],c=t[e+3]===`=`?0:ci[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 pi(e){let t=ui(e);return t?{[si]:di(t)}:e}function mi(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:fi(t[si])}}function hi(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function k(e,t,n={}){return w(e,{socketId:t,...n,keep:!0})}function A(e,t,n={},r=e=>e){let i=new Set,a,o,s;function c(){if(!a)return;let e=a;a=void 0,v.remove(e),o&&v.remove(o),o=void 0,w(t,{...n,callbackId:e,keep:!0})}return{on(t){if(typeof t!=`function`||(i.add(t),a))return;let c=v.store(e=>{o&&v.remove(o),o=void 0;let t=r(e);for(let e of[...i])e(t);s?.()},!0);a=c,o=v.store(()=>{a===c&&(v.remove(c),o&&v.remove(o),a=void 0,o=void 0)});try{return w(e,{...n,callbackId:c,success:c,fail:o,keep:!0})}catch(e){throw v.remove(c),o&&v.remove(o),a=void 0,o=void 0,e}},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return c()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return c();a&&v.remove(a),o&&v.remove(o),a=void 0,o=void 0},hasListeners(){return i.size>0},setAfterEmit(e){s=e}}}var gi=t({getNetworkType:()=>vi,offNetworkStatusChange:()=>bi,onNetworkStatusChange:()=>yi}),_i=A(`onNetworkStatusChange`,`offNetworkStatusChange`);function vi(e){return w(`getNetworkType`,e)}function yi(e){return _i.on(e)}function bi(e){return _i.off(e)}var xi=t({makePhoneCall:()=>Si});function Si(e){return w(`makePhoneCall`,e)}var Ci=t({scanCode:()=>wi});function wi(e){return w(`scanCode`,e)}var Ti=t({offUserCaptureScreen:()=>ki,onUserCaptureScreen:()=>Oi,setKeepScreenOn:()=>Ai}),Ei=pr(`onUserCaptureScreen`,`offUserCaptureScreen`),Di;function Oi(e){if(typeof e==`function`)return Di&&Di!==e&&Ei.off(Di),Di=e,Ei.on(e)}function ki(e){if(typeof e!=`function`||e===Di)return Di=void 0,Ei.off(e)}function Ai(e){return w(`setKeepScreenOn`,e)}var j={touchstart:[],touchmove:[],touchend:[],touchcancel:[]};function ji(e,t){j[e]&&typeof t==`function`&&j[e].push(t)}function Mi(e,t){if(j[e]){if(!t){j[e]=[];return}j[e]=j[e].filter(e=>e!==t)}}function Ni(e,t={}){if(j[e])for(let n of[...j[e]])try{n(t)}catch(e){x(e)}}var Pi=t({offTouchCancel:()=>Hi,offTouchEnd:()=>Bi,offTouchMove:()=>Ri,offTouchStart:()=>Ii,onTouchCancel:()=>Vi,onTouchEnd:()=>zi,onTouchMove:()=>Li,onTouchStart:()=>Fi});function Fi(e){ji(`touchstart`,e)}function Ii(e){Mi(`touchstart`,e)}function Li(e){ji(`touchmove`,e)}function Ri(e){Mi(`touchmove`,e)}function zi(e){ji(`touchend`,e)}function Bi(e){Mi(`touchend`,e)}function Vi(e){ji(`touchcancel`,e)}function Hi(e){Mi(`touchcancel`,e)}var Ui=t({vibrateLong:()=>Gi,vibrateShort:()=>Wi});function Wi(e){return w(`vibrateShort`,e)}function Gi(e){return w(`vibrateLong`,e)}var Ki=t({extBridge:()=>qi,extOffBridge:()=>Yi,extOnBridge:()=>Ji,offLoginStatusChanged:()=>Zi,onLoginStatusChanged:()=>Xi});function qi({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),w(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function Ji({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}`;w(i,{evtId:i,keep:r,success:n})}function Yi({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}`;w(r,{evtId:r,success:n})}function Xi(e){S.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function Zi(){S.off(`notifyLoginStatusChanged`)}var Qi=new WeakSet;function $i(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!Qi.has(e)){Qi.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{Qi.delete(e)}}x(t),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?$i(e,t,i):(x(t),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 ea=[`onLaunch`,`onShow`,`onHide`,`onError`],ta=[`globalData`],na=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),Je(this.onError),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){ea.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)ea.includes(t)||ta.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`),Ke(this.options)}appShow(e=this.options){M(this,this.onShow,[e],`onShow`),Ke(e)}appHide(){M(this,this.onHide,[],`onHide`),qe()}},ra={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in ra)Object.freeze(ra[e]);var ia=Object.freeze(ra),aa=[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],oa=/^(([\w-]+\s)*)(\d+r?px)(\/(\d+\.?\d*(r?px)?))?\s+(.*)/,sa=/\d+\.?\d*px/,ca=/[ᄀ-ᅟ⺀-가-힣豈-︐-︙︰--⦆¢-₩]/,la=class{constructor(e,t){this.type=e,this.data=t,this.colorStop=[]}addColorStop(e,t){this.colorStop.push([e,t])}},ua=class{constructor(e,t){this.image=e,this.repetition=t}};function da(e){return typeof e==`string`?e:e?.src??e?._src??e}function fa(e,t,n,r){return new la(`linear`,[e,t,n,r])}function pa(e,t,n){return new la(`radial`,[e,t,n])}function ma(e,t){if(t===void 0){console.error(`Failed to execute 'createPattern' on 'CanvasContext': 2 arguments required, but only 1 present.`);return}if(!aa.includes(t)){console.error(`Failed to execute 'createPattern' on 'CanvasContext': The provided type ('${t}') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.`);return}return new ua(da(e),t)}function ha(e){return e instanceof la?{__canvasStyle:`gradient`,type:e.type,data:[...e.data],colorStop:e.colorStop.map(([e,t])=>[e,t])}:e instanceof ua?{__canvasStyle:`pattern`,image:e.image,repetition:e.repetition}:e}function ga(e){let t=String(e).match(oa);if(!t)return null;let n=t[1].trim().split(/\s/),r=Number.parseFloat(t[3]),i=t[7],a=[],o=`normal`,s=`normal`,c=()=>{a.push(`normal`),s=`normal`};return n.forEach((e,t)=>{[`italic`,`oblique`,`normal`].includes(e)?(a.push(e),o=e):[`bold`,`normal`].includes(e)?(a.push(e),s=e):t===0?(a.push(`normal`),o=`normal`):t===1&&c()}),n.length===1&&c(),{font:`${a.join(` `)} ${r}px ${i}`,fontStyle:o,fontWeight:s,fontSize:r,fontFamily:i}}function _a(e,t){return String(e).replace(sa,`${t}px`)}function va(){try{if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(0,0).getContext(`2d`);if(typeof document<`u`&&typeof document.createElement==`function`)return document.createElement(`canvas`).getContext(`2d`)}catch{}return null}function ya(e,t,n,r){let i=String(t);if(e)try{e.font=n;let t=e.measureText(i)?.width;if(typeof t==`number`&&!Number.isNaN(t))return t}catch{}let a=typeof r==`number`&&r>0?r:10,o=0;for(let e of i)o+=ca.test(e)?1:.5;return o*a}var ba=new Set([`2d`]),xa=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Sa=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Ca=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),wa=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Ta=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),Ea=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),Da={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Oa=new Map,P=new Map,F=null,ka=null,I={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 Aa(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function ja(e,t){e&&t&&Oa.set(e,t)}function Ma(e){return Oa.get(e)||null}function Na(e,t){return e&&e[Aa(t)]||null}function L(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>L(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||[]}if(e.__canvasImageData)return Ra(e.width,e.height,new Uint8ClampedArray(e.data||[]));let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}S.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{ja(e,t)}),S.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{ja(e,t)}),S.on(`pageUnload`,({bridgeId:e})=>{yo(e)});var Pa=1,Fa=1;function Ia(){let e=C.getPageInfo();return e?.bridgeId||e?.id||``}function R(e,t,n){let r=pe(e,t,n);if(r)throw RangeError(r)}var La=class{constructor(e,t,n){this.data=e,this.width=t,this.height=n,Object.defineProperty(this,"__diminaCanvasImageData",{value:!0})}get[Symbol.toStringTag](){return`ImageData`}};function Ra(e,t,n){let r=Math.abs(Math.trunc(Number(e))),i=Math.abs(Math.trunc(Number(t)));R(r,i);let a=n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n||r*i*4);if(a.length!==r*i*4)throw RangeError(`ImageData data length does not match its dimensions`);if(typeof globalThis.ImageData==`function`)try{return new globalThis.ImageData(a,r,i)}catch{}return new La(a,r,i)}function z(e,t,n){S.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function za(e){Promise.resolve().then(e)}function Ba(e){return Object.prototype.toString.call(e)===`[object Object]`}function Va(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 B(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};if(e.__diminaCanvasImageData||Object.prototype.toString.call(e)===`[object ImageData]`&&e.data instanceof Uint8ClampedArray)return R(e.width,e.height,{transferable:!0}),{__canvasImageData:!0,width:e.width,height:e.height,data:Array.from(e.data)};let t=Va(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=>B(e));if(Ba(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=B(r);return t}return e}function V(e){return Array.from(e).map(e=>B(e))}function H(e=`canvas_resource`){return`${e}_${p()}`}var U=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=Pa++,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:V(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Ha=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._pendingCallback=null,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e,this.canvas.removeCallback(this._pendingCallback);let t=this.canvas.storeCallback((e={})=>{this._pendingCallback===t&&(this._pendingCallback=null);let r=e.value||{};e.ok?(this.width=r.width||this.width,this.height=r.height||this.height,n(this.onload)&&this.onload(r)):n(this.onerror)&&this.onerror(r)});this._pendingCallback=t;try{this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,callback:t})}catch(e){throw this.canvas.removeCallback(t,e),this._pendingCallback=null,e}}},W=Symbol(`invalid canvas 2d state`),Ua={direction:new Set([`inherit`,`ltr`,`rtl`]),fontKerning:new Set([`auto`,`normal`,`none`]),fontStretch:new Set([`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`]),fontVariantCaps:new Set([`normal`,`small-caps`,`all-small-caps`,`petite-caps`,`all-petite-caps`,`unicase`,`titling-caps`]),globalCompositeOperation:new Set(`source-over.source-in.source-out.source-atop.destination-over.destination-in.destination-out.destination-atop.lighter.copy.xor.multiply.screen.overlay.darken.lighten.color-dodge.color-burn.hard-light.soft-light.difference.exclusion.hue.saturation.color.luminosity.plus-lighter`.split(`.`)),imageSmoothingQuality:new Set([`low`,`medium`,`high`]),lineCap:new Set([`butt`,`round`,`square`]),lineJoin:new Set([`round`,`bevel`,`miter`]),textAlign:new Set([`start`,`end`,`left`,`right`,`center`]),textBaseline:new Set([`top`,`hanging`,`middle`,`alphabetic`,`ideographic`,`bottom`]),textRendering:new Set([`auto`,`optimizeSpeed`,`optimizeLegibility`,`geometricPrecision`])},Wa=new Set([`lineWidth`,`miterLimit`]),Ga=new Set([`shadowBlur`]),Ka=new Set([`lineDashOffset`,`shadowOffsetX`,`shadowOffsetY`]),qa=new Set([`accentcolor`,`accentcolortext`,`activetext`,`buttonborder`,`buttonface`,`buttontext`,`canvas`,`canvastext`,`field`,`fieldtext`,`graytext`,`highlight`,`highlighttext`,`linktext`,`mark`,`marktext`,`selecteditem`,`selecteditemtext`,`visitedtext`]),Ja=new Set([`caption`,`icon`,`menu`,`message-box`,`small-caption`,`status-bar`]),Ya=`[-+]?(?:\\d*\\.?\\d+)(?:[eE][-+]?\\d+)?`,Xa=`(?:%|cap|ch|cm|dvh|dvw|em|ex|ic|in|lh|mm|pc|pt|px|q|rcap|rch|rem|rex|ric|rlh|svh|svw|vmax|vmin|vh|vi|vb|vw)`,Za=RegExp(`(?:^|\\s)(?:(?:xx?-small|small|medium|large|xx?-large|xxx-large|smaller|larger)|${Ya}${Xa})(?:\\s*\\/[^\\s]+)?\\s+.+$`,`i`),Qa=RegExp(`^(?:normal|0|${Ya}${Xa})$`,`i`),$a=RegExp(`^${Ya}[a-z%]*$`,`i`);function eo(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function to(e,t){let n=1,r=``;for(let i=t+1;i<e.length;i++){let t=e[i];if(r){t===r&&!eo(e,i)&&(r=``);continue}if(t===`"`||t===`'`)r=t;else if(t===`(`)n++;else if(t===`)`&&--n===0)return i+1}return-1}function no(e){let t=0,n=``;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===n&&!eo(e,r)&&(n=``);continue}if(i===`"`||i===`'`)n=i;else if(i===`(`)t++;else if(i===`)`&&--t<0)return!1}return t===0&&!n}function ro(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&!eo(e,n)&&(t=``);continue}if(r===`"`||r===`'`)t=r;else if(/^var\s*\(/i.test(e.slice(n)))return!0}return!1}function io(e){if(typeof e!=`string`)return!1;let t=e.trim();if(!t||t.includes(`\0`)||ro(t))return!1;let n=t.toLowerCase();return n===`transparent`||n===`currentcolor`||Object.prototype.hasOwnProperty.call(ia,n)||qa.has(n)||/^#[\da-f]{3,4}(?:[\da-f]{3,4})?$/i.test(t)?!0:t.includes(`(`)&&no(t)}function ao(e,t){let n=String(t).trim();if(!n||n.includes(`\0`)||ro(n))return W;if(e===`font`){let e=Ja.has(n.toLowerCase())||Za.test(n);for(let t of n.matchAll(/\b(calc|clamp|max|min)\s*\(/gi)){let r=to(n,t.index+t[0].lastIndexOf(`(`));r>0&&/^(?:\s*\/[^\s]+)?\s+.+$/.test(n.slice(r))&&(e=!0)}return e||=no(n)&&/\s/.test(n),e?n:W}return e===`filter`?n===`none`||n.includes(`(`)&&no(n)?n:W:Qa.test(n)||$a.test(n)||n.includes(`(`)&&no(n)?n:W}function oo(e,t){if(e===`globalCompositeOperation`&&String(t)===`normal`)return`source-over`;if(Ua[e]){let n=String(t);return Ua[e].has(n)?n:W}if(Wa.has(e)){let e=Number(t);return Number.isFinite(e)&&e>0?e:W}if(Ga.has(e)){let e=Number(t);return Number.isFinite(e)&&e>=0?e:W}if(Ka.has(e)){let e=Number(t);return Number.isFinite(e)?e:W}if(e===`globalAlpha`){let e=Number(t);return Number.isFinite(e)&&e>=0&&e<=1?e:W}return e===`imageSmoothingEnabled`?!!t:[`font`,`filter`,`letterSpacing`,`wordSpacing`].includes(e)?ao(e,t):e===`shadowColor`?io(t)?t:W:e===`fillStyle`||e===`strokeStyle`?typeof t==`string`&&io(t)||t?.__canvasResourceId?t:W:t}var so=Object.freeze({direction:`inherit`,fillStyle:`#000000`,filter:`none`,font:`10px sans-serif`,fontKerning:`auto`,fontStretch:`normal`,fontVariantCaps:`normal`,globalAlpha:1,globalCompositeOperation:`source-over`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`,letterSpacing:`0px`,lineCap:`butt`,lineDashOffset:0,lineJoin:`miter`,lineWidth:1,miterLimit:10,shadowBlur:0,shadowColor:`rgba(0, 0, 0, 0)`,shadowOffsetX:0,shadowOffsetY:0,strokeStyle:`#000000`,textAlign:`start`,textBaseline:`alphabetic`,textRendering:`auto`,wordSpacing:`0px`}),co=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.measureContext=void 0,this.stateSequences=Object.create(null),this.state={...so},this.confirmedState={...so},this.confirmedStateSequences=Object.create(null),this.stateStack=[],new Proxy(this,{get(e,t){if(t in e)return typeof e[t]==`function`?e[t].bind(e):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){if(typeof n==`symbol`||!(n in e.state))return Reflect.set(e,n,r);let i=e.confirmedState[n],a=oo(n,r);if(a===W)return!0;e.state[n]=a;let o=(e.stateSequences[n]||0)+1;return e.stateSequences[n]=o,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:B(a),previousValue:B(i),feedback:`state`,sequence:o}),!0}})}applyFeedback(e={}){for(let t of e.state||[]){let e=L(t.value);(this.confirmedStateSequences[t.prop]||0)<=t.sequence&&(this.confirmedState[t.prop]=e,this.confirmedStateSequences[t.prop]=t.sequence),this.stateSequences[t.prop]===t.sequence&&(this.state[t.prop]=e);for(let n of this.stateStack)n.sequences[t.prop]===t.sequence&&(n.state[t.prop]=e)}}stateSequenceSnapshot(){return Object.fromEntries(Object.keys(this.state).map(e=>[e,this.stateSequences[e]||0]))}replaceState(e,{clearStack:t=!1}={}){for(let e of Object.keys(this.state))this.stateSequences[e]=(this.stateSequences[e]||0)+1;this.state={...e},t&&(this.stateStack=[])}resetStateForBitmapResize(){return this.replaceState(so,{clearStack:!0}),this.confirmedState={...so},this.confirmedStateSequences={...this.stateSequenceSnapshot()},this.stateSequenceSnapshot()}getImageData(e,t,n,r){return 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){let n=e===`save`||e===`restore`||e===`reset`;if(e===`save`?this.stateStack.push({state:{...this.state},sequences:this.stateSequenceSnapshot()}):e===`restore`&&this.stateStack.length>0?this.replaceState(this.stateStack.pop().state):e===`reset`&&this.resetStateForBitmapResize(),e===`measureText`){this.measureContext??=va();let e=ga(this.state.font)?.fontSize||10;return{width:ya(this.measureContext,t[0],this.state.font,e)}}if(e===`createImageData`)return t.length===1&&t[0]?.data instanceof Uint8ClampedArray?Ra(t[0].width,t[0].height):Ra(t[0],t[1]);let r=Sa.has(e)?H():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:V(t),resultId:r,feedback:n?`stateSnapshot`:void 0,stateSequences:n?this.stateSequenceSnapshot():void 0}),r)return new U(this.canvas,r)}},lo=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=H(`webgl_extension_resource`),n=new U(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 U)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:V(t),resultId:r}),n}},uo=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...Da,...Ba(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(I,t))return I[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:B(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(I.VIEWPORT,[0,0,e,t]),this.state.set(I.SCISSOR_BOX,[0,0,e,t]),this.state.set(I.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(I.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(I.DEPTH_CLEAR_VALUE,1),this.state.set(I.DEPTH_WRITEMASK,!0),this.state.set(I.DEPTH_FUNC,I.LESS),this.state.set(I.STENCIL_CLEAR_VALUE,0),this.state.set(I.LINE_WIDTH,1),this.state.set(I.CULL_FACE_MODE,I.BACK),this.state.set(I.FRONT_FACE,I.CCW),this.state.set(I.ACTIVE_TEXTURE,I.TEXTURE0),this.state.set(I.PACK_ALIGNMENT,4),this.state.set(I.UNPACK_ALIGNMENT,4),this.state.set(I.CURRENT_PROGRAM,null),this.state.set(I.ARRAY_BUFFER_BINDING,null),this.state.set(I.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(I.TEXTURE_BINDING_2D,null),this.state.set(I.FRAMEBUFFER_BINDING,null),this.state.set(I.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=L(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(L(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 L(e)}queueError(e){e&&e!==I.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(V(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:V(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=H(`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 U(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:V(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}),I.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,I.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=Ca.get(e)||wa.get(e);if(n)return this.createResource(e,t,n);if(Ea.has(e)){let n=t[0];return n instanceof U&&n.resourceType===Ea.get(e)&&!n.deleted}Ta.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:V(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(I.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(I.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(I.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(I.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(I.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(I.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(I.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(I.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(I.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(I.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(I.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(I.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(I.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===I.ARRAY_BUFFER?this.state.set(I.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===I.ELEMENT_ARRAY_BUFFER&&this.state.set(I.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===I.TEXTURE_2D&&this.state.set(I.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(I.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(I.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)?L(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof U)||e.resourceType!==`shader`)return null;switch(t){case I.DELETE_STATUS:return e.deleted;case I.SHADER_TYPE:return e.metadata.shaderType;case I.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof U)||e.resourceType!==`program`)return null;switch(t){case I.DELETE_STATUS:return e.deleted;case I.LINK_STATUS:return!!e.metadata.linkStatus;case I.VALIDATE_STATUS:return!!e.metadata.validateStatus;case I.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=H(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new lo(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},fo=class{constructor({nodeId:e,bridgeId:t=Ia(),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||Ma(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingCallbacks=new Map,this.pendingStateFeedbacks=new Map,this.stateFeedbackByProperty=new Map,this.rafCallbacks=new Map,this.pendingOperations=[],this.flushScheduled=!1,this.disposed=!1,this._width=y(n,300),this._height=y(r,150),R(this._width,this._height,{allowZero:!0}),P.has(t)||P.set(t,new Set),P.get(t).add(this)}get width(){return this._width}reset2DStateAfterBitmapResize(){for(let[e,t]of this.contextsById){let n=t.resetStateForBitmapResize?.();n&&this.enqueueOperation({op:`contextStateSnapshot`,contextId:e,feedback:`stateSnapshot`,stateSequences:n})}}set width(e){let t=y(e,300);R(t,this._height,{allowZero:!0}),this._width=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width}),this.reset2DStateAfterBitmapResize()}get height(){return this._height}set height(e){let t=y(e,150);R(this._width,t,{allowZero:!0}),this._height=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height}),this.reset2DStateAfterBitmapResize()}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=Aa(n),i=xa.has(n);if(!ba.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?Na(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=H(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:B(t)});let s=i?new uo(this,o,r,t,a):new co(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=H(`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=L(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 Ha(this,H(`canvas_image`))}storeCallback(e,t){if(this.disposed)throw Error(`canvas node is disposed`);let n;return n=v.store(t=>{this.pendingCallbacks.delete(n),e(t)}),this.pendingCallbacks.set(n,t),n}releaseStateFeedback(e){let t=this.pendingStateFeedbacks.get(e);if(t){this.pendingStateFeedbacks.delete(e);for(let n of t)this.stateFeedbackByProperty.get(n)===e&&this.stateFeedbackByProperty.delete(n)}}removeCallback(e,t){if(!e||!this.pendingCallbacks.has(e))return;let n=this.pendingCallbacks.get(e);this.pendingCallbacks.delete(e),this.releaseStateFeedback(e),v.remove(e),n?.(t)}requestAnimationFrame(e){let t=Fa++,r=this.storeCallback(r=>{this.rafCallbacks.delete(t),n(e)&&e(r)});this.rafCallbacks.set(t,r);try{z(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r})}catch(e){throw this.removeCallback(r,e),this.rafCallbacks.delete(t),e}return t}cancelAnimationFrame(e){this.removeCallback(this.rafCallbacks.get(e)),this.rafCallbacks.delete(e),z(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){let a=pe(r,i,{transferable:!0});return a?Promise.reject(RangeError(a)):new Promise((a,o)=>{let s=this.storeCallback((e={})=>{if(!e.ok){o(Error(e.error||`canvas pixel read failed`));return}a(L(e.value))},e=>o(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s,resultEnvelope:!0})}catch(e){this.removeCallback(s,e)}})}toDataURL(e=`image/png`,t){return R(this._width,this._height,{allowZero:!0}),new Promise((n,r)=>{let i=this.storeCallback((e={})=>{if(!e.ok){r(Error(e.error||`canvas export failed`));return}n(e.value)},e=>r(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:i,resultEnvelope:!0})}catch(e){this.removeCallback(i,e)}})}dispose({notifyRender:e=!0}={}){if(this.disposed)return;this.disposed=!0;let t=Error(`canvas node disposed`);for(let e of[...this.pendingCallbacks.keys()])this.removeCallback(e,t);this.rafCallbacks.clear(),this.pendingOperations=[],this.pendingTypedArrayUpdates.clear(),this.pendingStateFeedbacks.clear(),this.stateFeedbackByProperty.clear(),this.eventListeners.clear();let n=P.get(this.bridgeId);if(n?.delete(this),n?.size===0&&P.delete(this.bridgeId),e)try{z(this.bridgeId,`disposeCanvasNodes`,{nodeIds:[this.nodeId]})}catch{}}enqueueOperation(e){if(this.disposed)throw Error(`canvas node is disposed`);this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,za(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.flatMap(e=>e.feedback===`state`?[`${e.contextId}:${e.prop}`]:e.feedback===`stateSnapshot`?Object.keys(e.stateSequences||{}).map(t=>`${e.contextId}:${t}`):[]),n=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback&&e.feedback!==`state`&&e.feedback!==`stateSnapshot`||e.typedArrayUpdateId),r;if(n||t.length>0){if(!n)for(let e of t){let t=this.stateFeedbackByProperty.get(e),n=this.pendingStateFeedbacks.get(t);n&&(n.delete(e),this.stateFeedbackByProperty.delete(e),n.size===0&&this.removeCallback(t))}if(r=this.storeCallback(e=>{this.releaseStateFeedback(r),this.applyFlushFeedback(e)}),!n){let e=new Set(t);this.pendingStateFeedbacks.set(r,e);for(let t of e)this.stateFeedbackByProperty.set(t,r)}}try{z(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:r})}catch(t){this.removeCallback(r,t);for(let n of e)this.removeCallback(n.callback,t);throw t}}};function po(e,t=Ia()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(ja(t,e.webglCapabilities),new fo({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function mo(e,t=Ia()){return Array.isArray(e)?e.map(e=>mo(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:po(e.node,t)}:e}function ho(e={}){let t=y(e.width,300),n=y(e.height,150);R(t,n,{allowZero:!0});let r=e.type||`2d`,i=H(`offscreen_canvas`),a=Ia();return z(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new fo({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:Ma(a)})}function go(e={}){if(F)return ho(e);let t=b.getSystemInfo()||{},n=y(e.width,t.windowWidth||300),r=y(e.height,t.windowHeight||150);R(n,r,{allowZero:!0});let i=e.type||`2d`,a=H(`game_canvas`),o=Ia();return z(o,`createGameCanvas`,{nodeId:a,width:n,height:r,type:i}),F=new fo({nodeId:a,bridgeId:o,width:n,height:r,type:i,webglCapabilities:Ma(o)}),F}function _o(){return ka||=ho({width:1,height:1,type:`2d`}),ka.createImage()}function vo(){globalThis.GameGlobal=globalThis,globalThis.global=globalThis,globalThis.requestAnimationFrame=e=>{if(!F)throw Error(`requestAnimationFrame requires wx.createCanvas() first`);return F.requestAnimationFrame(e)},globalThis.cancelAnimationFrame=e=>{F?.cancelAnimationFrame(e)}}function yo(e){let t=[...P.get(e)||[]],n=t.map(e=>e.nodeId);for(let e of t)e.dispose({notifyRender:!1});if(n.length>0)try{z(e,`disposeCanvasNodes`,{nodeIds:n})}catch{}P.delete(e),Oa.delete(e),F?.bridgeId===e&&(F=null),ka?.bridgeId===e&&(ka=null)}var bo=t({createSelectorQuery:()=>xo});function xo(){return new To}function So(){return C.getPageInfo()}function Co(){let e=So();return e?.__id__||e?.id}function wo(){let e=So();return e?.bridgeId||e?.id}var To=class{constructor(){this.__componentId=Co(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Eo(this,this.__componentId,e,!0)}selectAll(e){return new Eo(this,this.__componentId,e,!1)}selectViewport(){return new Eo(this,Co(),``,!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=wo();w(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=mo(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Eo=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)}},Do=t({createIntersectionObserver:()=>Oo});function Oo(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new ko(e,{thresholds:n,initialRatio:r,observeAll:i})}var ko=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=v.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);w(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){w(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Ao=t({createMediaQueryObserver:()=>Mo});function jo(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 Mo(e,t={}){return new No(e,t)}var No=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=v.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){w(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),v.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),w(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:jo(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,w(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(v.remove(this._callbackId),this._callbackId=null)}};function Po(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 Fo(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 Io(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Lo(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=Po(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Ro(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Io(e.path,t)||Io(t,e.path)}function zo(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:Lo(e.expression)}))}function Bo(e,t,r=e.data,i=e.__info__||{}){for(let a of zo(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Ro(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 Vo(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Ho(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 Uo(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=Po(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=ie(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;Fo(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=[],Bo(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:Vo(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Ho(e,a.changes)}}function Wo(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 Go=new Map;function Ko(e){return Go.has(e)||Go.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Go.get(e)}function qo(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return v.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function Jo(e){let t=Ko(e);t.depth++}function Yo(e){let t=Ko(e);t.depth>0&&t.depth--,t.depth===0&&Zo(e)}function Xo(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Po(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(tt({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function G(e,t,n,r,i=[]){let a=Ko(e),o=a.byModuleId.get(t),s=Xo(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&&Zo(e)}))}function Zo(e){let t=Go.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,S.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function Qo(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>Qo(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=Qo(n)),e),{}):e}function $o(e){if(e){let t={};for(let n in e){let r=we(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ts),default:r.value}}return t}}var es=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ts(e){return Array.isArray(e)?e.map(e=>ts(e)):e===null||e===``?null:es.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function ns(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 rs(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 ee(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)?ee(r,i):i}return n}function g(e,t){if(typeof t==`string`){te(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=>g(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=ee(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 te(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=>g(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=ee(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function is(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 as(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 os(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 ss(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 cs(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!is(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&&os(i,n)&&(o[r]=ie(ss(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 ls=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],us=[`show`,`hide`,`resize`,`routeDone`],ds=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=ie(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,we(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=ke(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,S.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__=[],G(this.bridgeId,this.__id__,{},qo(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(Y.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(Y.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(Y.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=Uo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Wo(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),Wo(this,n.propertyChanges);return}let r=cs(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,qo(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)}),Wo(this,n.propertyChanges)}#u(){ls.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&us.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&&(Bo(this,e),Wo(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 Bo(this,o),Wo(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=ke(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 xo().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]),n=t.find(n=>is(n,this.__id__,t)&&as(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]);return t.filter(n=>is(n,this.__id__,t)&&as(e,n))}selectOwnerComponent(){let e=Object.values(Y.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Oo(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Jo(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=cs(this,Y.instances[this.bridgeId],e);G(this.bridgeId,this.__id__,e,qo(this,t),n),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];Yo(this.bridgeId)}}createMediaQueryObserver(e){return Mo(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),w(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),w(`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=ns(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 Y.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?Y.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=Y.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=Y.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(Y.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)}},K=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,rs(this.moduleInfo,this.behaviors),this.noReferenceData=Qo(this.moduleInfo.data||{})}getProps(){let e=$o(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}},fs=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=ie(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,S.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__=[],G(this.bridgeId,this.__id__,{},qo(this,e))}setData(e,t){let n=Uo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=cs(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,qo(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return xo().in(this)}getTabBar(){let e=Object.values(Y.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&is(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]||{}),n=t.find(n=>is(n,this.__id__,t)&&as(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]||{});return t.filter(n=>is(n,this.__id__,t)&&as(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`)}},q=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,rs(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=Qo(this.moduleInfo.data||{})}},ps=class{static type=`app`;constructor(e){this.moduleInfo=e}},J=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o,runtimeType:s}=e;if(g&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}return C.setInitId(n),s===`game`?(yo(n),vo(),_(r),S.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0):(le(`app`)&&_(`app`),_(r),S.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0)}createAppModule(e){let t=new ps(e);this.staticModules[ps.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))_(e);if(n===q.type){let n=new q(e,t);this.staticModules[r]=n}else if(n===K.type){let n=new K(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[ps.type]}getModuleByPath(e){return this.staticModules[e]}},Y=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.appEnterOptions={},this.instances={},this.pageStates=new Map,this.runtimeType=`miniProgram`,this.gameLaunched=!1}setRuntimeType(e){this.runtimeType=e===`game`?`game`:`miniProgram`}isMiniGame(){return this.runtimeType===`game`}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=this.normalizeAppOptions(e),this.appEnterOptions=this.appLaunchOptions)}normalizeAppOptions(e={}){let{pagePath:t,path:n=t,...r}=e||{},i={...r,path:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];return i}getAppLaunchOptions(){return this.appLaunchOptions}getAppEnterOptions(){return this.appEnterOptions}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])){let t=M(e,e[i],[a],`event ${i}`);try{return await t}catch(t){n(e.componentError)&&e.componentError(t),x(t),console.error(`[service] event ${i} error:`,t);return}}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 t=this.normalizeAppOptions(e),n=J.getAppModule();if(!n){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(n.moduleInfo,this.defaultApp),this.defaultApp={},this.appLaunchOptions=t,this.appEnterOptions=t,this.app=new na(n,t)}appShow(e){e&&Object.keys(e).length>0&&(this.appEnterOptions=this.normalizeAppOptions(e)),this.app?this.app.appShow(this.appEnterOptions):this.isMiniGame()&&this.gameLaunched&&Ke(this.appEnterOptions)}appHide(){this.app?this.app.appHide():this.isMiniGame()&&this.gameLaunched&&qe()}gameLaunch(){this.isMiniGame()&&!this.gameLaunched&&(this.gameLaunched=!0,Ke(this.appEnterOptions))}stackShow(e){C.pushStack(e)}stackHide(e){C.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=J.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===K.type){let e=new ds(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||C.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===q.type){let e=new fs(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,C.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__!==K.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__===K.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__===K.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__===q.type?i.push(e):e.__type__===K.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__===q.type||e.__type__===K.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__===K.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__===q.type?r.push(e):e.__type__===K.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__===K.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===K.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),C.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__===q.type?r.push(e):e.__type__===K.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__===K.type&&i.componentError(r),x(r))}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===K.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__===K.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})}},ms=t({getEnterOptionsSync:()=>gs,getLaunchOptionsSync:()=>hs});function hs(){return Y.getAppLaunchOptions()}function gs(){return Y.getAppEnterOptions()}var _s=t({getLocation:()=>vs,offLocationChange:()=>Cs,onLocationChange:()=>Ss,openLocation:()=>bs,startLocationUpdate:()=>ys,stopLocationUpdate:()=>xs});function vs(e){return w(`getLocation`,e)}function ys(e){return w(`startLocationUpdate`,e)}function bs(e){return w(`openLocation`,e)}function xs(e){return w(`stopLocationUpdate`,e)}function Ss(e){e&&w(`onLocationChange`,{success:v.store(e,!0)})}function Cs(e){if(e){let t=v.store(e,!0);w(`offLocationChange`,{success:t}),v.remove(t)}else w(`offLocationChange`),v.remove()}var ws=t({createMapContext:()=>Ts});function Ts(e,t){return new Es({mapId:e,obj:t})}var Es=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 w(e,{mapId:this.opts.mapId,...t})}},Ds=t({createInnerAudioContext:()=>As}),Os=1,ks=class{constructor(){this._audioId=Os++,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={},w(`audioCreate`,{audioId:this._audioId}),w(`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,w(`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,w(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,w(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,w(`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)),w(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,w(`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,w(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,w(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,w(`audioStop`,{audioId:this._audioId})}seek(e){w(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){w(`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 As(){return new ks}var js=t({chooseImage:()=>Rs,chooseMessageFile:()=>zs,compressImage:()=>Ls,createImage:()=>Ms,getImageInfo:()=>Fs,previewImage:()=>Ps,previewMedia:()=>Is,saveImageToPhotosAlbum:()=>Ns});function Ms(){return _o()}function Ns(e){return w(`saveImageToPhotosAlbum`,e)}function Ps(e){return w(`previewImage`,e)}function Fs(e){return w(`getImageInfo`,e)}function Is(e){return w(`previewMedia`,e)}function Ls(e){return w(`compressImage`,e)}function Rs(e){return w(`chooseImage`,e)}function zs(e){return w(`chooseMessageFile`,e)}var Bs=t({chooseMedia:()=>Us,chooseVideo:()=>Hs,compressVideo:()=>Ks,createVideoContext:()=>Vs,getVideoInfo:()=>Ws,saveVideoToPhotosAlbum:()=>Gs});function Vs(e,t){return new qs({videoId:e,obj:t})}function Hs(e){return w(`chooseVideo`,e)}function Us(e){return w(`chooseMedia`,e)}function Ws(e){return w(`getVideoInfo`,e)}function Gs(e){return w(`saveVideoToPhotosAlbum`,e)}function Ks(e){return w(`compressVideo`,e)}var qs=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={}){w(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Js=t({exitMiniProgram:()=>Qs,navigateBackMiniProgram:()=>Zs,navigateToMiniProgram:()=>Xs,restartMiniProgram:()=>Ys});function Ys(e){return w(`restartMiniProgram`,e)}function Xs(e){return w(`navigateToMiniProgram`,e)}function Zs(e){return w(`navigateBackMiniProgram`,e)}function Qs(e){return w(`exitMiniProgram`,e)}var $s=t({downloadFile:()=>ec});function ec(e){return w(`downloadFile`,e)}var tc=t({offLocalServiceDiscoveryStop:()=>lc,offLocalServiceFound:()=>dc,offLocalServiceLost:()=>pc,offLocalServiceResolveFail:()=>hc,onLocalServiceDiscoveryStop:()=>cc,onLocalServiceFound:()=>uc,onLocalServiceLost:()=>fc,onLocalServiceResolveFail:()=>mc,startLocalServiceDiscovery:()=>oc,stopLocalServiceDiscovery:()=>sc}),nc=A(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),rc=A(`onLocalServiceFound`,`offLocalServiceFound`),ic=A(`onLocalServiceLost`,`offLocalServiceLost`),ac=A(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function oc(e={}){return w(`startLocalServiceDiscovery`,e)}function sc(e={}){return w(`stopLocalServiceDiscovery`,e)}function cc(e){return nc.on(e)}function lc(e){return nc.off(e)}function uc(e){return rc.on(e)}function dc(e){return rc.off(e)}function fc(e){return ic.on(e)}function pc(e){return ic.off(e)}function mc(e){return ac.on(e)}function hc(e){return ac.off(e)}var gc=t({request:()=>_c});function _c(e){return w(`request`,e)}var vc=t({createTCPSocket:()=>bc}),yc=class{constructor(e){this.socketId=e,this.events={bindWifi:A(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:A(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:A(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:A(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:A(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},mi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return k(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=k(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return k(`TCPSocket.connect`,this.socketId,e)}write(e){return k(`TCPSocket.write`,this.socketId,{data:pi(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 bc(){return new yc(hi(`tcp`))}var xc=t({createUDPSocket:()=>Cc}),Sc=class{constructor(e){this.socketId=e,this.events={close:A(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:A(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:A(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:A(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},mi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return k(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=k(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return k(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return k(`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 k(e,this.socketId,{...t,message:pi(t.message)})}};function Cc(){return new Sc(hi(`udp`))}var wc=t({uploadFile:()=>Oc}),Tc=1;function Ec(){return`upload_${Date.now()}_${Tc++}`}function Dc(){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 Oc(e={}){let t=Ec(),n=Dc(),r=Dc(),i=v.store(e=>n.dispatch(e),!0,`${t}_progress`),a=v.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,v.remove(i),v.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{w(`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||w(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var kc=t({closeSocket:()=>gl,connectSocket:()=>ml,onSocketClose:()=>wl,onSocketError:()=>Cl,onSocketMessage:()=>Sl,onSocketOpen:()=>xl,sendSocketMessage:()=>hl}),Ac=0,jc=1,Mc=3,Nc=5,Pc=/^wss:\/\/.*/i,Fc={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Ic={...Fc,open:[`header`]};function Lc(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:di(e),isBuffer:!0}:{data:e}}function Rc(e,t){let n=Lc(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function zc(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 Bc(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 Vc(e){let t=Bc(e,Fc.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=fi(e.data)),t}function Hc(e){return Number.isFinite(e)?e:1e3}function Uc(e){return Number.isFinite(e)&&e>=1?e:0}function Wc(e){return Object.prototype.toString.call(e).slice(8,-1)}function Gc(e){return!!e&&typeof e==`object`}function Kc(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function qc(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function Jc(e){return Bc(e,[`errMsg`])}function Yc(){let e;function t(t){return e=Jc(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function Xc(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var Zc=new Set,X,Qc={open:void 0,message:void 0,error:void 0,close:void 0},$c=[],el=!1;function tl(){el=!1;let e=$c.splice(0,$c.length);for(let t of e)t()}function nl(e,{defer:t=!1}={}){if(!t&&$c.length===0){e();return}$c.push(e),!el&&(el=!0,setTimeout(tl,0))}function rl(e,t,r){let i=Qc[t];if(!e||!n(i))return;let a=t===`message`?r:Bc(r,Ic[t]);N(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function il(e,t,r,i){let a=new Set,o,s=!1;function c(e){if(!o)return;let n=o;e&&w(t,{...r,callback:n,keep:!0}),o=void 0,v.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=v.store(e=>i(e,[...a]),!0);o=t;try{w(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,v.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var al=new WeakMap,ol=Symbol(`SocketTask constructor token`);function Z(e){let t=al.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function sl(e){if(Zc.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function cl(e){e.connectionState=Mc,e.terminalEvent=!0}function ll(e){cl(e),sl(e)}function ul(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 dl(e,t,n){let r=Z(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||ul(r)}catch(e){throw i.remove(n),e}}function fl(e,t,n){N(void 0,t,[n],`SocketTask.${e}`,!1)}var pl=class{constructor(e,t){if(e!==ol)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Ac,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:il(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=jc,r.opened=!0;let i=n===X;nl(()=>{fl(`onOpen`,t,Bc(e,Fc.open)),rl(i,`open`,e)})}),message:il(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===X,i=Vc(e);nl(()=>{fl(`onMessage`,t,i),rl(r,`message`,i)})}),error:il(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===X;r.opened?cl(r):ll(r),nl(()=>{fl(`onError`,t,Bc(e,Fc.error)),rl(i,`error`,e)},{defer:!0})}),close:il(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===X;ll(r),nl(()=>{fl(`onClose`,t,Bc(e,Fc.close)),rl(i,`close`,e)})})},al.set(this,r)}send(e={}){let t=Z(this),n=Gc(e)?e:{};if(t.connectionState!==jc){qc(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Rc({socketId:t.socketId},n.data);Xc(r,n,Yc()),mt(`sendSocketMessage`,r)}close(e={}){let t=Z(this),n=Gc(e)?e:{},r={socketId:t.socketId,code:Hc(n.code)};n.reason!==void 0&&(r.reason=n.reason),Xc(r,n,Yc()),mt(`closeSocket`,r)}onOpen(e){dl(this,`open`,e)}onMessage(e){dl(this,`message`,e)}onError(e){dl(this,`error`,e)}onClose(e){dl(this,`close`,e)}};function ml(e){if(!Gc(e))return;let{url:t}=e;if(typeof t!=`string`){qc(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${Wc(t)};`});return}if(!Pc.test(t)){qc(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new pl(ol,r),a=Z(i),o=X;if((!X||Z(X).connectionState===Mc)&&(X=i),Zc.size>=Nc)return a.connectionState=Mc,sl(a),qc(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${Nc}`}),i;Zc.add(i);let s=Yc(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Uc(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?zc(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 ll(a),X===i&&(X=o),e}c.fail=e=>{ll(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{w(`connectSocket`,c),u=!0,ul(a)}catch(t){if(u)try{mt(`closeSocket`,{socketId:r,code:1e3})}catch{}ll(a),X===i&&(X=o),qc(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function hl(e){let t=Gc(e)?e:{},n=Kc(t);return!X||Z(X).connectionState!==jc?yl(`sendSocketMessage:fail WebSocket is not connected`,t,n):vl(`sendSocketMessage`,Rc({socketId:Z(X).socketId},t.data),t,n)}function gl(e){let t=Gc(e)?e:{},n=Kc(t),r;if(X&&Z(X).connectionState===jc){let e=Z(X),i=_l(e);try{let a=Hc(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=vl(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=yl(`closeSocket:fail WebSocket is not connected`,t,n);return r}function _l(e){let t=e.connectionState;return e.connectionState=Mc,()=>{e.terminalEvent||(e.connectionState=t)}}function vl(e,t,r,i,a){if(!i)return w(e,t).then(e=>Jc(e),e=>{throw a?.(e),Jc(e)});let o=Yc();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{w(e,t)}catch(e){throw a?.(e),e}}function yl(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));qc(t,r)}function bl(e,t){n(t)&&(Qc[e]=t)}function xl(e){bl(`open`,e)}function Sl(e){bl(`message`,e)}function Cl(e){bl(`error`,e)}function wl(e){bl(`close`,e)}var Tl=t({getAccountInfoSync:()=>El});function El(){return w(`getAccountInfoSync`)}var Dl=t({authorize:()=>Ol});function Ol(e){return w(`authorize`,e)}var kl=t({login:()=>Al});function Al(e){return w(`login`,e)}var jl=t({login:()=>Ml});function Ml(e){return w(`login`,e)}var Nl=t({getPrivacySetting:()=>Pl});function Pl(e){return w(`getPrivacySetting`,e)}var Fl=t({getSetting:()=>Ll,openSetting:()=>Il});function Il(e){return w(`openSetting`,e)}function Ll(e){return w(`getSetting`,e)}var Rl=t({getUserInfo:()=>zl});function zl(e){return w(`getUserInfo`,e)}var Bl=t({requestPayment:()=>Vl});function Vl(e){return w(`requestPayment`,e)}var Hl=t({hideShareMenu:()=>Gl,showShareImageMenu:()=>Wl,showShareMenu:()=>Ul});function Ul(e){return w(`shareShareMenu`,e)}function Wl(e){return w(`showShareImageMenu`,e)}function Gl(e){return w(`hideShareMenu`,e)}var Kl=t({clearStorage:()=>eu,clearStorageSync:()=>Xl,getStorage:()=>Ql,getStorageInfo:()=>nu,getStorageInfoSync:()=>tu,getStorageSync:()=>Jl,removeStorage:()=>$l,removeStorageSync:()=>Yl,setStorage:()=>Zl,setStorageSync:()=>ql});function ql(...e){return w(`setStorageSync`,e)}function Jl(e){return w(`getStorageSync`,e)}function Yl(e){return w(`removeStorageSync`,e)}function Xl(){return w(`clearStorageSync`)}function Zl(e){return w(`setStorage`,e)}function Ql(e){return w(`getStorage`,e)}function $l(e){return w(`removeStorage`,e)}function eu(){return w(`clearStorage`)}function tu(){return w(`getStorageInfoSync`)}function nu(e){return w(`getStorageInfo`,e)}var ru=t({createAnimation:()=>iu});function iu(e={}){return new au(e)}var au=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`,re(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,re(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,re(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`,re(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`,re(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`,re(e)]}),this}},ou=t({setBackgroundColor:()=>cu,setBackgroundTextStyle:()=>su});function su(e){return w(`setBackgroundTextStyle`,e)}function cu(e){return w(`setBackgroundColor`,e)}var lu=`10px sans-serif`;function uu(){return{lineDash:[0,0],lineDashOffset:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:`#000000`,font:lu,fontSize:10,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`}}function du(e){if(Array.isArray(e))return e.map(du);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e))t[n]=du(e[n]);return t}return e}function fu(e){return Array.isArray(e)?e.some(fu):typeof e==`object`&&e?Object.values(e).some(fu):e===void 0||typeof e==`number`&&!Number.isFinite(e)}function Q(e){return e.some(fu)}var pu=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[],this.path=[],this.state=uu(),this.drawingState=[],this._transform={a:1,b:0,c:0,d:1,e:0,f:0}}pushAction(e,...t){return Q(t)||this.actions.push({type:e,args:t}),this}getActions(){let e=this.actions.map(du).filter(e=>!Q(e.args));return this.actions=[],this.path=[],e}clearActions(){this.actions=[],this.path=[]}pushPathAction(e,...t){return Q(t)||this.path.push({type:e,args:t}),this}pushPathSnapshot(e){return this.pushAction(e,this.path.map(du))}draw(e=!1,t){let n=t;n!=null&&typeof n!=`function`&&(console.warn(`CanvasContext.draw callback is not a function, got ${typeof n}`),n=void 0);let r=this.getActions();this.canvasId&&w(`drawCanvas`,{canvasId:this.canvasId,moduleId:this.moduleId,actions:r,reserve:e,complete:n},`render`)}beginPath(){return this.path=[],this}closePath(){return this.pushPathAction(`closePath`)}moveTo(e,t){return this.pushPathAction(`moveTo`,e,t)}lineTo(e,t){return this.pushPathAction(this.path.length===0?`moveTo`:`lineTo`,e,t)}rect(e,t,n,r){return this.pushPathAction(`rect`,e,t,n,r)}arcTo(e,t,n,r,i){return this.pushPathAction(`arcTo`,e,t,n,r,i)}quadraticCurveTo(e,t,n,r){return this.pushPathAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushPathAction(`bezierCurveTo`,e,t,n,r,i,a)}arc(e,t,n,r,i,a=!1){return this.pushPathAction(`arc`,e,t,n,r,i,a)}fill(){return this.pushPathSnapshot(`fillPath`)}stroke(){return this.pushPathSnapshot(`strokePath`)}clip(){return this.pushPathSnapshot(`clip`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillRect(e,t,n,r){return this.pushAction(`fillPath`,[{type:`rect`,args:[e,t,n,r]}])}strokeRect(e,t,n,r){return this.pushAction(`strokePath`,[{type:`rect`,args:[e,t,n,r]}])}fillText(e,t,n,r){return this._pushText(`fillText`,e,t,n,r)}strokeText(e,t,n,r){return this._pushText(`strokeText`,e,t,n,r)}_pushText(e,t,n,r,i){if(i!=null){let a=Number(i);if(Number.isFinite(a))return this.pushAction(e,String(t),n,r,a)}return this.pushAction(e,String(t),n,r)}drawImage(e,...t){let n=da(e),[r,i,a,o,s,c,l,u]=t;u===void 0&&([s,c,l,u]=[r,i,a,o],r=void 0,i=void 0,a=void 0,o=void 0);let d=e=>Number.isFinite(e);return d(r)&&d(i)&&d(a)&&d(o)?this.pushAction(`drawImage`,n,r,i,a,o,s,c,l,u):d(l)&&d(u)?this.pushAction(`drawImage`,n,s,c,l,u):this.pushAction(`drawImage`,n,s,c)}rotate(e){return this.pushAction(`rotate`,e)}translate(e,t){return this.pushAction(`translate`,e,t)}scale(e,t){if(Q([e,t]))return this;let n=this._transform;return this._transform={a:n.a*e,b:n.b*e,c:n.c*t,d:n.d*t,e:n.e,f:n.f},this.pushAction(`scale`,e,t)}transform(e,t,n,r,i,a){if(Q([e,t,n,r,i,a]))return this;let o=this._transform;return this._transform={a:e*o.a+t*o.c,b:e*o.b+t*o.d,c:n*o.a+r*o.c,d:n*o.b+r*o.d,e:i*o.a+a*o.c+o.e,f:i*o.b+a*o.d+o.f},this.pushAction(`transform`,e,t,n,r,i,a)}setTransform(e,t,n,r,i,a){return Q([e,t,n,r,i,a])?this:(this._transform={a:e,b:t,c:n,d:r,e:i,f:a},this.pushAction(`setTransform`,e,t,n,r,i,a))}getTransform(){return this._transform}save(){return this.drawingState.push(this.state),this.pushAction(`save`)}restore(){return this.state=this.drawingState.pop()||uu(),this.pushAction(`restore`)}setFillStyle(e){return this.pushAction(`setFillStyle`,ha(e))}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,ha(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)}setTextAlign(e){return this.pushAction(`setTextAlign`,e)}setTextBaseline(e){return this.pushAction(`setTextBaseline`,e)}setShadow(e,t,n,r){return Q([e,t,n])?this:(this.state.shadowOffsetX=e,this.state.shadowOffsetY=t,this.state.shadowBlur=n,this.state.shadowColor=r,this.pushAction(`setShadow`,e,t,n,r))}setFontSize(e){let t=Number(e);return Number.isFinite(t)?(this.state.font=_a(this.state.font,t),this.state.fontSize=t,this.pushAction(`setFontSize`,t)):this}setLineDash(e,t){let n=Array.isArray(e)&&e.length?e:[0,0],r=t??0;return Q([n,r])?this:(this.state.lineDash=n,this.state.lineDashOffset=r,this.pushAction(`setLineDash`,n,r))}getLineDash(){return this.state.lineDash}set fillStyle(e){this.setFillStyle(e)}set strokeStyle(e){this.setStrokeStyle(e)}set globalAlpha(e){this.setGlobalAlpha(e)}set lineCap(e){this.setLineCap(e)}set lineJoin(e){this.setLineJoin(e)}set lineWidth(e){this.setLineWidth(e)}set miterLimit(e){this.setMiterLimit(e)}set textAlign(e){this.setTextAlign(e)}set textBaseline(e){this.setTextBaseline(e)}set globalCompositeOperation(e){this.pushAction(`setGlobalCompositeOperation`,e)}set lineDashOffset(e){Q([e])||(this.state.lineDashOffset=e,this.pushAction(`setLineDashOffset`,e))}set shadowBlur(e){Q([e])||(this.state.shadowBlur=e,this.pushAction(`setShadowBlur`,e))}set shadowColor(e){this.state.shadowColor=e,this.pushAction(`setShadowColor`,e)}set shadowOffsetX(e){Q([e])||(this.state.shadowOffsetX=e,this.pushAction(`setShadowOffsetX`,e))}set shadowOffsetY(e){Q([e])||(this.state.shadowOffsetY=e,this.pushAction(`setShadowOffsetY`,e))}set font(e){this.state.font=e;let t=ga(e);if(!t){console.warn(`Failed to set 'font' on 'CanvasContext': invalid format.`);return}this.state.fontStyle=t.fontStyle,this.state.fontWeight=t.fontWeight,this.state.fontSize=t.fontSize,this.state.fontFamily=t.fontFamily,this.pushAction(`setFont`,t.font)}get font(){return this.state.font}createLinearGradient(e,t,n,r){return fa(e,t,n,r)}createCircularGradient(e,t,n){return pa(e,t,n)}createPattern(e,t){return ma(e,t)}measureText(e){return this._measureContext===void 0&&(this._measureContext=va()),{width:ya(this._measureContext,e,this.state.font,this.state.fontSize)}}},mu=t({canvasGetImageData:()=>yu,canvasPutImageData:()=>bu,canvasToTempFilePath:()=>vu,createCanvas:()=>go,createCanvasContext:()=>gu,createContext:()=>hu,createOffscreenCanvas:()=>ho,drawCanvas:()=>_u});function hu(){return new pu}function gu(e,t){return new pu(e,Tu(t))}function _u(e={}){let t={...e,moduleId:e.moduleId||Tu(e.component)};delete t.component,Array.isArray(t.actions)&&(t.actions=t.actions.filter(e=>!e||typeof e!=`object`?!1:e.args===void 0||Array.isArray(e.args)&&!Q(e.args))),w(`drawCanvas`,t,`render`)}function vu(e={},t){let n=xu(e,t);delete n.pixelRatio;let r=Number(b.getSystemInfo()?.pixelRatio);Number.isFinite(r)&&r>0&&(n.pixelRatio=r);for(let e of[`x`,`y`,`width`,`height`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&delete n[e];for(let e of[`destWidth`,`destHeight`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&(delete n[e],$(n,`${e} must be finite`));return w(`canvasToTempFilePath`,n,`render`)}function yu(e={},t){let n=e.success,r=e.complete,i=xu(e,t);Su(i,`x`),Su(i,`y`),Cu(i,`width`),Cu(i,`height`);let a=pe(i.width,i.height,{transferable:!0});a&&$(i,a),typeof n==`function`&&(i.success=e=>n(wu(e))),typeof r==`function`&&(i.complete=e=>r(wu(e)));let o=w(`canvasGetImageData`,i,`render`);return o?.then?o.then(wu):o}function bu(e={},t){let n=xu(e,t);Su(n,`x`),Su(n,`y`),(typeof n.width!=`number`||!Number.isFinite(n.width))&&$(n,`invalid width argument`),Object.prototype.toString.call(n.data)!==`[object Uint8ClampedArray]`&&$(n,`data argument must be an Uint8ClampedArray`);let r=n.data?.length,i=typeof n.height==`number`?n.height:Math.floor(r/n.width/4);n.height=i,(!Number.isFinite(i)||n.width*i*4!==r)&&$(n,`invalid data format`);let a=pe(n.width,i,{transferable:!0});return a&&$(n,a),n.canvasValidationError||(n.data=Array.from(n.data)),w(`canvasPutImageData`,n,`render`)}function xu(e,t){let n={...e,moduleId:e.moduleId||Tu(t||e.component)};return delete n.component,n}function Su(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n}function Cu(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n,n===0&&$(e,`the source ${t} is 0`)}function $(e,t){e.canvasValidationError||=t}function wu(e){let t=Array.isArray(e)&&e.length===1?e[0]:e;return!t||!Object.prototype.hasOwnProperty.call(t,`data`)||t.data instanceof Uint8ClampedArray?t:{...t,data:new Uint8ClampedArray(t.data)}}function Tu(e){return e?.__id__||C.getPageInfo()?.id}var Eu=t({nextTick:()=>Au}),Du=[],Ou=null;function ku(){let e=Du;Du=[],Ou=null;for(let t=0;t<e.length;t++)e[t]()}function Au(e){n(e)&&(Du.push(e),Ou||=setTimeout(ku,0))}var ju=t({disableAlertBeforeUnload:()=>zu,enableAlertBeforeUnload:()=>Ru,hideLoading:()=>Lu,hideToast:()=>Nu,showActionSheet:()=>Iu,showLoading:()=>Fu,showModal:()=>Pu,showToast:()=>Mu});function Mu(e){return w(`showToast`,e)}function Nu(e){return w(`hideToast`,e)}function Pu(e){return w(`showModal`,e)}function Fu(e){return w(`showLoading`,e)}function Iu(e){return w(`showActionSheet`,e)}function Lu(e){return w(`hideLoading`,e)}function Ru(e){return w(`enableAlertBeforeUnload`,e)}function zu(e){return w(`disableAlertBeforeUnload`,e)}var Bu=t({getMenuButtonBoundingClientRect:()=>Hu,offMenuButtonBoundingClientRectWeightChange:()=>Wu,onMenuButtonBoundingClientRectWeightChange:()=>Uu}),Vu=new Set;b.onUpdate(e=>{e.menuRect&&Vu.forEach(t=>t(e.menuRect))});function Hu(){return w(`getMenuButtonBoundingClientRect`)}function Uu(e){n(e)&&Vu.add(e)}function Wu(e){n(e)?Vu.delete(e):Vu.clear()}var Gu=t({hideHomeButton:()=>Xu,hideNavigationBarLoading:()=>Yu,setNavigationBarColor:()=>Ju,setNavigationBarTitle:()=>qu,showNavigationBarLoading:()=>Ku});function Ku(e){return w(`showNavigationBarLoading`,e)}function qu(e){return w(`setNavigationBarTitle`,e)}function Ju(e){return w(`setNavigationBarColor`,e)}function Yu(e){return w(`hideNavigationBarLoading`,e)}function Xu(e){return w(`hideHomeButton`,e)}var Zu=t({startPullDownRefresh:()=>$u,stopPullDownRefresh:()=>Qu});function Qu(e){return w(`stopPullDownRefresh`,e)}function $u(e){return w(`startPullDownRefresh`,e)}var ed=t({pageScrollTo:()=>td});function td(e){return w(`pageScrollTo`,e)}var nd=t({hideTabBar:()=>od,hideTabBarRedDot:()=>ud,removeTabBarBadge:()=>cd,setTabBarBadge:()=>sd,setTabBarItem:()=>id,setTabBarStyle:()=>rd,showTabBar:()=>ad,showTabBarRedDot:()=>ld});function rd(e){return w(`setTabBarStyle`,e)}function id(e){return w(`setTabBarItem`,e)}function ad(e){return w(`showTabBar`,e)}function od(e){return w(`hideTabBar`,e)}function sd(e){return w(`setTabBarBadge`,e)}function cd(e){return w(`removeTabBarBadge`,e)}function ld(e){return w(`showTabBarRedDot`,e)}function ud(e){return w(`hideTabBarRedDot`,e)}var dd=t({onWindowResize:()=>fd});function fd(e){e&&w(`onWindowResize`,{success:e})}var pd=Object.assign({"./core/base/app-event/index.js":xt,"./core/base/index.js":hn,"./core/base/performance/index.js":bn,"./core/base/subpackage/index.js":Tn,"./core/base/system/index.js":On,"./core/base/update/index.js":Bn,"./core/camera/index.js":Jn,"./core/data-analysis/index.js":Zn,"./core/device/bluetooth/index.js":mr,"./core/device/bluetooth-ble/index.js":Ar,"./core/device/clipboard/index.js":Xr,"./core/device/contact/index.js":$r,"./core/device/keyboard/index.js":ni,"./core/device/memory/index.js":ii,"./core/device/network/index.js":gi,"./core/device/phone/index.js":xi,"./core/device/scan/index.js":Ci,"./core/device/screen/index.js":Ti,"./core/device/touch/index.js":Pi,"./core/device/vibrate/index.js":Ui,"./core/ext/index.js":Ki,"./core/file/index.js":rn,"./core/life-cycle/index.js":ms,"./core/location/index.js":_s,"./core/map/index.js":ws,"./core/media/audio/index.js":Ds,"./core/media/image/index.js":js,"./core/media/video/index.js":Bs,"./core/navigate/index.js":Js,"./core/network/download/index.js":$s,"./core/network/mdns/index.js":tc,"./core/network/request/index.js":gc,"./core/network/tcp/index.js":vc,"./core/network/udp/index.js":xc,"./core/network/upload/index.js":wc,"./core/network/websocket/index.js":kc,"./core/open-api/account-info/index.js":Tl,"./core/open-api/authorize/index.js":Dl,"./core/open-api/index.js":kl,"./core/open-api/login/index.js":jl,"./core/open-api/privacy/index.js":Nl,"./core/open-api/setting/index.js":Fl,"./core/open-api/user-info/index.js":Rl,"./core/payment/index.js":Bl,"./core/route/index.js":ht,"./core/share/index.js":Hl,"./core/storage/index.js":Kl,"./core/ui/animation/index.js":ru,"./core/ui/background/index.js":ou,"./core/ui/canvas/index.js":mu,"./core/ui/custom-component/index.js":Eu,"./core/ui/interaction/index.js":ju,"./core/ui/menu/index.js":Bu,"./core/ui/navigation-bar/index.js":Gu,"./core/ui/pull-down-refresh/index.js":Zu,"./core/ui/scroll/index.js":ed,"./core/ui/tab-bar/index.js":nd,"./core/ui/window/index.js":dd,"./core/wxml/intersection-observer/index.js":Do,"./core/wxml/media-query-observer/index.js":Ao,"./core/wxml/selector-query/index.js":bo}),md={},hd=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`,`onUnhandledRejection`,`onPageNotFound`,`onAppRoute`]);for(let e of Object.values(pd))for(let[t,n]of Object.entries(e))md[t]=n;function gd(e){for(let t of e||[])typeof t!=`string`||hd.has(t)||Object.prototype.hasOwnProperty.call(md,t)||t in Object.prototype||Object.defineProperty(md,t,{value:(...e)=>w(t,...e),writable:!0,enumerable:!0,configurable:!0})}var _d=new Proxy(md,{get(e,t,n){return hd.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),vd=new class{constructor(){this.init()}init(){globalThis.__diminaReportError=x,Xe();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{}gd(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=_d;globalThis.modRequire=_,globalThis.modDefine=ce,globalThis.global={},globalThis.App=(e={})=>{J.createAppModule(e),Y.createApp()},globalThis.Page=e=>{J.createModule(e,globalThis.__extraInfo,q.type)},globalThis.Component=e=>{J.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>Y.getApp(e),globalThis.getCurrentPages=()=>C.stack()}},yd={navigateBack:bt,navigateTo:yt,reLaunch:_t,redirectTo:vt,switchTab:gt};return new class{constructor(){console.log(`[service] init`),this.env=vd,this.message=S,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,runtimeType:l,scene:u,referrerInfo:d}=e;o&&b.init(o),Y.setRuntimeType(l),Y.setAppLaunchOptions({scene:u,pagePath:r,query:s,referrerInfo:d}),J.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c,runtimeType:l})&&Y.isMiniGame()&&Y.gameLaunch()}),this.message.on(`hostEnvUpdate`,e=>{b.update(e)}),this.message.on(`gameTouch`,({eventType:e,...t})=>{Ni(e,t)}),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 Y.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;v.invoke(t,n)}),this.message.on(`flushCallbacks`,({requestId:e})=>{this.message.invoke({type:`callbacksFlushed`,target:`container`,body:{requestId:e}})}),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=v.store(e=>s(r.success,e))),r.fail&&(o=v.store(e=>s(r.fail,e)));let c=v.store(e=>{s(r.complete,e),v.remove(a),v.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;if(Y.isMiniGame())return;let a=J.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=J.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=Y.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});S.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,e=>{Y.appShow(e)}),this.message.on(`appHide`,()=>{Y.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Y.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Y.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Y.createInstance(e)}),this.message.on(`mA`,e=>{Y.moduleAttached(e)}),this.message.on(`mR`,e=>{Y.moduleReady(e)}),this.message.on(`mU`,e=>{Y.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Y.pageUnload(e)}),this.message.on(`pageShow`,e=>{Y.pageShow(e)}),this.message.on(`pageReady`,e=>{Y.pageReady(e)}),this.message.on(`pageHide`,e=>{Y.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{Y.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{Y.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=Y.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=>{Y.pageScroll(e)}),this.message.on(`pageResize`,e=>{Y.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{Y.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Y.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Y.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 Y.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}})}yd[t]?.({url:n,...e.params})})}}})();
|
|
6
|
+
`;console.error(`require ${e} error: ${a}`),n(globalThis.__diminaReportError)&&globalThis.__diminaReportError(t),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}v.async=async e=>new Promise((t,n)=>{try{t(v(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var y=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.keep||delete this.callbacks[e],r.callback(t))}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]})}},le=33554432;le/4;var ue=Math.floor(le/4/4);function de(e){let t=Number(e);if(!Number.isFinite(t))return null;let n=Math.abs(Math.trunc(t));return Number.isSafeInteger(n)?n:null}function fe(e,t,{allowZero:n=!1,transferable:r=!1}={}){let i=de(e),a=de(t);return i===null||a===null?`pixel dimensions must be finite non-zero safe integers`:i>4096||a>4096?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:i===0||a===0?n?null:`pixel dimensions must be finite non-zero safe integers`:i>Math.floor((r?ue:8388608)/a)?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:null}function b(e,t){if(e===void 0)return t;let n=Number(e);if(!Number.isFinite(n)||n<0)return t;let r=Math.floor(n);if(!Number.isSafeInteger(r)||r>4096)throw RangeError(`canvas dimensions exceed the maximum canvas bitmap`);return r}var pe=`__dimina_data_function_reference__`,me=1;function he(e){return{[pe]:e,version:me}}function ge(e){return typeof e==`object`&&!!e&&e.version===me&&typeof e[pe]==`string`&&Object.keys(e).length===2}function _e(e){return ge(e)?e[pe]:void 0}function ve(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(ge(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]=ve(e[a],{mapFunction:t,mapReference:n},r);return i}var ye=new Set([String,Number,Boolean,Object,Array,null]);function be(e){return ye.has(e)}function xe(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function Se(e){return Array.isArray(e)?e.filter(be):[]}function Ce(e){let t,n=[],r;return be(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=Se(e.optionalTypes),r=e.value),be(t)||(t=n[0]??null),r===void 0&&(r=xe(t)),{type:t,optionalTypes:n,value:re(r)}}function we(e){return Array.isArray(e)}function Te(e){return we(e)&&e?.constructor?.name===Array.name}function Ee(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?Te(t):t!==void 0}function De(e,t){typeof e==`function`&&e(t)}function Oe(e,t,{absent:n=!1,warn:r}={}){if(n)return re(e.value);for(let n of e.optionalTypes||[])if(Ee(n,t))return t;let i=e.type;if(i===String)return t==null?(De(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&De(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 De(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?we(t)?t:(De(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(De(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var x=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 ke(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 Ae={error:[],show:[],hide:[]},je,Me=!1,Ne=!1;function Pe(e,t){return`${t}${e===`error`?`Error`:e===`show`?`AppShow`:`AppHide`}`}function Fe(e,t){if(typeof t!=`function`){console.error(`${Pe(e,`on`)} should accept a function instead of ${typeof t}`);return}Ae[e].push(t)}function Ie(e,t){if(!t){Ae[e]=[];return}if(typeof t!=`function`){console.error(`${Pe(e,`off`)} should accept a function instead of ${typeof t}`);return}Ae[e]=Ae[e].filter(e=>e!==t)}function Le(e,t,n){try{e(...t)}catch(e){Me||S(e),console.error(`[service] ${n} error:`,e)}}function Re(e,t,n){for(let r of[...Ae[e]])Le(r,t,n)}function ze(e){Fe(`error`,e)}function Be(e){Ie(`error`,e)}function Ve(e){Fe(`show`,e)}function He(e){Ie(`show`,e)}function Ue(e){Fe(`hide`,e)}function We(e){Ie(`hide`,e)}function Ge(e){Re(`show`,[e],`wx.onAppShow`)}function Ke(){Re(`hide`,[],`wx.onAppHide`)}function qe(e){je=typeof e==`function`?e:void 0}function Je(e){if(typeof e==`string`)return e;if(e?.stack)return String(e.stack);if(e?.message)return String(e.message);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function S(e){let t=Je(e);if(Me)return console.error(`[service] error handler error:`,e),t;Me=!0;try{je&&Le(je,[t],`App.onError`),Re(`error`,[t],`wx.onError`)}finally{Me=!1}return t}function Ye(){if(Ne)return;Ne=!0;let e=e=>{S(e?.error||e?.message||e)};if(typeof globalThis.addEventListener==`function`){globalThis.addEventListener(`error`,e);return}let t=globalThis.onerror;globalThis.onerror=function(n,r,i,a,o){return e(o||n),typeof t==`function`&&t.call(this,n,r,i,a,o)}}var Xe=new WeakMap,Ze=new Map;function Qe(e){let t=Xe.get(e);if(t)return Ze.set(t,e),t;let n;do n=`data-function-${p()}`;while(Ze.has(n));return Xe.set(e,n),Ze.set(n,e),n}function $e(e){return Ze.get(e)}function et(e){return ve(e,{mapFunction(e){return he(Qe(e))}})}function tt(e){return ve(e,{mapReference(e){return $e(_e(e))||e}})}var C=new class e{constructor(){this.event=ke(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){try{let t=tt(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}catch(e){S(e),console.error(`[service] message handler error:`,e)}}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=et(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=et(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 nt(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var rt={getWindowInfo:()=>nt(x.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>x.getSystemInfo(),getAppBaseInfo:()=>nt(x.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>nt(x.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>x.getMenuRect()},it=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),at=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,exitMiniProgram,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,navigateBackMiniProgram,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function ot(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function st(e,t){return it.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||at.has(e)}function ct(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 lt(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{y.remove(a),y.remove(o)};a=y.store(e=>{s(),r(e)}),o=y.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{ct(e,t,n)}catch(e){s(),i(e)}})}function ut(e,t,r){let i,a,o,s=()=>{y.remove(i),y.remove(a)},c=()=>{y.remove(o),queueMicrotask(s)};return i=y.store(e=>{s(),n(t)&&t(e)}),a=y.store(e=>{s(),n(r)&&r(e)}),e.success=i,e.fail=a,{registerComplete(t,n,r){return o=y.store(e=>{c(),t(e)},n,r),e.complete=o,o}}}function dt(e){return i(e)||e===``}function ft({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||dt(e))&&(n(t)||dt(t))}function T(e,t,r=`container`,i=!0){let a=rt[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&st(e,t))return lt(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:y.store(t,!0)};else if(ot(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;o=l,c!==void 0&&(o.evtId=c);let u;if(ft({success:e,fail:r,keep:a,evtId:c}))u=ut(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=y.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=y.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=u?u.registerComplete(i,a,c):y.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&&st(e,t))return o={...a},lt(e,o,r);o=a}try{return ct(e,o,r)}catch(e){for(let e of s)y.remove(e);throw e}}function pt(e,t,n=`container`){return T(e,t,n,!1)}var mt=t({navigateBack:()=>yt,navigateTo:()=>vt,reLaunch:()=>gt,redirectTo:()=>_t,switchTab:()=>ht});function ht(e){return e.url=te(w.getPageInfo().route,e.url),T(`switchTab`,e)}function gt(e){return e.url=te(w.getPageInfo().route,e.url),T(`reLaunch`,e)}function _t(e){let t=te(w.getPageInfo().route,e.url);if(w.getPageInfo().route!==t)return e.url=t,T(`redirectTo`,e)}function vt(e){return e.url=te(w.getPageInfo().route,e.url),T(`navigateTo`,e)}function yt(e){return T(`navigateBack`,e)}var bt=t({offAppHide:()=>Et,offAppShow:()=>Tt,offError:()=>St,offHide:()=>At,offShow:()=>Ot,onAppHide:()=>wt,onAppShow:()=>Ct,onError:()=>xt,onHide:()=>kt,onShow:()=>Dt});function xt(e){ze(e)}function St(e){Be(e)}function Ct(e){Ve(e)}function wt(e){Ue(e)}function Tt(e){He(e)}function Et(e){We(e)}function Dt(e){Ve(e)}function Ot(e){He(e)}function kt(e){Ue(e)}function At(e){We(e)}var jt=`difile://`,Mt=new Set([`about`,`blob`,`content`,`data`,`dimina`,`file`,`ftp`,`http`,`https`,`internal`,`javascript`,`resource`,`ws`,`wss`]);function Nt(e){if(typeof e!=`string`)throw TypeError(`virtualFilePrefix must be a string`);let t=e.trim().toLowerCase(),n=t.slice(0,-3);if(!/^[a-z][a-z0-9+.-]*:\/\/$/.test(t)||Mt.has(n))throw Error(`virtualFilePrefix must be a custom URI scheme ending in "://"`);return t}function Pt(e=globalThis){if(e.__VIRTUAL_FILE_PREFIX__!==void 0)return Nt(e.__VIRTUAL_FILE_PREFIX__);if(typeof e.name==`string`&&e.name)try{let t=JSON.parse(e.name);if(t&&typeof t==`object`&&t.virtualFilePrefix!==void 0)return Nt(t.virtualFilePrefix)}catch(e){if(e instanceof SyntaxError)return jt;throw e}return jt}var Ft=Pt(),It=`__diminaArrayBufferBase64`,Lt=`__diminaFileDataBase64`,Rt=`__diminaFileDataType`,E=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,zt=(()=>{let e={};for(let t=0;t<64;t++)e[E[t]]=t;return e})();function Bt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Vt(e){return e&&e.buffer&&Bt(e.buffer)}function Ht(e){return Bt(e)?e:Vt(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 Wt(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=zt[t[e]],o=zt[t[e+1]],s=t[e+2]===`=`?0:zt[t[e+2]],c=t[e+3]===`=`?0:zt[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 Gt(e){let t=Ht(e);return t?{[Rt]:`base64`,[Lt]:Ut(t)}:e}function Kt(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=Gt(n[e]));return n}function qt(e){return e&&typeof e==`object`&&e[It]!==void 0?Wt(e[It]):e}function Jt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:qt(e.data)}:e}function Yt(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:qt(r.data)}:r;return{...e,entries:t}}function Xt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[It]===void 0)return e;let r=new Uint8Array(Wt(e[It]));new Uint8Array(t).set(r,n);let{[It]:i,...a}=e;return{...a,arrayBuffer:t}}function Zt(e){let t={...e},n=Ht(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var Qt=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 $t(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function en(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if($t(e))return new Qt(e);if(Array.isArray(e))return e.map(e=>en(e));let t={};for(let[n,r]of Object.entries(e))t[n]=en(r);return t}function tn(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:en(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:en(e.statsMap)}}return en(e)}function nn(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 D(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=T(e,r(nn(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function rn(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return D(e,t,{prepare:Zt,transform:e=>Xt(e,n,r)})}var an=class{access(e){return D(`FileSystemManager.access`,e)}accessSync(e){return T(`FileSystemManager.accessSync`,e)}appendFile(e){return D(`FileSystemManager.appendFile`,e,{prepare:Kt})}appendFileSync(e,t,n){return T(`FileSystemManager.appendFileSync`,Kt({filePath:e,data:t,encoding:n}))}close(e){return D(`FileSystemManager.close`,e)}closeSync(e){return T(`FileSystemManager.closeSync`,e)}copyFile(e){return D(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return T(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return D(`FileSystemManager.fstat`,e,{transform:tn})}fstatSync(e){return tn(T(`FileSystemManager.fstatSync`,e))}ftruncate(e){return D(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return T(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return D(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return D(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return D(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return T(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return D(`FileSystemManager.open`,e)}openSync(e){return T(`FileSystemManager.openSync`,e)}read(e){return rn(`FileSystemManager.read`,e)}readSync(e){return Xt(T(`FileSystemManager.readSync`,Zt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return D(`FileSystemManager.readCompressedFile`,e,{transform:Jt})}readCompressedFileSync(e){return qt(T(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return D(`FileSystemManager.readdir`,e)}readdirSync(e){return T(`FileSystemManager.readdirSync`,e)}readFile(e){return D(`FileSystemManager.readFile`,e,{transform:Jt})}readFileSync(e,t,n,r){return qt(T(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return D(`FileSystemManager.readZipEntry`,e,{transform:Yt})}removeSavedFile(e){return D(`FileSystemManager.removeSavedFile`,e)}rename(e){return D(`FileSystemManager.rename`,e)}renameSync(e,t){return T(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return D(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return T(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return D(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return T(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return D(`FileSystemManager.stat`,e,{transform:tn})}statSync(e,t){return tn(T(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return D(`FileSystemManager.truncate`,e)}truncateSync(e,t){return T(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return D(`FileSystemManager.unlink`,e)}unlinkSync(e){return T(`FileSystemManager.unlinkSync`,e)}unzip(e){return D(`FileSystemManager.unzip`,e)}write(e){return D(`FileSystemManager.write`,e,{prepare:e=>Kt(e,[`arrayBuffer`,`data`])})}writeSync(e){return T(`FileSystemManager.writeSync`,Kt(e,[`arrayBuffer`,`data`]))}writeFile(e){return D(`FileSystemManager.writeFile`,e,{prepare:Kt})}writeFileSync(e,t,n){return T(`FileSystemManager.writeFileSync`,Kt({filePath:e,data:t,encoding:n}))}},on=Object.getOwnPropertyNames(an.prototype).filter(e=>e!==`constructor`),sn=null;function cn(){if(!sn){let e=new an;for(let t of on)e[t]=e[t].bind(e);sn=e}return sn}var ln=t({USER_DATA_PATH:()=>un,VIRTUAL_FILE_PREFIX:()=>Ft,fileSystemManagerAPINames:()=>dn,getFileSystemManager:()=>vn}),un=`${Ft}usr`,dn=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],fn=`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`,pn=`not supported by the devtools simulator (no container backend)`;function mn(e){return function(){throw Error(`FileSystemManager.${e} ${fn}`)}}function hn(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${pn}`}),t.complete?.()}}function gn(e){let t=Object.getPrototypeOf(e),n=new Set(dn),r=new Set([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]);for(let i of r)i===`constructor`||n.has(i)||typeof(Object.getOwnPropertyDescriptor(e,i)??Object.getOwnPropertyDescriptor(t,i))?.value==`function`&&(e[i]=i.endsWith(`Sync`)?mn(i):hn(i));return e}var _n;function vn(){return _n||=gn(cn()),_n}var yn=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],bn=t({canIUse:()=>wn,env:()=>xn}),xn={USER_DATA_PATH:`${Ft}usr`},Sn=new Set([`nextTick`,`onError`,`offError`,`onAppShow`,`onAppHide`,`offAppShow`,`offAppHide`,`onShow`,`offShow`,`onHide`,`offHide`,`createCanvas`,`createImage`,`onTouchStart`,`offTouchStart`,`onTouchMove`,`offTouchMove`,`onTouchEnd`,`offTouchEnd`,`onTouchCancel`,`offTouchCancel`,`getUpdateManager`,`UpdateManager`,...yn.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...dn.map(e=>`FileSystemManager.${e}`)]),Cn={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function wn(e){if(Sn.has(e))return!0;try{return T(`canIUse`,Object.hasOwn(Cn,e)?Cn[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Tn=t({getPerformance:()=>En});function En(){return Dn.getInstance()}var Dn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new On,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new kn(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}},On=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}},kn=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=y.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){T(`removePerformanceObserver`,{observerId:e.observerId},`render`),y.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 On;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&&y.remove(this.callbackId),this.observerId=null,this.callbackId=null}},An=t({loadSubpackage:()=>Mn,preDownloadSubpackage:()=>jn});function jn(e){return T(`preDownloadSubpackage`,e)}function Mn(e){return T(`loadSubpackage`,e)}var Nn=t({getAppBaseInfo:()=>Vn,getDeviceInfo:()=>Hn,getSystemInfo:()=>Rn,getSystemInfoAsync:()=>Bn,getSystemInfoSync:()=>zn,getWindowInfo:()=>In,offThemeChange:()=>Wn,onThemeChange:()=>Un,openAppAuthorizeSetting:()=>Ln,openSystemBluetoothSetting:()=>Fn}),Pn=new Set;x.onUpdate(e=>{let t=e.systemInfo?.theme;t&&Pn.forEach(e=>e({theme:t}))});function Fn(e){return T(`openSystemBluetoothSetting`,e)}function In(e){return T(`getWindowInfo`,e)}function Ln(e){return T(`openAppAuthorizeSetting`,e)}function Rn(e){return new Promise(t=>{t(T(`getSystemInfo`,e))})}function zn(){return T(`getSystemInfoSync`)}function Bn(e){return T(`getSystemInfoAsync`,e)}function Vn(){return T(`getAppBaseInfo`)}function Hn(){return T(`getDeviceInfo`)}function Un(e){n(e)&&Pn.add(e)}function Wn(e){n(e)?Pn.delete(e):Pn.clear()}var Gn=t({getUpdateManager:()=>Zn}),Kn=`onUpdateStatusChange`,qn=`updatefail`,Jn=`updateready`,Yn=`noupdate`,Xn=`updating`;function Zn(){return Qn.getInstance()}var Qn=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(Kn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===qn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Jn){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===Xn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Yn){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())}};Qn.getInstance();var $n=t({createCameraContext:()=>er});function er(){return new tr}var tr=class{takePhoto(e={}){return T(`takePhoto`,e)}startRecord(e={}){return T(`startRecordCamera`,e)}stopRecord(e={}){return T(`stopRecordCamera`,e)}},nr=t({reportAnalytics:()=>rr,reportEvent:()=>ir});function rr(...e){return T(`reportAnalytics`,e)}function ir(e,t){return T(`reportAnalytics`,{eventId:e,data:t})}var ar=`__diminaArrayBufferBase64`,O=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,or=(()=>{let e={};for(let t=0;t<64;t++)e[O[t]]=t;return e})();function sr(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function cr(e){return sr(e)?e:e&&e.buffer&&sr(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function lr(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=O[t[r]>>2],n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=O[(t[r+1]&15)<<2|t[r+2]>>6],n+=O[t[r+2]&63];return r<t.length&&(n+=O[t[r]>>2],r+1<t.length?(n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=`${O[(t[r+1]&15)<<2]}=`):n+=`${O[(t[r]&3)<<4]}==`),n}function ur(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=or[t[e]],o=or[t[e+1]],s=t[e+2]===`=`?0:or[t[e+2]],c=t[e+3]===`=`?0:or[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 dr(e){let t=cr(e);return t?{[ar]:lr(t)}:e}function fr(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?ur(e[ar]):e}function pr(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=fr(r);return{...e,advertisData:fr(e.advertisData),serviceData:t}}function mr(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(pr)}}function hr(e){return!e||typeof e!=`object`?e:{...e,value:fr(e.value)}}function gr(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 _r(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=T(e,n(gr(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function vr(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=y.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),y.remove(n),T(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())y.remove(e);return r.clear(),T(t)}}}var yr=t({closeBluetoothAdapter:()=>Mr,getBluetoothAdapterState:()=>jr,getBluetoothDevices:()=>Ar,getConnectedBluetoothDevices:()=>kr,isBluetoothDevicePaired:()=>Nr,makeBluetoothPair:()=>Pr,offBluetoothAdapterStateChange:()=>Or,offBluetoothDeviceFound:()=>Dr,onBluetoothAdapterStateChange:()=>Er,onBluetoothDeviceFound:()=>Tr,openBluetoothAdapter:()=>wr,startBluetoothDevicesDiscovery:()=>Cr,stopBluetoothDevicesDiscovery:()=>Sr}),br=vr(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,mr),xr=vr(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function Sr(e){return T(`stopBluetoothDevicesDiscovery`,e)}function Cr(e){return T(`startBluetoothDevicesDiscovery`,e)}function wr(e){return T(`openBluetoothAdapter`,e)}function Tr(e){return br.on(e)}function Er(e){return xr.on(e)}function Dr(e){return br.off(e)}function Or(e){return xr.off(e)}function kr(e){return _r(`getConnectedBluetoothDevices`,e,{transform:mr})}function Ar(e){return _r(`getBluetoothDevices`,e,{transform:mr})}function jr(e){return T(`getBluetoothAdapterState`,e)}function Mr(e){return T(`closeBluetoothAdapter`,e)}function Nr(e){return T(`isBluetoothDevicePaired`,e)}function Pr(e){return T(`makeBluetoothPair`,e)}var Fr=t({closeBLEConnection:()=>Zr,createBLEConnection:()=>Xr,getBLEDeviceCharacteristics:()=>Yr,getBLEDeviceRSSI:()=>Jr,getBLEDeviceServices:()=>qr,getBLEMTU:()=>Qr,notifyBLECharacteristicValueChange:()=>Kr,offBLECharacteristicValueChange:()=>Gr,offBLEConnectionStateChange:()=>Wr,offBLEMTUChange:()=>ei,onBLECharacteristicValueChange:()=>Ur,onBLEConnectionStateChange:()=>Hr,onBLEMTUChange:()=>$r,readBLECharacteristicValue:()=>Vr,setBLEMTU:()=>Br,writeBLECharacteristicValue:()=>zr}),Ir=vr(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Lr=vr(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,hr),Rr=vr(`onBLEMTUChange`,`offBLEMTUChange`);function zr(e){return _r(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:dr(e.value)}:e}})}function Br(e){return T(`setBLEMTU`,e)}function Vr(e){return T(`readBLECharacteristicValue`,e)}function Hr(e){return Ir.on(e)}function Ur(e){return Lr.on(e)}function Wr(e){return Ir.off(e)}function Gr(e){return Lr.off(e)}function Kr(e){return T(`notifyBLECharacteristicValueChange`,e)}function qr(e){return T(`getBLEDeviceServices`,e)}function Jr(e){return T(`getBLEDeviceRSSI`,e)}function Yr(e){return T(`getBLEDeviceCharacteristics`,e)}function Xr(e){return T(`createBLEConnection`,e)}function Zr(e){return T(`closeBLEConnection`,e)}function Qr(e){return T(`getBLEMTU`,e)}function $r(e){return Rr.on(e)}function ei(e){return Rr.off(e)}var ti=t({getClipboardData:()=>ri,setClipboardData:()=>ni});function ni(e){return T(`setClipboardData`,e)}function ri(e){return T(`getClipboardData`,e)}var ii=t({addPhoneContact:()=>oi,chooseContact:()=>ai});function ai(e){return T(`chooseContact`,e)}function oi(e){return T(`addPhoneContact`,e)}var si=t({hideKeyboard:()=>ci});function ci(e){return T(`hideKeyboard`,e)}var li=t({offMemoryWarning:()=>di,onMemoryWarning:()=>ui});function ui(e){return T(`onMemoryWarning`,e)}function di(e){return T(`offMemoryWarning`,e)}var fi=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pi=Object.fromEntries([...k].map((e,t)=>[e,t]));function mi(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function hi(e){if(mi(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 gi(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 _i(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=pi[t[e]],o=pi[t[e+1]],s=t[e+2]===`=`?0:pi[t[e+2]],c=t[e+3]===`=`?0:pi[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 vi(e){let t=hi(e);return t?{[fi]:gi(t)}:e}function yi(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:_i(t[fi])}}function bi(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function A(e,t,n={}){return T(e,{socketId:t,...n,keep:!0})}function j(e,t,n={},r=e=>e){let i=new Set,a,o,s;function c(){if(!a)return;let e=a;a=void 0,y.remove(e),o&&y.remove(o),o=void 0,T(t,{...n,callbackId:e,keep:!0})}return{on(t){if(typeof t!=`function`||(i.add(t),a))return;let c=y.store(e=>{o&&y.remove(o),o=void 0;let t=r(e);for(let e of[...i])e(t);s?.()},!0);a=c,o=y.store(()=>{a===c&&(y.remove(c),o&&y.remove(o),a=void 0,o=void 0)});try{return T(e,{...n,callbackId:c,success:c,fail:o,keep:!0})}catch(e){throw y.remove(c),o&&y.remove(o),a=void 0,o=void 0,e}},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return c()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return c();a&&y.remove(a),o&&y.remove(o),a=void 0,o=void 0},hasListeners(){return i.size>0},setAfterEmit(e){s=e}}}var xi=t({getNetworkType:()=>Ci,offNetworkStatusChange:()=>Ti,onNetworkStatusChange:()=>wi}),Si=j(`onNetworkStatusChange`,`offNetworkStatusChange`);function Ci(e){return T(`getNetworkType`,e)}function wi(e){return Si.on(e)}function Ti(e){return Si.off(e)}var Ei=t({makePhoneCall:()=>Di});function Di(e){return T(`makePhoneCall`,e)}var Oi=t({scanCode:()=>ki});function ki(e){return T(`scanCode`,e)}var Ai=t({offUserCaptureScreen:()=>Pi,onUserCaptureScreen:()=>Ni,setKeepScreenOn:()=>Fi}),ji=vr(`onUserCaptureScreen`,`offUserCaptureScreen`),Mi;function Ni(e){if(typeof e==`function`)return Mi&&Mi!==e&&ji.off(Mi),Mi=e,ji.on(e)}function Pi(e){if(typeof e!=`function`||e===Mi)return Mi=void 0,ji.off(e)}function Fi(e){return T(`setKeepScreenOn`,e)}var M={touchstart:[],touchmove:[],touchend:[],touchcancel:[]};function Ii(e,t){M[e]&&typeof t==`function`&&M[e].push(t)}function Li(e,t){if(M[e]){if(!t){M[e]=[];return}M[e]=M[e].filter(e=>e!==t)}}function Ri(e,t={}){if(M[e])for(let n of[...M[e]])try{n(t)}catch(e){S(e)}}var zi=t({offTouchCancel:()=>qi,offTouchEnd:()=>Gi,offTouchMove:()=>Ui,offTouchStart:()=>Vi,onTouchCancel:()=>Ki,onTouchEnd:()=>Wi,onTouchMove:()=>Hi,onTouchStart:()=>Bi});function Bi(e){Ii(`touchstart`,e)}function Vi(e){Li(`touchstart`,e)}function Hi(e){Ii(`touchmove`,e)}function Ui(e){Li(`touchmove`,e)}function Wi(e){Ii(`touchend`,e)}function Gi(e){Li(`touchend`,e)}function Ki(e){Ii(`touchcancel`,e)}function qi(e){Li(`touchcancel`,e)}var Ji=t({vibrateLong:()=>Xi,vibrateShort:()=>Yi});function Yi(e){return T(`vibrateShort`,e)}function Xi(e){return T(`vibrateLong`,e)}var Zi=t({extBridge:()=>Qi,extOffBridge:()=>ea,extOnBridge:()=>$i,offLoginStatusChanged:()=>na,onLoginStatusChanged:()=>ta});function Qi({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 $i({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 ea({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 ta(e){C.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function na(){C.off(`notifyLoginStatusChanged`)}var ra=new WeakSet;function ia(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!ra.has(e)){ra.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{ra.delete(e)}}S(t),console.error(`[service] ${r} error:`,t)}function N(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?ia(e,t,i):(S(t),console.error(`[service] ${i} error:`,t));return}}function P(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])N(e,a,n,r,i)}var aa=[`onLaunch`,`onShow`,`onHide`,`onError`],oa=[`globalData`],sa=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),qe(this.onError),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){aa.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)aa.includes(t)||oa.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){N(this,this.onLaunch,[this.options],`onLaunch`),N(this,this.onShow,[this.options],`onShow`),Ge(this.options)}appShow(e=this.options){N(this,this.onShow,[e],`onShow`),Ge(e)}appHide(){N(this,this.onHide,[],`onHide`),Ke()}},ca={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in ca)Object.freeze(ca[e]);var la=Object.freeze(ca),ua=[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],da=/^(([\w-]+\s)*)(\d+r?px)(\/(\d+\.?\d*(r?px)?))?\s+(.*)/,fa=/\d+\.?\d*px/,pa=/[ᄀ-ᅟ⺀-가-힣豈-︐-︙︰--⦆¢-₩]/,ma=class{constructor(e,t){this.type=e,this.data=t,this.colorStop=[]}addColorStop(e,t){this.colorStop.push([e,t])}},ha=class{constructor(e,t){this.image=e,this.repetition=t}};function ga(e){return typeof e==`string`?e:e?.src??e?._src??e}function _a(e,t,n,r){return new ma(`linear`,[e,t,n,r])}function va(e,t,n){return new ma(`radial`,[e,t,n])}function ya(e,t){if(t===void 0){console.error(`Failed to execute 'createPattern' on 'CanvasContext': 2 arguments required, but only 1 present.`);return}if(!ua.includes(t)){console.error(`Failed to execute 'createPattern' on 'CanvasContext': The provided type ('${t}') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.`);return}return new ha(ga(e),t)}function ba(e){return e instanceof ma?{__canvasStyle:`gradient`,type:e.type,data:[...e.data],colorStop:e.colorStop.map(([e,t])=>[e,t])}:e instanceof ha?{__canvasStyle:`pattern`,image:e.image,repetition:e.repetition}:e}function xa(e){let t=String(e).match(da);if(!t)return null;let n=t[1].trim().split(/\s/),r=Number.parseFloat(t[3]),i=t[7],a=[],o=`normal`,s=`normal`,c=()=>{a.push(`normal`),s=`normal`};return n.forEach((e,t)=>{[`italic`,`oblique`,`normal`].includes(e)?(a.push(e),o=e):[`bold`,`normal`].includes(e)?(a.push(e),s=e):t===0?(a.push(`normal`),o=`normal`):t===1&&c()}),n.length===1&&c(),{font:`${a.join(` `)} ${r}px ${i}`,fontStyle:o,fontWeight:s,fontSize:r,fontFamily:i}}function Sa(e,t){return String(e).replace(fa,`${t}px`)}function Ca(){try{if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(0,0).getContext(`2d`);if(typeof document<`u`&&typeof document.createElement==`function`)return document.createElement(`canvas`).getContext(`2d`)}catch{}return null}function wa(e,t,n,r){let i=String(t);if(e)try{e.font=n;let t=e.measureText(i)?.width;if(typeof t==`number`&&!Number.isNaN(t))return t}catch{}let a=typeof r==`number`&&r>0?r:10,o=0;for(let e of i)o+=pa.test(e)?1:.5;return o*a}var Ta=new Set([`2d`]),Ea=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Da=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Oa=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),ka=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Aa=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),ja=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),Ma={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Na=new Map,F=new Map,I=null,Pa=null,L={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 Fa(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function Ia(e,t){e&&t&&Na.set(e,t)}function La(e){return Na.get(e)||null}function Ra(e,t){return e&&e[Fa(t)]||null}function R(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>R(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||[]}if(e.__canvasImageData)return Ua(e.width,e.height,new Uint8ClampedArray(e.data||[]));let t={};for(let[n,r]of Object.entries(e))t[n]=R(r);return t}C.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{Ia(e,t)}),C.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{Ia(e,t)}),C.on(`pageUnload`,({bridgeId:e})=>{To(e)});var za=1,Ba=1;function Va(){let e=w.getPageInfo();return e?.bridgeId||e?.id||``}function z(e,t,n){let r=fe(e,t,n);if(r)throw RangeError(r)}var Ha=class{constructor(e,t,n){this.data=e,this.width=t,this.height=n,Object.defineProperty(this,"__diminaCanvasImageData",{value:!0})}get[Symbol.toStringTag](){return`ImageData`}};function Ua(e,t,n){let r=Math.abs(Math.trunc(Number(e))),i=Math.abs(Math.trunc(Number(t)));z(r,i);let a=n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n||r*i*4);if(a.length!==r*i*4)throw RangeError(`ImageData data length does not match its dimensions`);if(typeof globalThis.ImageData==`function`)try{return new globalThis.ImageData(a,r,i)}catch{}return new Ha(a,r,i)}function B(e,t,n){C.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function Wa(e){Promise.resolve().then(e)}function Ga(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ka(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 V(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};if(e.__diminaCanvasImageData||Object.prototype.toString.call(e)===`[object ImageData]`&&e.data instanceof Uint8ClampedArray)return z(e.width,e.height,{transferable:!0}),{__canvasImageData:!0,width:e.width,height:e.height,data:Array.from(e.data)};let t=Ka(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=>V(e));if(Ga(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=V(r);return t}return e}function H(e){return Array.from(e).map(e=>V(e))}function U(e=`canvas_resource`){return`${e}_${p()}`}var qa=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=za++,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:H(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Ja=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._pendingCallback=null,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e,this.canvas.removeCallback(this._pendingCallback);let t=this.canvas.storeCallback((e={})=>{this._pendingCallback===t&&(this._pendingCallback=null);let r=e.value||{};e.ok?(this.width=r.width||this.width,this.height=r.height||this.height,n(this.onload)&&this.onload(r)):n(this.onerror)&&this.onerror(r)});this._pendingCallback=t;try{this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,callback:t})}catch(e){throw this.canvas.removeCallback(t,e),this._pendingCallback=null,e}}},W=Symbol(`invalid canvas 2d state`),Ya={direction:new Set([`inherit`,`ltr`,`rtl`]),fontKerning:new Set([`auto`,`normal`,`none`]),fontStretch:new Set([`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`]),fontVariantCaps:new Set([`normal`,`small-caps`,`all-small-caps`,`petite-caps`,`all-petite-caps`,`unicase`,`titling-caps`]),globalCompositeOperation:new Set(`source-over.source-in.source-out.source-atop.destination-over.destination-in.destination-out.destination-atop.lighter.copy.xor.multiply.screen.overlay.darken.lighten.color-dodge.color-burn.hard-light.soft-light.difference.exclusion.hue.saturation.color.luminosity.plus-lighter`.split(`.`)),imageSmoothingQuality:new Set([`low`,`medium`,`high`]),lineCap:new Set([`butt`,`round`,`square`]),lineJoin:new Set([`round`,`bevel`,`miter`]),textAlign:new Set([`start`,`end`,`left`,`right`,`center`]),textBaseline:new Set([`top`,`hanging`,`middle`,`alphabetic`,`ideographic`,`bottom`]),textRendering:new Set([`auto`,`optimizeSpeed`,`optimizeLegibility`,`geometricPrecision`])},Xa=new Set([`lineWidth`,`miterLimit`]),Za=new Set([`shadowBlur`]),Qa=new Set([`lineDashOffset`,`shadowOffsetX`,`shadowOffsetY`]),$a=new Set([`accentcolor`,`accentcolortext`,`activetext`,`buttonborder`,`buttonface`,`buttontext`,`canvas`,`canvastext`,`field`,`fieldtext`,`graytext`,`highlight`,`highlighttext`,`linktext`,`mark`,`marktext`,`selecteditem`,`selecteditemtext`,`visitedtext`]),eo=new Set([`caption`,`icon`,`menu`,`message-box`,`small-caption`,`status-bar`]),to=`[-+]?(?:\\d*\\.?\\d+)(?:[eE][-+]?\\d+)?`,no=`(?:%|cap|ch|cm|dvh|dvw|em|ex|ic|in|lh|mm|pc|pt|px|q|rcap|rch|rem|rex|ric|rlh|svh|svw|vmax|vmin|vh|vi|vb|vw)`,ro=RegExp(`(?:^|\\s)(?:(?:xx?-small|small|medium|large|xx?-large|xxx-large|smaller|larger)|${to}${no})(?:\\s*\\/[^\\s]+)?\\s+.+$`,`i`),io=RegExp(`^(?:normal|0|${to}${no})$`,`i`),ao=RegExp(`^${to}[a-z%]*$`,`i`);function oo(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function so(e,t){let n=1,r=``;for(let i=t+1;i<e.length;i++){let t=e[i];if(r){t===r&&!oo(e,i)&&(r=``);continue}if(t===`"`||t===`'`)r=t;else if(t===`(`)n++;else if(t===`)`&&--n===0)return i+1}return-1}function co(e){let t=0,n=``;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===n&&!oo(e,r)&&(n=``);continue}if(i===`"`||i===`'`)n=i;else if(i===`(`)t++;else if(i===`)`&&--t<0)return!1}return t===0&&!n}function lo(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&!oo(e,n)&&(t=``);continue}if(r===`"`||r===`'`)t=r;else if(/^var\s*\(/i.test(e.slice(n)))return!0}return!1}function uo(e){if(typeof e!=`string`)return!1;let t=e.trim();if(!t||t.includes(`\0`)||lo(t))return!1;let n=t.toLowerCase();return n===`transparent`||n===`currentcolor`||Object.prototype.hasOwnProperty.call(la,n)||$a.has(n)||/^#[\da-f]{3,4}(?:[\da-f]{3,4})?$/i.test(t)?!0:t.includes(`(`)&&co(t)}function fo(e,t){let n=String(t).trim();if(!n||n.includes(`\0`)||lo(n))return W;if(e===`font`){let e=eo.has(n.toLowerCase())||ro.test(n);for(let t of n.matchAll(/\b(calc|clamp|max|min)\s*\(/gi)){let r=so(n,t.index+t[0].lastIndexOf(`(`));r>0&&/^(?:\s*\/[^\s]+)?\s+.+$/.test(n.slice(r))&&(e=!0)}return e||=co(n)&&/\s/.test(n),e?n:W}return e===`filter`?n===`none`||n.includes(`(`)&&co(n)?n:W:io.test(n)||ao.test(n)||n.includes(`(`)&&co(n)?n:W}function po(e,t){if(e===`globalCompositeOperation`&&String(t)===`normal`)return`source-over`;if(Ya[e]){let n=String(t);return Ya[e].has(n)?n:W}if(Xa.has(e)){let e=Number(t);return Number.isFinite(e)&&e>0?e:W}if(Za.has(e)){let e=Number(t);return Number.isFinite(e)&&e>=0?e:W}if(Qa.has(e)){let e=Number(t);return Number.isFinite(e)?e:W}if(e===`globalAlpha`){let e=Number(t);return Number.isFinite(e)&&e>=0&&e<=1?e:W}return e===`imageSmoothingEnabled`?!!t:[`font`,`filter`,`letterSpacing`,`wordSpacing`].includes(e)?fo(e,t):e===`shadowColor`?uo(t)?t:W:e===`fillStyle`||e===`strokeStyle`?typeof t==`string`&&uo(t)||t?.__canvasResourceId?t:W:t}var mo=Object.freeze({direction:`inherit`,fillStyle:`#000000`,filter:`none`,font:`10px sans-serif`,fontKerning:`auto`,fontStretch:`normal`,fontVariantCaps:`normal`,globalAlpha:1,globalCompositeOperation:`source-over`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`,letterSpacing:`0px`,lineCap:`butt`,lineDashOffset:0,lineJoin:`miter`,lineWidth:1,miterLimit:10,shadowBlur:0,shadowColor:`rgba(0, 0, 0, 0)`,shadowOffsetX:0,shadowOffsetY:0,strokeStyle:`#000000`,textAlign:`start`,textBaseline:`alphabetic`,textRendering:`auto`,wordSpacing:`0px`}),ho=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.measureContext=void 0,this.stateSequences=Object.create(null),this.state={...mo},this.confirmedState={...mo},this.confirmedStateSequences=Object.create(null),this.stateStack=[],new Proxy(this,{get(e,t){if(t in e)return typeof e[t]==`function`?e[t].bind(e):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){if(typeof n==`symbol`||!(n in e.state))return Reflect.set(e,n,r);let i=e.confirmedState[n],a=po(n,r);if(a===W)return!0;e.state[n]=a;let o=(e.stateSequences[n]||0)+1;return e.stateSequences[n]=o,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:V(a),previousValue:V(i),feedback:`state`,sequence:o}),!0}})}applyFeedback(e={}){for(let t of e.state||[]){let e=R(t.value);(this.confirmedStateSequences[t.prop]||0)<=t.sequence&&(this.confirmedState[t.prop]=e,this.confirmedStateSequences[t.prop]=t.sequence),this.stateSequences[t.prop]===t.sequence&&(this.state[t.prop]=e);for(let n of this.stateStack)n.sequences[t.prop]===t.sequence&&(n.state[t.prop]=e)}}stateSequenceSnapshot(){return Object.fromEntries(Object.keys(this.state).map(e=>[e,this.stateSequences[e]||0]))}replaceState(e,{clearStack:t=!1}={}){for(let e of Object.keys(this.state))this.stateSequences[e]=(this.stateSequences[e]||0)+1;this.state={...e},t&&(this.stateStack=[])}restoreState(e){let t=Object.create(null);for(let n of Object.keys(this.state)){if(Object.is(this.state[n],e.state[n]))continue;let r=Math.max(this.stateSequences[n]||0,e.sequences[n]||0)+1;this.stateSequences[n]=r,t[n]=r}return this.state={...e.state},t}resetStateForBitmapResize(){return this.replaceState(mo,{clearStack:!0}),this.confirmedState={...mo},this.confirmedStateSequences={...this.stateSequenceSnapshot()},this.stateSequenceSnapshot()}getImageData(e,t,n,r){return 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){let n;if(e===`save`?this.stateStack.push({state:{...this.state},sequences:this.stateSequenceSnapshot()}):e===`restore`&&this.stateStack.length>0?n=this.restoreState(this.stateStack.pop()):e===`reset`&&(n=this.resetStateForBitmapResize()),e===`measureText`){this.measureContext??=Ca();let e=xa(this.state.font)?.fontSize||10;return{width:wa(this.measureContext,t[0],this.state.font,e)}}if(e===`createImageData`)return t.length===1&&t[0]?.data instanceof Uint8ClampedArray?Ua(t[0].width,t[0].height):Ua(t[0],t[1]);let r=Da.has(e)?U():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:H(t),resultId:r,feedback:n&&Object.keys(n).length>0?`stateSnapshot`:void 0,stateSequences:n}),r)return new qa(this.canvas,r)}},go=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=U(`webgl_extension_resource`),n=new qa(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 qa)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:H(t),resultId:r}),n}},_o=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...Ma,...Ga(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(L,t))return L[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:V(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(L.VIEWPORT,[0,0,e,t]),this.state.set(L.SCISSOR_BOX,[0,0,e,t]),this.state.set(L.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(L.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(L.DEPTH_CLEAR_VALUE,1),this.state.set(L.DEPTH_WRITEMASK,!0),this.state.set(L.DEPTH_FUNC,L.LESS),this.state.set(L.STENCIL_CLEAR_VALUE,0),this.state.set(L.LINE_WIDTH,1),this.state.set(L.CULL_FACE_MODE,L.BACK),this.state.set(L.FRONT_FACE,L.CCW),this.state.set(L.ACTIVE_TEXTURE,L.TEXTURE0),this.state.set(L.PACK_ALIGNMENT,4),this.state.set(L.UNPACK_ALIGNMENT,4),this.state.set(L.CURRENT_PROGRAM,null),this.state.set(L.ARRAY_BUFFER_BINDING,null),this.state.set(L.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(L.TEXTURE_BINDING_2D,null),this.state.set(L.FRAMEBUFFER_BINDING,null),this.state.set(L.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=R(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(R(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 R(e)}queueError(e){e&&e!==L.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(H(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:H(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=U(`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 qa(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:H(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}),L.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,L.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=Oa.get(e)||ka.get(e);if(n)return this.createResource(e,t,n);if(ja.has(e)){let n=t[0];return n instanceof qa&&n.resourceType===ja.get(e)&&!n.deleted}Aa.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:H(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(L.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(L.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(L.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(L.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(L.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(L.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(L.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(L.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(L.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(L.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(L.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(L.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(L.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===L.ARRAY_BUFFER?this.state.set(L.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===L.ELEMENT_ARRAY_BUFFER&&this.state.set(L.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===L.TEXTURE_2D&&this.state.set(L.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(L.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(L.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)?R(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof qa)||e.resourceType!==`shader`)return null;switch(t){case L.DELETE_STATUS:return e.deleted;case L.SHADER_TYPE:return e.metadata.shaderType;case L.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof qa)||e.resourceType!==`program`)return null;switch(t){case L.DELETE_STATUS:return e.deleted;case L.LINK_STATUS:return!!e.metadata.linkStatus;case L.VALIDATE_STATUS:return!!e.metadata.validateStatus;case L.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=U(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new go(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},vo=class{constructor({nodeId:e,bridgeId:t=Va(),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||La(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingCallbacks=new Map,this.pendingStateFeedbacks=new Map,this.stateFeedbackByProperty=new Map,this.rafCallbacks=new Map,this.pendingOperations=[],this.flushScheduled=!1,this.disposed=!1,this._width=b(n,300),this._height=b(r,150),z(this._width,this._height,{allowZero:!0}),F.has(t)||F.set(t,new Set),F.get(t).add(this)}get width(){return this._width}reset2DStateAfterBitmapResize(){for(let[e,t]of this.contextsById){let n=t.resetStateForBitmapResize?.();n&&this.enqueueOperation({op:`contextStateSnapshot`,contextId:e,feedback:`stateSnapshot`,stateSequences:n})}}set width(e){let t=b(e,300);z(t,this._height,{allowZero:!0}),this._width=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width}),this.reset2DStateAfterBitmapResize()}get height(){return this._height}set height(e){let t=b(e,150);z(this._width,t,{allowZero:!0}),this._height=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height}),this.reset2DStateAfterBitmapResize()}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=Fa(n),i=Ea.has(n);if(!Ta.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?Ra(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=U(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:V(t)});let s=i?new _o(this,o,r,t,a):new ho(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=U(`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=R(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 Ja(this,U(`canvas_image`))}storeCallback(e,t){if(this.disposed)throw Error(`canvas node is disposed`);let n;return n=y.store(t=>{this.pendingCallbacks.delete(n),e(t)}),this.pendingCallbacks.set(n,t),n}releaseStateFeedback(e){let t=this.pendingStateFeedbacks.get(e);if(t){this.pendingStateFeedbacks.delete(e);for(let n of t)this.stateFeedbackByProperty.get(n)===e&&this.stateFeedbackByProperty.delete(n)}}removeCallback(e,t){if(!e||!this.pendingCallbacks.has(e))return;let n=this.pendingCallbacks.get(e);this.pendingCallbacks.delete(e),this.releaseStateFeedback(e),y.remove(e),n?.(t)}requestAnimationFrame(e){let t=Ba++,r=this.storeCallback(r=>{this.rafCallbacks.delete(t),n(e)&&e(r)});this.rafCallbacks.set(t,r);try{B(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r})}catch(e){throw this.removeCallback(r,e),this.rafCallbacks.delete(t),e}return t}cancelAnimationFrame(e){this.removeCallback(this.rafCallbacks.get(e)),this.rafCallbacks.delete(e),B(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){let a=fe(r,i,{transferable:!0});return a?Promise.reject(RangeError(a)):new Promise((a,o)=>{let s=this.storeCallback((e={})=>{if(!e.ok){o(Error(e.error||`canvas pixel read failed`));return}a(R(e.value))},e=>o(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s,resultEnvelope:!0})}catch(e){this.removeCallback(s,e)}})}toDataURL(e=`image/png`,t){return z(this._width,this._height,{allowZero:!0}),new Promise((n,r)=>{let i=this.storeCallback((e={})=>{if(!e.ok){r(Error(e.error||`canvas export failed`));return}n(e.value)},e=>r(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:i,resultEnvelope:!0})}catch(e){this.removeCallback(i,e)}})}dispose({notifyRender:e=!0}={}){if(this.disposed)return;this.disposed=!0;let t=Error(`canvas node disposed`);for(let e of[...this.pendingCallbacks.keys()])this.removeCallback(e,t);this.rafCallbacks.clear(),this.pendingOperations=[],this.pendingTypedArrayUpdates.clear(),this.pendingStateFeedbacks.clear(),this.stateFeedbackByProperty.clear(),this.eventListeners.clear();let n=F.get(this.bridgeId);if(n?.delete(this),n?.size===0&&F.delete(this.bridgeId),e)try{B(this.bridgeId,`disposeCanvasNodes`,{nodeIds:[this.nodeId]})}catch{}}enqueueOperation(e){if(this.disposed)throw Error(`canvas node is disposed`);this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,Wa(()=>this.flushOperations()))}compactStateFeedback(e){let t=new Set,n=(e,n={})=>{for(let[r,i]of Object.entries(n))i>0&&t.add(`${e}\0${r}\0${i}`)};for(let[e,t]of this.contextsById)if(t?.stateSequences&&(n(e,t.stateSequences),Array.isArray(t.stateStack)))for(let r of t.stateStack)n(e,r.sequences);return e.map(e=>{if(e.feedback===`state`){let n=`${e.contextId}\0${e.prop}\0${e.sequence}`;if(!t.has(n)){let t={...e};return delete t.feedback,t}}else if(e.feedback===`stateSnapshot`){let n=Object.fromEntries(Object.entries(e.stateSequences||{}).filter(([n,r])=>t.has(`${e.contextId}\0${n}\0${r}`)));if(Object.keys(n).length===0){let t={...e};return delete t.feedback,delete t.stateSequences,t}return{...e,stateSequences:n}}return e})}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.compactStateFeedback(this.pendingOperations);this.pendingOperations=[];let t=e.flatMap(e=>e.feedback===`state`?[`${e.contextId}:${e.prop}`]:e.feedback===`stateSnapshot`?Object.keys(e.stateSequences||{}).map(t=>`${e.contextId}:${t}`):[]),n=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback&&e.feedback!==`state`&&e.feedback!==`stateSnapshot`||e.typedArrayUpdateId),r;if(n||t.length>0){if(!n)for(let e of t){let t=this.stateFeedbackByProperty.get(e),n=this.pendingStateFeedbacks.get(t);n&&(n.delete(e),this.stateFeedbackByProperty.delete(e),n.size===0&&this.removeCallback(t))}if(r=this.storeCallback(e=>{this.releaseStateFeedback(r),this.applyFlushFeedback(e)}),!n){let e=new Set(t);this.pendingStateFeedbacks.set(r,e);for(let t of e)this.stateFeedbackByProperty.set(t,r)}}try{B(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:r})}catch(t){this.removeCallback(r,t);for(let n of e)this.removeCallback(n.callback,t);throw t}}};function yo(e,t=Va()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(Ia(t,e.webglCapabilities),new vo({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function bo(e,t=Va()){return Array.isArray(e)?e.map(e=>bo(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:yo(e.node,t)}:e}function xo(e={}){let t=b(e.width,300),n=b(e.height,150);z(t,n,{allowZero:!0});let r=e.type||`2d`,i=U(`offscreen_canvas`),a=Va();return B(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new vo({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:La(a)})}function So(e={}){if(I)return xo(e);let t=x.getSystemInfo()||{},n=b(e.width,t.windowWidth||300),r=b(e.height,t.windowHeight||150);z(n,r,{allowZero:!0});let i=e.type||`2d`,a=U(`game_canvas`),o=Va();return B(o,`createGameCanvas`,{nodeId:a,width:n,height:r,type:i}),I=new vo({nodeId:a,bridgeId:o,width:n,height:r,type:i,webglCapabilities:La(o)}),I}function Co(){return Pa||=xo({width:1,height:1,type:`2d`}),Pa.createImage()}function wo(){globalThis.GameGlobal=globalThis,globalThis.global=globalThis,globalThis.requestAnimationFrame=e=>{if(!I)throw Error(`requestAnimationFrame requires wx.createCanvas() first`);return I.requestAnimationFrame(e)},globalThis.cancelAnimationFrame=e=>{I?.cancelAnimationFrame(e)}}function To(e){let t=[...F.get(e)||[]],n=t.map(e=>e.nodeId);for(let e of t)e.dispose({notifyRender:!1});if(n.length>0)try{B(e,`disposeCanvasNodes`,{nodeIds:n})}catch{}F.delete(e),Na.delete(e),I?.bridgeId===e&&(I=null),Pa?.bridgeId===e&&(Pa=null)}var Eo=t({createSelectorQuery:()=>Do});function Do(){return new jo}function Oo(){return w.getPageInfo()}function ko(){let e=Oo();return e?.__id__||e?.id}function Ao(){let e=Oo();return e?.bridgeId||e?.id}var jo=class{constructor(){this.__componentId=ko(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Mo(this,this.__componentId,e,!0)}selectAll(e){return new Mo(this,this.__componentId,e,!1)}selectViewport(){return new Mo(this,ko(),``,!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=Ao();T(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=bo(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Mo=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)}},No=t({createIntersectionObserver:()=>Po});function Po(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Fo(e,{thresholds:n,initialRatio:r,observeAll:i})}var Fo=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=y.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}},Io=t({createMediaQueryObserver:()=>Ro});function Lo(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 Ro(e,t={}){return new zo(e,t)}var zo=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=y.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){T(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),y.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:Lo(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,T(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(y.remove(this._callbackId),this._callbackId=null)}};function Bo(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 Vo(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 Ho(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Uo(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=Bo(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Wo(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Ho(e.path,t)||Ho(t,e.path)}function Go(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:Uo(e.expression)}))}function Ko(e,t,r=e.data,i=e.__info__||{}){for(let a of Go(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Wo(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));N(e,a.observer,i,`data observer`)}}function qo(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Jo(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 Yo(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=Bo(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=re(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;Vo(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=[],Ko(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:qo(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Jo(e,a.changes)}}function Xo(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)?N(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&N(e,o,[c,a.oldValue,s],`property observer`))}}var Zo=new Map;function Qo(e){return Zo.has(e)||Zo.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Zo.get(e)}function $o(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return y.store(()=>{r.forEach(t=>N(e,t,[],`setData callback`))})}function es(e){let t=Qo(e);t.depth++}function ts(e){let t=Qo(e);t.depth>0&&t.depth--,t.depth===0&&rs(e)}function ns(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Bo(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(et({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function G(e,t,n,r,i=[]){let a=Qo(e),o=a.byModuleId.get(t),s=ns(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&&rs(e)}))}function rs(e){let t=Zo.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 is(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>is(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=is(n)),e),{}):e}function as(e){if(e){let t={};for(let n in e){let r=Ce(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ss),default:r.value}}return t}}var os=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ss(e){return Array.isArray(e)?e.map(e=>ss(e)):e===null||e===``?null:os.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function cs(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 ls(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]===void 0?t[r]:t.lifetimes[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 us(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 ds(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 fs(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 ps(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 ms(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!us(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&&fs(i,n)&&(o[r]=re(ps(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 hs=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],gs=[`show`,`hide`,`resize`,`routeDone`],_s=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=re(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.__pageLifetimeMethods__=Object.create(null),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,Ce(t)]))}init({deferInitialData:e=!1,deferPageLoad:t=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=Oe(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({deferPageLoad: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__=[],G(this.bridgeId,this.__id__,{},$o(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(Y.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(Y.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(Y.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),N(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),N(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){N(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=Yo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Xo(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),Xo(this,n.propertyChanges);return}let r=ms(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,$o(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)}),Xo(this,n.propertyChanges)}#u(){hs.forEach(e=>{let t=this.__info__.lifetimes?.[e]===void 0?this.__info__[e]:this.__info__.lifetimes[e];n(t)&&(this[e]=t.bind(this))}),gs.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(this.__pageLifetimeMethods__[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&&(Ko(this,e),Xo(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({deferPageLoad:e=!1}={}){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),e?this.__pageLoadPending__=!0:this.pageAttached()),this.__isComponent__&&(this.initd=!0)}pageAttached(){this.__isComponent__||this.initd||(this.__pageLoadPending__=!1,this.initd=!0,N(this,this.onLoad,[this.opts.query||{}],`onLoad`))}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 Ko(this,o),Xo(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=Oe(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=N(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 Do().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]),n=t.find(n=>us(n,this.__id__,t)&&ds(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]);return t.filter(n=>us(n,this.__id__,t)&&ds(e,n))}selectOwnerComponent(){let e=Object.values(Y.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Po(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,es(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{N(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=ms(this,Y.instances[this.bridgeId],e);G(this.bridgeId,this.__id__,e,$o(this,t),n),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];ts(this.bridgeId)}}createMediaQueryObserver(e){return Ro(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=cs(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 Y.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?Y.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=Y.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=Y.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__||(this.__componentReadied__||(this.__componentReadied__=!0,this.componentReadied()),N(this,this.onReady,[],`onReady`))}pageUnload(){this.__isComponent__||N(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;N(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||N(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||N(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return N(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||N(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){P(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),N(this,this.__pageLifetimeMethods__.show,[],`page show lifetime`),this.__isComponent__||N(this,this.onShow,[],`onShow`)}pageHide(){P(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),N(this,this.__pageLifetimeMethods__.hide,[],`page hide lifetime`),this.__isComponent__||N(this,this.onHide,[],`onHide`)}pageResize(e){P(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),N(this,this.__pageLifetimeMethods__.resize,[e],`page resize lifetime`),this.__isComponent__||N(this,this.onResize,[e],`onResize`)}componentRouteDone(){P(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),N(this,this.__pageLifetimeMethods__.routeDone,[],`page routeDone lifetime`)}componentCreated(){P(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),N(this,this.created,[],`created lifetime`)}componentAttached(){P(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),N(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){P(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),N(this,this.ready,[],`ready lifetime`)}componentMoved(){P(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),N(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,P(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),N(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(Y.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];N(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){P(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),N(this,this.error,[e],`error lifetime`,!1)}},K=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,ls(this.moduleInfo,this.behaviors),this.noReferenceData=is(this.moduleInfo.data||{})}getProps(){let e=as(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}},vs=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=re(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1,deferPageLoad:t=!1}={}){this.#e(),this.#t({deferPageLoad: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__=[],G(this.bridgeId,this.__id__,{},$o(this,e))}setData(e,t){let n=Yo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=ms(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,$o(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Do().in(this)}getTabBar(){let e=Object.values(Y.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&us(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]||{}),n=t.find(n=>us(n,this.__id__,t)&&ds(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]||{});return t.filter(n=>us(n,this.__id__,t)&&ds(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){if(e===`data`)continue;let t=this.__info__[e];this[e]=n(t)?t.bind(this):t}}#t({deferPageLoad:e=!1}={}){P(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),N(this,this.created,[],`created lifetime`),P(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),N(this,this.attached,[],`attached lifetime`),e?this.__pageLoadPending__=!0:this.pageAttached()}pageAttached(){this.initd||(this.__pageLoadPending__=!1,this.initd=!0,N(this,this.onLoad,[this.opts.query||{}],`onLoad`))}pageShow(){P(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),N(this,this.onShow,[],`onShow`)}pageHide(){P(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),N(this,this.onHide,[],`onHide`)}pageReady(){P(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),N(this,this.ready,[],`ready lifetime`),N(this,this.onReady,[],`onReady`)}pageUnload(){N(this,this.onUnload,[],`onUnload`)}pageDetached(){P(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),N(this,this.detached,[],`detached lifetime`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;N(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){N(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){N(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return N(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){N(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){P(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),N(this,this.onResize,[e],`onResize`)}},q=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,ls(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=is(this.moduleInfo.data||{})}},ys=class{static type=`app`;constructor(e){this.moduleInfo=e}},J=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o,runtimeType:s}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}return w.setInitId(n),s===`game`?(To(n),wo(),v(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0):(ce(`app`)&&v(`app`),v(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0)}createAppModule(e){let t=new ys(e);this.staticModules[ys.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))v(e);if(n===q.type){let n=new q(e,t);this.staticModules[r]=n}else if(n===K.type){let n=new K(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[ys.type]}getModuleByPath(e){return this.staticModules[e]}},Y=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.appEnterOptions={},this.instances={},this.pageStates=new Map,this.runtimeType=`miniProgram`,this.gameLaunched=!1}setRuntimeType(e){this.runtimeType=e===`game`?`game`:`miniProgram`}isMiniGame(){return this.runtimeType===`game`}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=this.normalizeAppOptions(e),this.appEnterOptions=this.appLaunchOptions)}normalizeAppOptions(e={}){let{pagePath:t,path:n=t,...r}=e||{},i={...r,path:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];return i}getAppLaunchOptions(){return this.appLaunchOptions}getAppEnterOptions(){return this.appEnterOptions}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])){let t=N(e,e[i],[a],`event ${i}`);try{return await t}catch(t){n(e.componentError)&&e.componentError(t),S(t),console.error(`[service] event ${i} error:`,t);return}}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 t=this.normalizeAppOptions(e),n=J.getAppModule();if(!n){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(n.moduleInfo,this.defaultApp),this.defaultApp={},this.appLaunchOptions=t,this.appEnterOptions=t,this.app=new sa(n,t)}appShow(e){e&&Object.keys(e).length>0&&(this.appEnterOptions=this.normalizeAppOptions(e)),this.app?this.app.appShow(this.appEnterOptions):this.isMiniGame()&&this.gameLaunched&&Ge(this.appEnterOptions)}appHide(){this.app?this.app.appHide():this.isMiniGame()&&this.gameLaunched&&Ke()}gameLaunch(){this.isMiniGame()&&!this.gameLaunched&&(this.gameLaunched=!0,Ge(this.appEnterOptions))}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,deferPageLoad:m=!1}=e,h=J.getModuleByPath(r);if(!h){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},h.type===K.type){let e=new _s(h,{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,h.isComponent||w.push(e,d),e.init({deferInitialData:p,deferPageLoad:m});let g=this.getPageState(t);return!h.isComponent&&g.pendingShow&&!g.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(h.type===q.type){let e=new vs(h,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,w.push(e,d),e.init({deferInitialData:p,deferPageLoad:m});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${h.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==K.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;let e=this.getPageState(t);e.shown&&!i.__pageShown__&&(i.__pageShown__=!0,e.ready||i.pageShow());let r=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let e of r)this.moduleAttached({bridgeId:t,moduleId:e.__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__===K.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;let n=this.getPageInstance(t);if(a.__isComponent__&&n?.__pageLoadPending__){a.__pendingReadyOpts__=e;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?.(),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__]}}}}pageAttached(e){let{bridgeId:t}=e,n=this.getPageInstance(t);if(!n?.__pageLoadPending__)return;n.pageAttached();let r=this.getPageState(t);r.pendingShow&&!r.hidden&&this.pageShow({bridgeId:t,moduleId:n.__id__}),this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__isComponent__&&e.__pendingReadyOpts__).forEach(e=>{let t=e.__pendingReadyOpts__;delete e.__pendingReadyOpts__,this.moduleReady(t)})}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__===K.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.__componentDetached__=!0,r.componentDetached()),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__===q.type?i.push(e):e.__type__===K.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__===q.type||e.__type__===K.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__===K.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__===q.type?r.push(e):e.__type__===K.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.getPageState(t);if(n.unloading)return;n.unloading=!0;let r=this.getPageInstance(t);r?.pageUnload(),this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===K.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.__componentDetached__=!0,e.componentDetached())}),r?.__type__===K.type&&!r.__componentDetached__?(r.__componentDetached__=!0,r.componentDetached()):r?.__type__===q.type&&r.pageDetached?.(),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__===q.type?r.push(e):e.__type__===K.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__===K.type&&i.componentError(r),S(r))}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===K.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__===K.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})}},bs=t({getEnterOptionsSync:()=>Ss,getLaunchOptionsSync:()=>xs});function xs(){return Y.getAppLaunchOptions()}function Ss(){return Y.getAppEnterOptions()}var Cs=t({getLocation:()=>ws,offLocationChange:()=>ks,onLocationChange:()=>Os,openLocation:()=>Es,startLocationUpdate:()=>Ts,stopLocationUpdate:()=>Ds});function ws(e){return T(`getLocation`,e)}function Ts(e){return T(`startLocationUpdate`,e)}function Es(e){return T(`openLocation`,e)}function Ds(e){return T(`stopLocationUpdate`,e)}function Os(e){e&&T(`onLocationChange`,{success:y.store(e,!0)})}function ks(e){if(e){let t=y.store(e,!0);T(`offLocationChange`,{success:t}),y.remove(t)}else T(`offLocationChange`),y.remove()}var As=t({createMapContext:()=>js});function js(e,t){return new Ms({mapId:e,obj:t})}var Ms=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})}},Ns=t({createInnerAudioContext:()=>Is}),Ps=1,Fs=class{constructor(){this._audioId=Ps++,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 Is(){return new Fs}var Ls=t({chooseImage:()=>Ws,chooseMessageFile:()=>Gs,compressImage:()=>Us,createImage:()=>Rs,getImageInfo:()=>Vs,previewImage:()=>Bs,previewMedia:()=>Hs,saveImageToPhotosAlbum:()=>zs});function Rs(){return Co()}function zs(e){return T(`saveImageToPhotosAlbum`,e)}function Bs(e){return T(`previewImage`,e)}function Vs(e){return T(`getImageInfo`,e)}function Hs(e){return T(`previewMedia`,e)}function Us(e){return T(`compressImage`,e)}function Ws(e){return T(`chooseImage`,e)}function Gs(e){return T(`chooseMessageFile`,e)}var Ks=t({chooseMedia:()=>Ys,chooseVideo:()=>Js,compressVideo:()=>Qs,createVideoContext:()=>qs,getVideoInfo:()=>Xs,saveVideoToPhotosAlbum:()=>Zs});function qs(e,t){return new $s({videoId:e,obj:t})}function Js(e){return T(`chooseVideo`,e)}function Ys(e){return T(`chooseMedia`,e)}function Xs(e){return T(`getVideoInfo`,e)}function Zs(e){return T(`saveVideoToPhotosAlbum`,e)}function Qs(e){return T(`compressVideo`,e)}var $s=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`)}},ec=t({exitMiniProgram:()=>ic,navigateBackMiniProgram:()=>rc,navigateToMiniProgram:()=>nc,restartMiniProgram:()=>tc});function tc(e){return T(`restartMiniProgram`,e)}function nc(e){return T(`navigateToMiniProgram`,e)}function rc(e){return T(`navigateBackMiniProgram`,e)}function ic(e){return T(`exitMiniProgram`,e)}var ac=t({downloadFile:()=>oc});function oc(e){return T(`downloadFile`,e)}var sc=t({offLocalServiceDiscoveryStop:()=>hc,offLocalServiceFound:()=>_c,offLocalServiceLost:()=>yc,offLocalServiceResolveFail:()=>xc,onLocalServiceDiscoveryStop:()=>mc,onLocalServiceFound:()=>gc,onLocalServiceLost:()=>vc,onLocalServiceResolveFail:()=>bc,startLocalServiceDiscovery:()=>fc,stopLocalServiceDiscovery:()=>pc}),cc=j(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),lc=j(`onLocalServiceFound`,`offLocalServiceFound`),uc=j(`onLocalServiceLost`,`offLocalServiceLost`),dc=j(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function fc(e={}){return T(`startLocalServiceDiscovery`,e)}function pc(e={}){return T(`stopLocalServiceDiscovery`,e)}function mc(e){return cc.on(e)}function hc(e){return cc.off(e)}function gc(e){return lc.on(e)}function _c(e){return lc.off(e)}function vc(e){return uc.on(e)}function yc(e){return uc.off(e)}function bc(e){return dc.on(e)}function xc(e){return dc.off(e)}var Sc=t({request:()=>Cc});function Cc(e){return T(`request`,e)}var wc=t({createTCPSocket:()=>Ec}),Tc=class{constructor(e){this.socketId=e,this.events={bindWifi:j(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:j(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:j(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:j(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:j(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},yi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return A(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=A(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return A(`TCPSocket.connect`,this.socketId,e)}write(e){return A(`TCPSocket.write`,this.socketId,{data:vi(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 Ec(){return new Tc(bi(`tcp`))}var Dc=t({createUDPSocket:()=>kc}),Oc=class{constructor(e){this.socketId=e,this.events={close:j(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:j(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:j(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:j(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},yi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return A(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=A(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return A(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return A(`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 A(e,this.socketId,{...t,message:vi(t.message)})}};function kc(){return new Oc(bi(`udp`))}var Ac=t({uploadFile:()=>Pc}),jc=1;function Mc(){return`upload_${Date.now()}_${jc++}`}function Nc(){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 Pc(e={}){let t=Mc(),n=Nc(),r=Nc(),i=y.store(e=>n.dispatch(e),!0,`${t}_progress`),a=y.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,y.remove(i),y.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 Fc=t({closeSocket:()=>Sl,connectSocket:()=>bl,onSocketClose:()=>Al,onSocketError:()=>kl,onSocketMessage:()=>Ol,onSocketOpen:()=>Dl,sendSocketMessage:()=>xl}),Ic=0,Lc=1,Rc=3,zc=5,Bc=/^wss:\/\/.*/i,Vc={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Hc={...Vc,open:[`header`]};function Uc(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:gi(e),isBuffer:!0}:{data:e}}function Wc(e,t){let n=Uc(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function Gc(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 Kc(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 qc(e){let t=Kc(e,Vc.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=_i(e.data)),t}function Jc(e){return Number.isFinite(e)?e:1e3}function Yc(e){return Number.isFinite(e)&&e>=1?e:0}function Xc(e){return Object.prototype.toString.call(e).slice(8,-1)}function Zc(e){return!!e&&typeof e==`object`}function Qc(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function $c(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function el(e){return Kc(e,[`errMsg`])}function tl(){let e;function t(t){return e=el(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function nl(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var rl=new Set,X,il={open:void 0,message:void 0,error:void 0,close:void 0},al=[],ol=!1;function sl(){ol=!1;let e=al.splice(0,al.length);for(let t of e)t()}function cl(e,{defer:t=!1}={}){if(!t&&al.length===0){e();return}al.push(e),!ol&&(ol=!0,setTimeout(sl,0))}function ll(e,t,r){let i=il[t];if(!e||!n(i))return;let a=t===`message`?r:Kc(r,Hc[t]);P(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function ul(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,y.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=y.store(e=>i(e,[...a]),!0);o=t;try{T(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,y.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var dl=new WeakMap,fl=Symbol(`SocketTask constructor token`);function Z(e){let t=dl.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function pl(e){if(rl.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function ml(e){e.connectionState=Rc,e.terminalEvent=!0}function hl(e){ml(e),pl(e)}function gl(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 _l(e,t,n){let r=Z(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||gl(r)}catch(e){throw i.remove(n),e}}function vl(e,t,n){P(void 0,t,[n],`SocketTask.${e}`,!1)}var yl=class{constructor(e,t){if(e!==fl)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Ic,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:ul(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=Lc,r.opened=!0;let i=n===X;cl(()=>{vl(`onOpen`,t,Kc(e,Vc.open)),ll(i,`open`,e)})}),message:ul(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===X,i=qc(e);cl(()=>{vl(`onMessage`,t,i),ll(r,`message`,i)})}),error:ul(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===X;r.opened?ml(r):hl(r),cl(()=>{vl(`onError`,t,Kc(e,Vc.error)),ll(i,`error`,e)},{defer:!0})}),close:ul(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===X;hl(r),cl(()=>{vl(`onClose`,t,Kc(e,Vc.close)),ll(i,`close`,e)})})},dl.set(this,r)}send(e={}){let t=Z(this),n=Zc(e)?e:{};if(t.connectionState!==Lc){$c(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Wc({socketId:t.socketId},n.data);nl(r,n,tl()),pt(`sendSocketMessage`,r)}close(e={}){let t=Z(this),n=Zc(e)?e:{},r={socketId:t.socketId,code:Jc(n.code)};n.reason!==void 0&&(r.reason=n.reason),nl(r,n,tl()),pt(`closeSocket`,r)}onOpen(e){_l(this,`open`,e)}onMessage(e){_l(this,`message`,e)}onError(e){_l(this,`error`,e)}onClose(e){_l(this,`close`,e)}};function bl(e){if(!Zc(e))return;let{url:t}=e;if(typeof t!=`string`){$c(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${Xc(t)};`});return}if(!Bc.test(t)){$c(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new yl(fl,r),a=Z(i),o=X;if((!X||Z(X).connectionState===Rc)&&(X=i),rl.size>=zc)return a.connectionState=Rc,pl(a),$c(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${zc}`}),i;rl.add(i);let s=tl(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Yc(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?Gc(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 hl(a),X===i&&(X=o),e}c.fail=e=>{hl(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{T(`connectSocket`,c),u=!0,gl(a)}catch(t){if(u)try{pt(`closeSocket`,{socketId:r,code:1e3})}catch{}hl(a),X===i&&(X=o),$c(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function xl(e){let t=Zc(e)?e:{},n=Qc(t);return!X||Z(X).connectionState!==Lc?Tl(`sendSocketMessage:fail WebSocket is not connected`,t,n):wl(`sendSocketMessage`,Wc({socketId:Z(X).socketId},t.data),t,n)}function Sl(e){let t=Zc(e)?e:{},n=Qc(t),r;if(X&&Z(X).connectionState===Lc){let e=Z(X),i=Cl(e);try{let a=Jc(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=wl(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=Tl(`closeSocket:fail WebSocket is not connected`,t,n);return r}function Cl(e){let t=e.connectionState;return e.connectionState=Rc,()=>{e.terminalEvent||(e.connectionState=t)}}function wl(e,t,r,i,a){if(!i)return T(e,t).then(e=>el(e),e=>{throw a?.(e),el(e)});let o=tl();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 Tl(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));$c(t,r)}function El(e,t){n(t)&&(il[e]=t)}function Dl(e){El(`open`,e)}function Ol(e){El(`message`,e)}function kl(e){El(`error`,e)}function Al(e){El(`close`,e)}var jl=t({getAccountInfoSync:()=>Ml});function Ml(){return T(`getAccountInfoSync`)}var Nl=t({authorize:()=>Pl});function Pl(e){return T(`authorize`,e)}var Fl=t({login:()=>Il});function Il(e){return T(`login`,e)}var Ll=t({login:()=>Rl});function Rl(e){return T(`login`,e)}var zl=t({getPrivacySetting:()=>Bl});function Bl(e){return T(`getPrivacySetting`,e)}var Vl=t({getSetting:()=>Ul,openSetting:()=>Hl});function Hl(e){return T(`openSetting`,e)}function Ul(e){return T(`getSetting`,e)}var Wl=t({getUserInfo:()=>Gl});function Gl(e){return T(`getUserInfo`,e)}var Kl=t({requestPayment:()=>ql});function ql(e){return T(`requestPayment`,e)}var Jl=t({hideShareMenu:()=>Zl,showShareImageMenu:()=>Xl,showShareMenu:()=>Yl});function Yl(e){return T(`shareShareMenu`,e)}function Xl(e){return T(`showShareImageMenu`,e)}function Zl(e){return T(`hideShareMenu`,e)}var Ql=t({clearStorage:()=>ou,clearStorageSync:()=>nu,getStorage:()=>iu,getStorageInfo:()=>cu,getStorageInfoSync:()=>su,getStorageSync:()=>eu,removeStorage:()=>au,removeStorageSync:()=>tu,setStorage:()=>ru,setStorageSync:()=>$l});function $l(...e){return T(`setStorageSync`,e)}function eu(e){return T(`getStorageSync`,e)}function tu(e){return T(`removeStorageSync`,e)}function nu(){return T(`clearStorageSync`)}function ru(e){return T(`setStorage`,e)}function iu(e){return T(`getStorage`,e)}function au(e){return T(`removeStorage`,e)}function ou(){return T(`clearStorage`)}function su(){return T(`getStorageInfoSync`)}function cu(e){return T(`getStorageInfo`,e)}var lu=t({createAnimation:()=>uu});function uu(e={}){return new du(e)}var du=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`,ne(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,ne(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,ne(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`,ne(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`,ne(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`,ne(e)]}),this}},fu=t({setBackgroundColor:()=>mu,setBackgroundTextStyle:()=>pu});function pu(e){return T(`setBackgroundTextStyle`,e)}function mu(e){return T(`setBackgroundColor`,e)}var hu=`10px sans-serif`;function gu(){return{lineDash:[0,0],lineDashOffset:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:`#000000`,font:hu,fontSize:10,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`}}function _u(e){if(Array.isArray(e))return e.map(_u);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e))t[n]=_u(e[n]);return t}return e}function vu(e){return Array.isArray(e)?e.some(vu):typeof e==`object`&&e?Object.values(e).some(vu):e===void 0||typeof e==`number`&&!Number.isFinite(e)}function Q(e){return e.some(vu)}var yu=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[],this.path=[],this.state=gu(),this.drawingState=[],this._transform={a:1,b:0,c:0,d:1,e:0,f:0}}pushAction(e,...t){return Q(t)||this.actions.push({type:e,args:t}),this}getActions(){let e=this.actions.map(_u).filter(e=>!Q(e.args));return this.actions=[],this.path=[],e}clearActions(){this.actions=[],this.path=[]}pushPathAction(e,...t){return Q(t)||this.path.push({type:e,args:t}),this}pushPathSnapshot(e){return this.pushAction(e,this.path.map(_u))}draw(e=!1,t){let n=t;n!=null&&typeof n!=`function`&&(console.warn(`CanvasContext.draw callback is not a function, got ${typeof n}`),n=void 0);let r=this.getActions();this.canvasId&&T(`drawCanvas`,{canvasId:this.canvasId,moduleId:this.moduleId,actions:r,reserve:e,complete:n},`render`)}beginPath(){return this.path=[],this}closePath(){return this.pushPathAction(`closePath`)}moveTo(e,t){return this.pushPathAction(`moveTo`,e,t)}lineTo(e,t){return this.pushPathAction(this.path.length===0?`moveTo`:`lineTo`,e,t)}rect(e,t,n,r){return this.pushPathAction(`rect`,e,t,n,r)}arcTo(e,t,n,r,i){return this.pushPathAction(`arcTo`,e,t,n,r,i)}quadraticCurveTo(e,t,n,r){return this.pushPathAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushPathAction(`bezierCurveTo`,e,t,n,r,i,a)}arc(e,t,n,r,i,a=!1){return this.pushPathAction(`arc`,e,t,n,r,i,a)}fill(){return this.pushPathSnapshot(`fillPath`)}stroke(){return this.pushPathSnapshot(`strokePath`)}clip(){return this.pushPathSnapshot(`clip`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillRect(e,t,n,r){return this.pushAction(`fillPath`,[{type:`rect`,args:[e,t,n,r]}])}strokeRect(e,t,n,r){return this.pushAction(`strokePath`,[{type:`rect`,args:[e,t,n,r]}])}fillText(e,t,n,r){return this._pushText(`fillText`,e,t,n,r)}strokeText(e,t,n,r){return this._pushText(`strokeText`,e,t,n,r)}_pushText(e,t,n,r,i){if(i!=null){let a=Number(i);if(Number.isFinite(a))return this.pushAction(e,String(t),n,r,a)}return this.pushAction(e,String(t),n,r)}drawImage(e,...t){let n=ga(e),[r,i,a,o,s,c,l,u]=t;u===void 0&&([s,c,l,u]=[r,i,a,o],r=void 0,i=void 0,a=void 0,o=void 0);let d=e=>Number.isFinite(e);return d(r)&&d(i)&&d(a)&&d(o)?this.pushAction(`drawImage`,n,r,i,a,o,s,c,l,u):d(l)&&d(u)?this.pushAction(`drawImage`,n,s,c,l,u):this.pushAction(`drawImage`,n,s,c)}rotate(e){return this.pushAction(`rotate`,e)}translate(e,t){return this.pushAction(`translate`,e,t)}scale(e,t){if(Q([e,t]))return this;let n=this._transform;return this._transform={a:n.a*e,b:n.b*e,c:n.c*t,d:n.d*t,e:n.e,f:n.f},this.pushAction(`scale`,e,t)}transform(e,t,n,r,i,a){if(Q([e,t,n,r,i,a]))return this;let o=this._transform;return this._transform={a:e*o.a+t*o.c,b:e*o.b+t*o.d,c:n*o.a+r*o.c,d:n*o.b+r*o.d,e:i*o.a+a*o.c+o.e,f:i*o.b+a*o.d+o.f},this.pushAction(`transform`,e,t,n,r,i,a)}setTransform(e,t,n,r,i,a){return Q([e,t,n,r,i,a])?this:(this._transform={a:e,b:t,c:n,d:r,e:i,f:a},this.pushAction(`setTransform`,e,t,n,r,i,a))}getTransform(){return this._transform}save(){return this.drawingState.push(this.state),this.pushAction(`save`)}restore(){return this.state=this.drawingState.pop()||gu(),this.pushAction(`restore`)}setFillStyle(e){return this.pushAction(`setFillStyle`,ba(e))}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,ba(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)}setTextAlign(e){return this.pushAction(`setTextAlign`,e)}setTextBaseline(e){return this.pushAction(`setTextBaseline`,e)}setShadow(e,t,n,r){return Q([e,t,n])?this:(this.state.shadowOffsetX=e,this.state.shadowOffsetY=t,this.state.shadowBlur=n,this.state.shadowColor=r,this.pushAction(`setShadow`,e,t,n,r))}setFontSize(e){let t=Number(e);return Number.isFinite(t)?(this.state.font=Sa(this.state.font,t),this.state.fontSize=t,this.pushAction(`setFontSize`,t)):this}setLineDash(e,t){let n=Array.isArray(e)&&e.length?e:[0,0],r=t??0;return Q([n,r])?this:(this.state.lineDash=n,this.state.lineDashOffset=r,this.pushAction(`setLineDash`,n,r))}getLineDash(){return this.state.lineDash}set fillStyle(e){this.setFillStyle(e)}set strokeStyle(e){this.setStrokeStyle(e)}set globalAlpha(e){this.setGlobalAlpha(e)}set lineCap(e){this.setLineCap(e)}set lineJoin(e){this.setLineJoin(e)}set lineWidth(e){this.setLineWidth(e)}set miterLimit(e){this.setMiterLimit(e)}set textAlign(e){this.setTextAlign(e)}set textBaseline(e){this.setTextBaseline(e)}set globalCompositeOperation(e){this.pushAction(`setGlobalCompositeOperation`,e)}set lineDashOffset(e){Q([e])||(this.state.lineDashOffset=e,this.pushAction(`setLineDashOffset`,e))}set shadowBlur(e){Q([e])||(this.state.shadowBlur=e,this.pushAction(`setShadowBlur`,e))}set shadowColor(e){this.state.shadowColor=e,this.pushAction(`setShadowColor`,e)}set shadowOffsetX(e){Q([e])||(this.state.shadowOffsetX=e,this.pushAction(`setShadowOffsetX`,e))}set shadowOffsetY(e){Q([e])||(this.state.shadowOffsetY=e,this.pushAction(`setShadowOffsetY`,e))}set font(e){this.state.font=e;let t=xa(e);if(!t){console.warn(`Failed to set 'font' on 'CanvasContext': invalid format.`);return}this.state.fontStyle=t.fontStyle,this.state.fontWeight=t.fontWeight,this.state.fontSize=t.fontSize,this.state.fontFamily=t.fontFamily,this.pushAction(`setFont`,t.font)}get font(){return this.state.font}createLinearGradient(e,t,n,r){return _a(e,t,n,r)}createCircularGradient(e,t,n){return va(e,t,n)}createPattern(e,t){return ya(e,t)}measureText(e){return this._measureContext===void 0&&(this._measureContext=Ca()),{width:wa(this._measureContext,e,this.state.font,this.state.fontSize)}}},bu=t({canvasGetImageData:()=>Tu,canvasPutImageData:()=>Eu,canvasToTempFilePath:()=>wu,createCanvas:()=>So,createCanvasContext:()=>Su,createContext:()=>xu,createOffscreenCanvas:()=>xo,drawCanvas:()=>Cu});function xu(){return new yu}function Su(e,t){return new yu(e,ju(t))}function Cu(e={}){let t={...e,moduleId:e.moduleId||ju(e.component)};delete t.component,Array.isArray(t.actions)&&(t.actions=t.actions.filter(e=>!e||typeof e!=`object`?!1:e.args===void 0||Array.isArray(e.args)&&!Q(e.args))),T(`drawCanvas`,t,`render`)}function wu(e={},t){let n=Du(e,t);delete n.pixelRatio;let r=Number(x.getSystemInfo()?.pixelRatio);Number.isFinite(r)&&r>0&&(n.pixelRatio=r);for(let e of[`x`,`y`,`width`,`height`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&delete n[e];for(let e of[`destWidth`,`destHeight`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&(delete n[e],$(n,`${e} must be finite`));return T(`canvasToTempFilePath`,n,`render`)}function Tu(e={},t){let n=e.success,r=e.complete,i=Du(e,t);Ou(i,`x`),Ou(i,`y`),ku(i,`width`),ku(i,`height`);let a=fe(i.width,i.height,{transferable:!0});a&&$(i,a),typeof n==`function`&&(i.success=e=>n(Au(e))),typeof r==`function`&&(i.complete=e=>r(Au(e)));let o=T(`canvasGetImageData`,i,`render`);return o?.then?o.then(Au):o}function Eu(e={},t){let n=Du(e,t);Ou(n,`x`),Ou(n,`y`),(typeof n.width!=`number`||!Number.isFinite(n.width))&&$(n,`invalid width argument`),Object.prototype.toString.call(n.data)!==`[object Uint8ClampedArray]`&&$(n,`data argument must be an Uint8ClampedArray`);let r=n.data?.length,i=typeof n.height==`number`?n.height:Math.floor(r/n.width/4);n.height=i,(!Number.isFinite(i)||n.width*i*4!==r)&&$(n,`invalid data format`);let a=fe(n.width,i,{transferable:!0});return a&&$(n,a),n.canvasValidationError?delete n.data:n.data=Array.from(n.data),T(`canvasPutImageData`,n,`render`)}function Du(e,t){let n={...e,moduleId:e.moduleId||ju(t||e.component)};return delete n.component,n}function Ou(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n}function ku(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n,n===0&&$(e,`the source ${t} is 0`)}function $(e,t){e.canvasValidationError||=t}function Au(e){let t=Array.isArray(e)&&e.length===1?e[0]:e;return!t||!Object.prototype.hasOwnProperty.call(t,`data`)||t.data instanceof Uint8ClampedArray?t:{...t,data:new Uint8ClampedArray(t.data)}}function ju(e){return e?.__id__||w.getPageInfo()?.id}var Mu=t({nextTick:()=>Iu}),Nu=[],Pu=null;function Fu(){let e=Nu;Nu=[],Pu=null;for(let t=0;t<e.length;t++)e[t]()}function Iu(e){n(e)&&(Nu.push(e),Pu||=setTimeout(Fu,0))}var Lu=t({disableAlertBeforeUnload:()=>Gu,enableAlertBeforeUnload:()=>Wu,hideLoading:()=>Uu,hideToast:()=>zu,showActionSheet:()=>Hu,showLoading:()=>Vu,showModal:()=>Bu,showToast:()=>Ru});function Ru(e){return T(`showToast`,e)}function zu(e){return T(`hideToast`,e)}function Bu(e){return T(`showModal`,e)}function Vu(e){return T(`showLoading`,e)}function Hu(e){return T(`showActionSheet`,e)}function Uu(e){return T(`hideLoading`,e)}function Wu(e){return T(`enableAlertBeforeUnload`,e)}function Gu(e){return T(`disableAlertBeforeUnload`,e)}var Ku=t({getMenuButtonBoundingClientRect:()=>Ju,offMenuButtonBoundingClientRectWeightChange:()=>Xu,onMenuButtonBoundingClientRectWeightChange:()=>Yu}),qu=new Set;x.onUpdate(e=>{e.menuRect&&qu.forEach(t=>t(e.menuRect))});function Ju(){return T(`getMenuButtonBoundingClientRect`)}function Yu(e){n(e)&&qu.add(e)}function Xu(e){n(e)?qu.delete(e):qu.clear()}var Zu=t({hideHomeButton:()=>nd,hideNavigationBarLoading:()=>td,setNavigationBarColor:()=>ed,setNavigationBarTitle:()=>$u,showNavigationBarLoading:()=>Qu});function Qu(e){return T(`showNavigationBarLoading`,e)}function $u(e){return T(`setNavigationBarTitle`,e)}function ed(e){return T(`setNavigationBarColor`,e)}function td(e){return T(`hideNavigationBarLoading`,e)}function nd(e){return T(`hideHomeButton`,e)}var rd=t({startPullDownRefresh:()=>ad,stopPullDownRefresh:()=>id});function id(e){return T(`stopPullDownRefresh`,e)}function ad(e){return T(`startPullDownRefresh`,e)}var od=t({pageScrollTo:()=>sd});function sd(e){return T(`pageScrollTo`,e)}var cd=t({hideTabBar:()=>fd,hideTabBarRedDot:()=>gd,removeTabBarBadge:()=>md,setTabBarBadge:()=>pd,setTabBarItem:()=>ud,setTabBarStyle:()=>ld,showTabBar:()=>dd,showTabBarRedDot:()=>hd});function ld(e){return T(`setTabBarStyle`,e)}function ud(e){return T(`setTabBarItem`,e)}function dd(e){return T(`showTabBar`,e)}function fd(e){return T(`hideTabBar`,e)}function pd(e){return T(`setTabBarBadge`,e)}function md(e){return T(`removeTabBarBadge`,e)}function hd(e){return T(`showTabBarRedDot`,e)}function gd(e){return T(`hideTabBarRedDot`,e)}var _d=t({onWindowResize:()=>vd});function vd(e){e&&T(`onWindowResize`,{success:e})}var yd=Object.assign({"./core/base/app-event/index.js":bt,"./core/base/index.js":bn,"./core/base/performance/index.js":Tn,"./core/base/subpackage/index.js":An,"./core/base/system/index.js":Nn,"./core/base/update/index.js":Gn,"./core/camera/index.js":$n,"./core/data-analysis/index.js":nr,"./core/device/bluetooth/index.js":yr,"./core/device/bluetooth-ble/index.js":Fr,"./core/device/clipboard/index.js":ti,"./core/device/contact/index.js":ii,"./core/device/keyboard/index.js":si,"./core/device/memory/index.js":li,"./core/device/network/index.js":xi,"./core/device/phone/index.js":Ei,"./core/device/scan/index.js":Oi,"./core/device/screen/index.js":Ai,"./core/device/touch/index.js":zi,"./core/device/vibrate/index.js":Ji,"./core/ext/index.js":Zi,"./core/file/index.js":ln,"./core/life-cycle/index.js":bs,"./core/location/index.js":Cs,"./core/map/index.js":As,"./core/media/audio/index.js":Ns,"./core/media/image/index.js":Ls,"./core/media/video/index.js":Ks,"./core/navigate/index.js":ec,"./core/network/download/index.js":ac,"./core/network/mdns/index.js":sc,"./core/network/request/index.js":Sc,"./core/network/tcp/index.js":wc,"./core/network/udp/index.js":Dc,"./core/network/upload/index.js":Ac,"./core/network/websocket/index.js":Fc,"./core/open-api/account-info/index.js":jl,"./core/open-api/authorize/index.js":Nl,"./core/open-api/index.js":Fl,"./core/open-api/login/index.js":Ll,"./core/open-api/privacy/index.js":zl,"./core/open-api/setting/index.js":Vl,"./core/open-api/user-info/index.js":Wl,"./core/payment/index.js":Kl,"./core/route/index.js":mt,"./core/share/index.js":Jl,"./core/storage/index.js":Ql,"./core/ui/animation/index.js":lu,"./core/ui/background/index.js":fu,"./core/ui/canvas/index.js":bu,"./core/ui/custom-component/index.js":Mu,"./core/ui/interaction/index.js":Lu,"./core/ui/menu/index.js":Ku,"./core/ui/navigation-bar/index.js":Zu,"./core/ui/pull-down-refresh/index.js":rd,"./core/ui/scroll/index.js":od,"./core/ui/tab-bar/index.js":cd,"./core/ui/window/index.js":_d,"./core/wxml/intersection-observer/index.js":No,"./core/wxml/media-query-observer/index.js":Io,"./core/wxml/selector-query/index.js":Eo}),bd={},xd=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`,`onUnhandledRejection`,`onPageNotFound`,`onAppRoute`]);for(let e of Object.values(yd))for(let[t,n]of Object.entries(e))bd[t]=n;function Sd(e){for(let t of e||[])typeof t!=`string`||xd.has(t)||Object.prototype.hasOwnProperty.call(bd,t)||t in Object.prototype||Object.defineProperty(bd,t,{value:(...e)=>T(t,...e),writable:!0,enumerable:!0,configurable:!0})}var Cd=new Proxy(bd,{get(e,t,n){return xd.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),wd=new class{constructor(){this.init()}init(){globalThis.__diminaReportError=S,Ye();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{}Sd(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=Cd;globalThis.modRequire=v,globalThis.modDefine=se,globalThis.global={},globalThis.App=(e={})=>{J.createAppModule(e),Y.createApp()},globalThis.Page=e=>{J.createModule(e,globalThis.__extraInfo,q.type)},globalThis.Component=e=>{J.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>Y.getApp(e),globalThis.getCurrentPages=()=>w.stack()}},Td={navigateBack:yt,navigateTo:vt,reLaunch:gt,redirectTo:_t,switchTab:ht};return new class{constructor(){console.log(`[service] init`),this.env=wd,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,runtimeType:l,scene:u,referrerInfo:d}=e;o&&x.init(o),Y.setRuntimeType(l),Y.setAppLaunchOptions({scene:u,pagePath:r,query:s,referrerInfo:d}),J.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c,runtimeType:l})&&Y.isMiniGame()&&Y.gameLaunch()}),this.message.on(`hostEnvUpdate`,e=>{x.update(e)}),this.message.on(`gameTouch`,({eventType:e,...t})=>{Ri(e,t)}),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 Y.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;y.invoke(t,n)}),this.message.on(`flushCallbacks`,({requestId:e})=>{this.message.invoke({type:`callbacksFlushed`,target:`container`,body:{requestId:e}})}),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=y.store(e=>s(r.success,e))),r.fail&&(o=y.store(e=>s(r.fail,e)));let c=y.store(e=>{s(r.complete,e),y.remove(a),y.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,resourceLoadId:i,stackId:a}=e;if(Y.isMiniGame())return;let o=J.getModuleByPath(n);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let s=J.getPropsByPath(o.usingComponents),c=`page_${p()}`,l=Y.createInstance({bridgeId:t,moduleId:c,path:n,query:r,stackId:a,deferInitialData:!0,deferPageLoad:!0});C.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:c,pagePath:n,initialProps:s,query:r,resourceLoadId:i}}),l?.sendInitialData()}),this.message.on(`appShow`,e=>{Y.appShow(e)}),this.message.on(`appHide`,()=>{Y.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Y.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Y.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Y.createInstance(e)}),this.message.on(`mA`,e=>{Y.moduleAttached(e)}),this.message.on(`mR`,e=>{Y.moduleReady(e)}),this.message.on(`mU`,e=>{Y.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Y.pageUnload(e)}),this.message.on(`pageShow`,e=>{Y.pageShow(e)}),this.message.on(`pageReady`,e=>{Y.pageReady(e)}),this.message.on(`pageAttached`,e=>{Y.pageAttached(e)}),this.message.on(`pageHide`,e=>{Y.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{Y.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{Y.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=Y.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=>{Y.pageScroll(e)}),this.message.on(`pageResize`,e=>{Y.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{Y.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Y.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Y.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 Y.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}})}Td[t]?.({url:n,...e.params})})}}})();
|