@dimina-kit/devkit 0.1.2-dev.20260718095333 → 0.1.2-dev.20260728063215
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/fe/dimina-fe-container/assets/index.css +1 -1
- package/fe/dimina-fe-container/assets/index.js +7 -6
- package/fe/dimina-fe-container/assets/pageFrame.js +3 -3
- package/fe/dimina-fe-container/assets/service.js +2 -2
- package/fe/dimina-fe-container/dimina-version.json +2 -2
- package/package.json +2 -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 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
|
|
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 v(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function y(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 ne={},re=1,ie=2;function ae(e,t){ne[e]||(ne[e]={factory:t,status:re,exports:void 0})}function b(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ne[e];if(!i)throw Error(`module ${e} not found`);if(i.status===re){i.status=ie;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,b,t,t.exports))}catch(t){i.status=re;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(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}x.async=async e=>new Promise((t,n)=>{try{t(x(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var S=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},ae=`__dimina_data_function_reference__`,oe=1;function se(e){return{[ae]:e,version:oe}}function ce(e){return typeof e==`object`&&!!e&&e.version===oe&&typeof e[ae]==`string`&&Object.keys(e).length===2}function le(e){return ce(e)?e[ae]:void 0}function ue(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(ce(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]=ue(e[a],{mapFunction:t,mapReference:n},r);return i}var de=new Set([String,Number,Boolean,Object,Array,null]);function fe(e){return de.has(e)}function pe(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function me(e){return Array.isArray(e)?e.filter(fe):[]}function he(e){let t,n=[],r;return fe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=me(e.optionalTypes),r=e.value),fe(t)||(t=n[0]??null),r===void 0&&(r=pe(t)),{type:t,optionalTypes:n,value:b(r)}}function ge(e){return Array.isArray(e)}function _e(e){return ge(e)&&e?.constructor?.name===Array.name}function ve(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?_e(t):t!==void 0}function C(e,t){typeof e==`function`&&e(t)}function ye(e,t,{absent:n=!1,warn:r}={}){if(n)return b(e.value);for(let n of e.optionalTypes||[])if(ve(n,t))return t;let i=e.type;if(i===String)return t==null?(C(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&C(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 C(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?ge(t)?t:(C(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(C(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var w=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 be(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 xe=new WeakMap,Se=new Map;function Ce(e){let t=xe.get(e);if(t)return Se.set(t,e),t;let n;do n=`data-function-${p()}`;while(Se.has(n));return xe.set(e,n),Se.set(n,e),n}function we(e){return Se.get(e)}function Te(e){return ue(e,{mapFunction(e){return se(Ce(e))}})}function Ee(e){return ue(e,{mapReference(e){return we(le(e))||e}})}var T=new class e{constructor(){this.event=be(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){let t=Ee(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=Te(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=Te(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)}},E=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()}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}else{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function De(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var Oe={getWindowInfo:()=>De(w.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>w.getSystemInfo(),getAppBaseInfo:()=>De(w.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>De(w.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>w.getMenuRect()},ke=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),Ae=new Set(`FileSystemManager.getSavedFileList,clearStorage,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function je(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function Me(e,t){return ke.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||Ae.has(e)}function Ne(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:E.getPageInfo().id,params:t}};return n===`container`?T.invoke(r):T.send(r)}function Pe(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{S.remove(a),S.remove(o)};a=S.store(e=>{s(),r(e)}),o=S.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{Ne(e,t,n)}catch(e){s(),i(e)}})}function D(e,t,r=`container`){let i=Oe[e];if(r===`container`&&i){let e=i();if(e)return e}let a;if(t===void 0){if(Me(e,t))return Pe(e,{},r);a=t}else if(typeof t==`string`||Array.isArray(t))a=t;else if(n(t))a={success:S.store(t,!0)};else if(je(t)){let{success:e,fail:r,complete:i,keep:o,evtId:s,...c}=t;a=c,s!==void 0&&(a.evtId=s),n(e)?a.success=S.store(e,o,s):a.success=e,n(r)&&(a.fail=S.store(r,o,s)),n(i)&&(a.complete=S.store(i,o,s))}else{let{keep:n,...i}=t;if(delete i.evtId,!n&&Me(e,t))return a={...i},Pe(e,a,r);a=i}return Ne(e,a,r)}var Fe=t({navigateBack:()=>Be,navigateTo:()=>ze,reLaunch:()=>Le,redirectTo:()=>Re,switchTab:()=>Ie});function Ie(e){return e.url=v(E.getPageInfo().route,e.url),D(`switchTab`,e)}function Le(e){return e.url=v(E.getPageInfo().route,e.url),D(`reLaunch`,e)}function Re(e){let t=v(E.getPageInfo().route,e.url);if(E.getPageInfo().route!==t)return e.url=t,D(`redirectTo`,e)}function ze(e){return e.url=v(E.getPageInfo().route,e.url),D(`navigateTo`,e)}function Be(e){return D(`navigateBack`,e)}var Ve=t({offAppHide:()=>qe,offAppShow:()=>Ke,offError:()=>Ue,onAppHide:()=>Ge,onAppRoute:()=>Xe,onAppShow:()=>We,onError:()=>He,onPageNotFound:()=>Ye,onUnhandledRejection:()=>Je});function He(e){return D(`onError`,e)}function Ue(e){return D(`offError`,e)}function We(e){return D(`onAppShow`,e)}function Ge(e){return D(`onAppHide`,e)}function Ke(e){return D(`offAppShow`,e)}function qe(e){return D(`offAppHide`,e)}function Je(){}function Ye(){}function Xe(){}var Ze=t({USER_DATA_PATH:()=>Qe,fileSystemManagerAPINames:()=>tt,getFileSystemManager:()=>rt}),Qe=`difile://`,$e=`not supported by the dimina runtime`;function O(e){throw Error(`FileSystemManager.${e} ${$e}`)}function k(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${$e}`}),r?.()}var et=class{access(e){k(`access`,e)}accessSync(){O(`accessSync`)}stat(e){k(`stat`,e)}statSync(){O(`statSync`)}readFile(e){k(`readFile`,e)}readFileSync(){O(`readFileSync`)}writeFile(e){k(`writeFile`,e)}writeFileSync(){O(`writeFileSync`)}appendFile(e){k(`appendFile`,e)}appendFileSync(){O(`appendFileSync`)}copyFile(e){k(`copyFile`,e)}copyFileSync(){O(`copyFileSync`)}rename(e){k(`rename`,e)}renameSync(){O(`renameSync`)}unlink(e){k(`unlink`,e)}unlinkSync(){O(`unlinkSync`)}mkdir(e){k(`mkdir`,e)}mkdirSync(){O(`mkdirSync`)}rmdir(e){k(`rmdir`,e)}rmdirSync(){O(`rmdirSync`)}readdir(e){k(`readdir`,e)}readdirSync(){O(`readdirSync`)}getFileInfo(e){k(`getFileInfo`,e)}saveFile(e){k(`saveFile`,e)}saveFileSync(){O(`saveFileSync`)}getSavedFileList(e){k(`getSavedFileList`,e)}removeSavedFile(e){k(`removeSavedFile`,e)}truncate(e){k(`truncate`,e)}truncateSync(){O(`truncateSync`)}unzip(e){k(`unzip`,e)}open(e){k(`open`,e)}openSync(){O(`openSync`)}close(e){k(`close`,e)}closeSync(){O(`closeSync`)}read(e){k(`read`,e)}readSync(){O(`readSync`)}write(e){k(`write`,e)}writeSync(){O(`writeSync`)}fstat(e){k(`fstat`,e)}fstatSync(){O(`fstatSync`)}ftruncate(e){k(`ftruncate`,e)}ftruncateSync(){O(`ftruncateSync`)}readCompressedFile(e){k(`readCompressedFile`,e)}readCompressedFileSync(){O(`readCompressedFileSync`)}readZipEntry(e){k(`readZipEntry`,e)}},tt=Object.getOwnPropertyNames(et.prototype).filter(e=>e!==`constructor`),nt;function rt(){return nt||=new et,nt}var it=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],at=t({canIUse:()=>lt,env:()=>ot}),ot={USER_DATA_PATH:`difile://usr`},st=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,...it.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...tt.map(e=>`FileSystemManager.${e}`)]),ct={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function lt(e){if(st.has(e))return!0;try{return D(`canIUse`,Object.hasOwn(ct,e)?ct[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var ut=t({getPerformance:()=>dt});function dt(){return ft.getInstance()}var ft=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new pt,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new mt(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}},pt=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}},mt=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=S.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){D(`removePerformanceObserver`,{observerId:e.observerId},`render`),S.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),D(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new pt;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&&D(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&S.remove(this.callbackId),this.observerId=null,this.callbackId=null}},ht=t({loadSubpackage:()=>_t,preDownloadSubpackage:()=>gt});function gt(e){return D(`preDownloadSubpackage`,e)}function _t(e){return D(`loadSubpackage`,e)}var vt=t({getAppBaseInfo:()=>Et,getDeviceInfo:()=>Dt,getSystemInfo:()=>Ct,getSystemInfoAsync:()=>Tt,getSystemInfoSync:()=>wt,getWindowInfo:()=>xt,offThemeChange:()=>kt,onThemeChange:()=>Ot,openAppAuthorizeSetting:()=>St,openSystemBluetoothSetting:()=>bt}),yt=new Set;w.onUpdate(e=>{let t=e.systemInfo?.theme;t&&yt.forEach(e=>e({theme:t}))});function bt(e){return D(`openSystemBluetoothSetting`,e)}function xt(e){return D(`getWindowInfo`,e)}function St(e){return D(`openAppAuthorizeSetting`,e)}function Ct(e){return new Promise(t=>{t(D(`getSystemInfo`,e))})}function wt(){return D(`getSystemInfoSync`)}function Tt(e){return D(`getSystemInfoAsync`,e)}function Et(){return D(`getAppBaseInfo`)}function Dt(){return D(`getDeviceInfo`)}function Ot(e){n(e)&&yt.add(e)}function kt(e){n(e)?yt.delete(e):yt.clear()}var At=t({getUpdateManager:()=>It}),jt=`onUpdateStatusChange`,Mt=`updatefail`,Nt=`updateready`,Pt=`noupdate`,Ft=`updating`;function It(){return Lt.getInstance()}var Lt=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=[],T.on(jt,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===Mt){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Nt){this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),this.emit(this.updateReadyListeners);return}if(t===Ft){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Pt){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,D(`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())}};Lt.getInstance();var Rt=t({createCameraContext:()=>zt});function zt(){return new Bt}var Bt=class{takePhoto(e={}){return D(`takePhoto`,e)}startRecord(e={}){return D(`startRecordCamera`,e)}stopRecord(e={}){return D(`stopRecordCamera`,e)}},Vt=t({reportAnalytics:()=>Ht,reportEvent:()=>Ut});function Ht(...e){return D(`reportAnalytics`,e)}function Ut(e,t){return D(`reportAnalytics`,{eventId:e,data:t})}var Wt=`__diminaArrayBufferBase64`,A=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Gt=(()=>{let e={};for(let t=0;t<64;t++)e[A[t]]=t;return e})();function Kt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function qt(e){return Kt(e)?e:e&&e.buffer&&Kt(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Jt(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=A[t[r]>>2],n+=A[(t[r]&3)<<4|t[r+1]>>4],n+=A[(t[r+1]&15)<<2|t[r+2]>>6],n+=A[t[r+2]&63];return r<t.length&&(n+=A[t[r]>>2],r+1<t.length?(n+=A[(t[r]&3)<<4|t[r+1]>>4],n+=`${A[(t[r+1]&15)<<2]}=`):n+=`${A[(t[r]&3)<<4]}==`),n}function Yt(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=Gt[t[e]],o=Gt[t[e+1]],s=t[e+2]===`=`?0:Gt[t[e+2]],c=t[e+3]===`=`?0:Gt[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 Xt(e){let t=qt(e);return t?{[Wt]:Jt(t)}:e}function Zt(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?Yt(e[Wt]):e}function Qt(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=Zt(r);return{...e,advertisData:Zt(e.advertisData),serviceData:t}}function $t(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(Qt)}}function en(e){return!e||typeof e!=`object`?e:{...e,value:Zt(e.value)}}function tn(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 nn(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=D(e,n(tn(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function j(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=S.store(e=>t(n(e)),!0);return r.set(t,i),D(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),S.remove(n),D(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())S.remove(e);return r.clear(),D(t)}}}var rn=t({closeBluetoothAdapter:()=>_n,getBluetoothAdapterState:()=>gn,getBluetoothDevices:()=>hn,getConnectedBluetoothDevices:()=>mn,isBluetoothDevicePaired:()=>vn,makeBluetoothPair:()=>yn,offBluetoothAdapterStateChange:()=>pn,offBluetoothDeviceFound:()=>fn,onBluetoothAdapterStateChange:()=>dn,onBluetoothDeviceFound:()=>un,openBluetoothAdapter:()=>ln,startBluetoothDevicesDiscovery:()=>cn,stopBluetoothDevicesDiscovery:()=>sn}),an=j(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,$t),on=j(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function sn(e){return D(`stopBluetoothDevicesDiscovery`,e)}function cn(e){return D(`startBluetoothDevicesDiscovery`,e)}function ln(e){return D(`openBluetoothAdapter`,e)}function un(e){return an.on(e)}function dn(e){return on.on(e)}function fn(e){return an.off(e)}function pn(e){return on.off(e)}function mn(e){return nn(`getConnectedBluetoothDevices`,e,{transform:$t})}function hn(e){return nn(`getBluetoothDevices`,e,{transform:$t})}function gn(e){return D(`getBluetoothAdapterState`,e)}function _n(e){return D(`closeBluetoothAdapter`,e)}function vn(e){return D(`isBluetoothDevicePaired`,e)}function yn(e){return D(`makeBluetoothPair`,e)}var bn=t({closeBLEConnection:()=>In,createBLEConnection:()=>Fn,getBLEDeviceCharacteristics:()=>Pn,getBLEDeviceRSSI:()=>Nn,getBLEDeviceServices:()=>Mn,getBLEMTU:()=>Ln,notifyBLECharacteristicValueChange:()=>jn,offBLECharacteristicValueChange:()=>An,offBLEConnectionStateChange:()=>kn,offBLEMTUChange:()=>zn,onBLECharacteristicValueChange:()=>On,onBLEConnectionStateChange:()=>Dn,onBLEMTUChange:()=>Rn,readBLECharacteristicValue:()=>En,setBLEMTU:()=>Tn,writeBLECharacteristicValue:()=>wn}),xn=j(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Sn=j(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,en),Cn=j(`onBLEMTUChange`,`offBLEMTUChange`);function wn(e){return nn(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:Xt(e.value)}:e}})}function Tn(e){return D(`setBLEMTU`,e)}function En(e){return D(`readBLECharacteristicValue`,e)}function Dn(e){return xn.on(e)}function On(e){return Sn.on(e)}function kn(e){return xn.off(e)}function An(e){return Sn.off(e)}function jn(e){return D(`notifyBLECharacteristicValueChange`,e)}function Mn(e){return D(`getBLEDeviceServices`,e)}function Nn(e){return D(`getBLEDeviceRSSI`,e)}function Pn(e){return D(`getBLEDeviceCharacteristics`,e)}function Fn(e){return D(`createBLEConnection`,e)}function In(e){return D(`closeBLEConnection`,e)}function Ln(e){return D(`getBLEMTU`,e)}function Rn(e){return Cn.on(e)}function zn(e){return Cn.off(e)}var Bn=t({getClipboardData:()=>Hn,setClipboardData:()=>Vn});function Vn(e){return D(`setClipboardData`,e)}function Hn(e){return D(`getClipboardData`,e)}var Un=t({addPhoneContact:()=>Gn,chooseContact:()=>Wn});function Wn(e){return D(`chooseContact`,e)}function Gn(e){return D(`addPhoneContact`,e)}var Kn=t({hideKeyboard:()=>qn});function qn(e){return D(`hideKeyboard`,e)}var Jn=t({offMemoryWarning:()=>Xn,onMemoryWarning:()=>Yn});function Yn(e){return D(`onMemoryWarning`,e)}function Xn(e){return D(`offMemoryWarning`,e)}var Zn=t({getNetworkType:()=>Qn});function Qn(e){return D(`getNetworkType`,e)}var $n=t({makePhoneCall:()=>er});function er(e){return D(`makePhoneCall`,e)}var tr=t({scanCode:()=>nr});function nr(e){return D(`scanCode`,e)}var rr=t({vibrateLong:()=>ar,vibrateShort:()=>ir});function ir(e){return D(`vibrateShort`,e)}function ar(e){return D(`vibrateLong`,e)}var or=t({extBridge:()=>sr,extOffBridge:()=>lr,extOnBridge:()=>cr,offLoginStatusChanged:()=>dr,onLoginStatusChanged:()=>ur});function sr({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),D(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function cr({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}`;D(i,{evtId:i,keep:r,success:n})}function lr({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}`;D(r,{evtId:r,success:n})}function ur(e){T.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function dr(){T.off(`notifyLoginStatusChanged`)}var fr=new WeakSet;function pr(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!fr.has(e)){fr.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{fr.delete(e)}}console.error(`[service] ${r} error:`,t)}function M(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?pr(e,t,i):console.error(`[service] ${i} error:`,t);return}}function N(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])M(e,a,n,r,i)}var mr=[`onLaunch`,`onShow`,`onHide`],hr=[`globalData`],gr=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){mr.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)mr.includes(t)||hr.includes(t)||(n(e[t])?this[t]=e[t].bind(this):this[t]=e[t])}invokeSomeLifecycle(){M(this,this.onLaunch,[this.options],`onLaunch`),M(this,this.onShow,[this.options],`onShow`)}appShow(){M(this,this.onShow,[this.options],`onShow`)}appHide(){M(this,this.onHide,[],`onHide`)}},_r=new Set([`2d`]),vr=new Set([`webgl`,`experimental-webgl`,`webgl2`]),yr=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),br=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),xr=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Sr=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),Cr=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),wr={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Tr=new Map,P={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function Er(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function Dr(e,t){!e||!t||Tr.set(e,t)}function Or(e){return Tr.get(e)||null}function kr(e,t){return e&&e[Er(t)]||null}function F(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>F(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}let t={};for(let[n,r]of Object.entries(e))t[n]=F(r);return t}T.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{Dr(e,t)}),T.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{Dr(e,t)});var Ar=1,jr=1;function Mr(){let e=E.getPageInfo();return e?.bridgeId||e?.id||``}function I(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)&&n>=0?Math.floor(n):t}function Nr(e,t,n){T.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function Pr(e){Promise.resolve().then(e)}function Fr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ir(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function L(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=Ir(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>L(e));if(Fr(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}return e}function R(e){return Array.from(e).map(e=>L(e))}function z(e=`canvas_resource`){return`${e}_${p()}`}var B=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=Ar++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:R(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Lr=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=S.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=S.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},Rr=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}async getImageData(e,t,n,r){return await this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};if(e===`createImageData`){let e=t[0],n=t[1];return{width:e,height:n,data:new Uint8ClampedArray(e*n*4)}}let n=yr.has(e)?z():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:n}),n)return new B(this.canvas,n)}},zr=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=z(`webgl_extension_resource`),n=new B(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof B)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:R(t),resultId:r}),n}},Br=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...wr,...Fr(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(P,t))return P[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(P.VIEWPORT,[0,0,e,t]),this.state.set(P.SCISSOR_BOX,[0,0,e,t]),this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(P.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(P.DEPTH_CLEAR_VALUE,1),this.state.set(P.DEPTH_WRITEMASK,!0),this.state.set(P.DEPTH_FUNC,P.LESS),this.state.set(P.STENCIL_CLEAR_VALUE,0),this.state.set(P.LINE_WIDTH,1),this.state.set(P.CULL_FACE_MODE,P.BACK),this.state.set(P.FRONT_FACE,P.CCW),this.state.set(P.ACTIVE_TEXTURE,P.TEXTURE0),this.state.set(P.PACK_ALIGNMENT,4),this.state.set(P.UNPACK_ALIGNMENT,4),this.state.set(P.CURRENT_PROGRAM,null),this.state.set(P.ARRAY_BUFFER_BINDING,null),this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(P.TEXTURE_BINDING_2D,null),this.state.set(P.FRAMEBUFFER_BINDING,null),this.state.set(P.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=F(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(F(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return F(e)}queueError(e){e&&e!==P.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(R(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:R(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=z(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new B(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),P.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,P.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t);default:break}let n=br.get(e)||xr.get(e);if(n)return this.createResource(e,t,n);if(Cr.has(e)){let n=t[0];return n instanceof B&&n.resourceType===Cr.get(e)&&!n.deleted}Sr.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:R(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(P.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(P.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(P.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(P.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(P.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(P.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(P.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(P.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(P.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(P.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(P.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(P.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===P.ARRAY_BUFFER?this.state.set(P.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===P.ELEMENT_ARRAY_BUFFER&&this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===P.TEXTURE_2D&&this.state.set(P.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(P.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(P.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}default:break}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?F(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof B)||e.resourceType!==`shader`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.SHADER_TYPE:return e.metadata.shaderType;case P.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof B)||e.resourceType!==`program`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.LINK_STATUS:return!!e.metadata.linkStatus;case P.VALIDATE_STATUS:return!!e.metadata.validateStatus;case P.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=z(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new zr(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},Vr=class{constructor({nodeId:e,bridgeId:t=Mr(),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||Or(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=I(n,300),this._height=I(r,150)}get width(){return this._width}set width(e){this._width=I(e,300),this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width})}get height(){return this._height}set height(e){this._height=I(e,150),this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height})}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=Er(n),i=vr.has(n);if(!_r.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?kr(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=z(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:L(t)});let s=i?new Br(this,o,r,t,a):new Rr(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=z(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=F(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new Lr(this,z(`canvas_image`))}requestAnimationFrame(e){let t=jr++,r=S.store(t=>{n(e)&&e(t)});return Nr(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){Nr(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){return new Promise((a,o)=>{let s=S.store(e=>{a(e)});this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s})})}toDataURL(e=`image/png`,t){return new Promise(n=>{let r=S.store(e=>{n(e)});this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:r})})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,Pr(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback||e.typedArrayUpdateId)?S.store(e=>this.applyFlushFeedback(e)):void 0;Nr(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:t})}};function Hr(e,t=Mr()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(Dr(t,e.webglCapabilities),new Vr({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function Ur(e,t=Mr()){return Array.isArray(e)?e.map(e=>Ur(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:Hr(e.node,t)}:e}function Wr(e={}){let t=I(e.width,300),n=I(e.height,150),r=e.type||`2d`,i=z(`offscreen_canvas`),a=Mr();return Nr(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new Vr({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:Or(a)})}var Gr=t({createSelectorQuery:()=>Kr});function Kr(){return new Xr}function qr(){return E.getPageInfo()}function Jr(){let e=qr();return e?.__id__||e?.id}function Yr(){let e=qr();return e?.bridgeId||e?.id}var Xr=class{constructor(){this.__componentId=Jr(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Zr(this,this.__componentId,e,!0)}selectAll(e){return new Zr(this,this.__componentId,e,!1)}selectViewport(){return new Zr(this,Jr(),``,!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=Yr();D(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Ur(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Zr=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)}},Qr=t({createIntersectionObserver:()=>$r});function $r(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new ei(e,{thresholds:n,initialRatio:r,observeAll:i})}var ei=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=S.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);D(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){D(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},ti=t({createMediaQueryObserver:()=>ri});function ni(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 ri(e,t={}){return new ii(e,t)}var ii=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=S.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){D(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),S.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),D(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:ni(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,D(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(S.remove(this._callbackId),this._callbackId=null)}};function ai(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 oi(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 si(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function ci(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=ai(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function li(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&si(e.path,t)||si(t,e.path)}function ui(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:ci(e.expression)}))}function di(e,t,r=e.data,i=e.__info__||{}){for(let a of ui(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>li(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 fi(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function pi(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 mi(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=ai(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=b(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;oi(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=[],di(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:fi(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:pi(e,a.changes)}}function V(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);s.length===1&&c===a.oldValue&&!t?.observeAssignments||(r(o)?M(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&M(e,o,[c,a.oldValue,s],`property observer`))}}var hi=new Map;function gi(e){return hi.has(e)||hi.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),hi.get(e)}function H(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return S.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function _i(e){let t=gi(e);t.depth++}function vi(e){let t=gi(e);t.depth>0&&t.depth--,t.depth===0&&bi(e)}function yi(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=ai(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(Te({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function U(e,t,n,r,i=[]){let a=gi(e),o=a.byModuleId.get(t),s=yi(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&&bi(e)}))}function bi(e){let t=hi.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,T.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function xi(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>xi(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=xi(n)),e),{}):e}function Si(e){if(e){let t={};for(let n in e){let r=he(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(wi),default:r.value}}return t}}var Ci=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function wi(e){return Array.isArray(e)?e.map(e=>wi(e)):e===null||e===``?null:Ci.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function Ti(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 Ei(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];typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?n[e]=g(r,i):n[e]=i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function W(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 Di(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 Oi(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 ki(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 Ai(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!W(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&&Oi(i,n)&&(o[r]=b(ki(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 ji=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],Mi=[`show`,`hide`,`resize`,`routeDone`],Ni=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=b(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,he(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=ye(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,T.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__=[],U(this.bridgeId,this.__id__,{},H(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)}`}else 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(`/`)}else return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(J.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(J.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(J.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=mi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}let r=Ai(this,J.instances[this.bridgeId],n.changedData);U(this.bridgeId,this.__id__,n.changedData,H(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)}),V(this,n.propertyChanges)}#u(){ji.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&Mi.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&&(di(this,e),V(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),M(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return di(this,o),V(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=ye(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 Kr().in(this)}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]),n=t.find(n=>W(n,this.__id__,t)&&Di(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]);return t.filter(n=>W(n,this.__id__,t)&&Di(e,n))}selectOwnerComponent(){let e=Object.values(J.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return $r(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,_i(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=Ai(this,J.instances[this.bridgeId],e);U(this.bridgeId,this.__id__,e,H(this,t),n),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];vi(this.bridgeId)}}createMediaQueryObserver(e){return ri(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),D(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),D(`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=Ti(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 J.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?J.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=J.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=J.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(J.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)}},G=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,Ei(this.moduleInfo,this.behaviors),this.noReferenceData=xi(this.moduleInfo.data||{})}getProps(){let e=Si(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}},Pi=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=b(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,T.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__=[],U(this.bridgeId,this.__id__,{},H(this,e))}setData(e,t){let n=mi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=Ai(this,J.instances[this.bridgeId],n.changedData);U(this.bridgeId,this.__id__,n.changedData,H(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Kr().in(this)}getTabBar(){let e=Object.values(J.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&W(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]||{}),n=t.find(n=>W(n,this.__id__,t)&&Di(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]||{});return t.filter(n=>W(n,this.__id__,t)&&Di(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];n(t)?this[e]=t.bind(this):this[e]=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`)}},K=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,Ei(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=xi(this.moduleInfo.data||{})}},Fi=class{static type=`app`;constructor(e){this.moduleInfo=e}},q=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}E.setInitId(n),x(`app`),x(r),T.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}})}createAppModule(e){let t=new Fi(e);this.staticModules[Fi.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))x(e);if(n===K.type){let n=new K(e,t);this.staticModules[r]=n}else if(n===G.type){let n=new G(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[Fi.type]}getModuleByPath(e){return this.staticModules[e]}},J=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.instances={},this.pageStates=new Map}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=e)}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e||{},i=q.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(i.moduleInfo,this.defaultApp),this.defaultApp={},this.app=new gr(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){E.pushStack(e)}stackHide(e){E.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=q.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===G.type){let e=new Ni(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||E.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}else if(m.type===K.type){let e=new Pi(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,E.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}else 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__!==G.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__===G.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__===G.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__===K.type?i.push(e):e.__type__===G.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__===K.type||e.__type__===G.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__===G.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__===K.type?r.push(e):e.__type__===G.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__===G.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===G.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),E.pop(),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__===K.type?r.push(e):e.__type__===G.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__===G.type&&i.componentError(r)}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===G.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__===G.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})}},Ii=t({getEnterOptionsSync:()=>Ri,getLaunchOptionsSync:()=>Li});function Li(){return J.app?.options}function Ri(){return J.app?.options}var zi=t({getLocation:()=>Bi,offLocationChange:()=>Gi,onLocationChange:()=>Wi,openLocation:()=>Hi,startLocationUpdate:()=>Vi,stopLocationUpdate:()=>Ui});function Bi(e){return D(`getLocation`,e)}function Vi(e){return D(`startLocationUpdate`,e)}function Hi(e){return D(`openLocation`,e)}function Ui(e){return D(`stopLocationUpdate`,e)}function Wi(e){e&&D(`onLocationChange`,{success:S.store(e,!0)})}function Gi(e){if(e){let t=S.store(e,!0);D(`offLocationChange`,{success:t}),S.remove(t)}else D(`offLocationChange`),S.remove()}var Ki=t({createMapContext:()=>qi});function qi(e,t){return new Ji({mapId:e,obj:t})}var Ji=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 D(e,{mapId:this.opts.mapId,...t})}},Yi=t({createInnerAudioContext:()=>Qi}),Xi=1,Zi=class{constructor(){this._audioId=Xi++,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={},D(`audioCreate`,{audioId:this._audioId}),D(`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,D(`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,D(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,D(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,D(`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)),D(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,D(`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,D(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,D(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,D(`audioStop`,{audioId:this._audioId})}seek(e){D(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){D(`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 Qi(){return new Zi}var $i=t({chooseImage:()=>ra,compressImage:()=>na,previewImage:()=>ta,saveImageToPhotosAlbum:()=>ea});function ea(e){return D(`saveImageToPhotosAlbum`,e)}function ta(e){return D(`previewImage`,e)}function na(e){return D(`compressImage`,e)}function ra(e){return D(`chooseImage`,e)}var ia=t({chooseMedia:()=>sa,chooseVideo:()=>oa,createVideoContext:()=>aa});function aa(e,t){return new ca({videoId:e,obj:t})}function oa(e){return D(`chooseVideo`,e)}function sa(e){return D(`chooseMedia`,e)}var ca=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={}){D(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},la=t({exitMiniProgram:()=>pa,navigateBackMiniProgram:()=>fa,navigateToMiniProgram:()=>da,restartMiniProgram:()=>ua});function ua(e){return D(`restartMiniProgram`,e)}function da(e){return D(`navigateToMiniProgram`,e)}function fa(e){return D(`navigateBackMiniProgram`,e)}function pa(e){return D(`exitMiniProgram`,e)}var ma=t({downloadFile:()=>ha});function ha(e){return D(`downloadFile`,e)}var ga=`__diminaArrayBufferBase64`,Y=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,_a=Object.fromEntries([...Y].map((e,t)=>[e,t]));function va(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function ya(e){return va(e)?e:e&&va(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function ba(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=Y[t[r]>>2],n+=Y[(t[r]&3)<<4|t[r+1]>>4],n+=Y[(t[r+1]&15)<<2|t[r+2]>>6],n+=Y[t[r+2]&63];return r<t.length&&(n+=Y[t[r]>>2],r+1<t.length?(n+=Y[(t[r]&3)<<4|t[r+1]>>4],n+=`${Y[(t[r+1]&15)<<2]}=`):n+=`${Y[(t[r]&3)<<4]}==`),n}function xa(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=_a[t[e]],o=_a[t[e+1]],s=t[e+2]===`=`?0:_a[t[e+2]],c=t[e+3]===`=`?0:_a[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 Sa(e){let t=ya(e);return t?{[ga]:ba(t)}:e}function Ca(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:xa(t[ga])}}function wa(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function X(e,t,n={}){return D(e,{socketId:t,...n,keep:!0})}function Z(e,t,n={},r=e=>e){let i=new Set,a,o;function s(){if(!a)return;let e=a;a=void 0,S.remove(e),D(t,{...n,callbackId:e,keep:!0})}return{on(t){if(!(typeof t!=`function`||i.has(t))&&(i.add(t),!a))return a=S.store(e=>{let t=r(e);for(let e of[...i])e(t);o?.()},!0),D(e,{...n,callbackId:a,success:a,keep:!0})},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return s()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return s();a&&S.remove(a),a=void 0},hasListeners(){return i.size>0},setAfterEmit(e){o=e}}}var Ta=t({offLocalServiceDiscoveryStop:()=>Na,offLocalServiceFound:()=>Fa,offLocalServiceLost:()=>La,offLocalServiceResolveFail:()=>za,onLocalServiceDiscoveryStop:()=>Ma,onLocalServiceFound:()=>Pa,onLocalServiceLost:()=>Ia,onLocalServiceResolveFail:()=>Ra,startLocalServiceDiscovery:()=>Aa,stopLocalServiceDiscovery:()=>ja}),Ea=Z(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),Da=Z(`onLocalServiceFound`,`offLocalServiceFound`),Oa=Z(`onLocalServiceLost`,`offLocalServiceLost`),ka=Z(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function Aa(e={}){return D(`startLocalServiceDiscovery`,e)}function ja(e={}){return D(`stopLocalServiceDiscovery`,e)}function Ma(e){return Ea.on(e)}function Na(e){return Ea.off(e)}function Pa(e){return Da.on(e)}function Fa(e){return Da.off(e)}function Ia(e){return Oa.on(e)}function La(e){return Oa.off(e)}function Ra(e){return ka.on(e)}function za(e){return ka.off(e)}var Ba=t({request:()=>Va});function Va(e){return D(`request`,e)}var Ha=t({createTCPSocket:()=>Wa}),Ua=class{constructor(e){this.socketId=e,this.events={bindWifi:Z(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:Z(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:Z(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:Z(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:Z(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},Ca)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return X(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=X(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return X(`TCPSocket.connect`,this.socketId,e)}write(e){return X(`TCPSocket.write`,this.socketId,{data:Sa(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 Wa(){return new Ua(wa(`tcp`))}var Ga=t({createUDPSocket:()=>qa}),Ka=class{constructor(e){this.socketId=e,this.events={close:Z(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:Z(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:Z(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:Z(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},Ca)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return X(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=X(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return X(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return X(`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 X(e,this.socketId,{...t,message:Sa(t.message)})}};function qa(){return new Ka(wa(`udp`))}var Ja=t({uploadFile:()=>Qa}),Ya=1;function Xa(){return`upload_${Date.now()}_${Ya++}`}function Za(){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 Qa(e={}){let t=Xa(),n=Za(),r=Za(),i=S.store(e=>n.dispatch(e),!0,`${t}_progress`),a=S.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,S.remove(i),S.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{D(`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||D(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var $a=t({closeSocket:()=>ro,connectSocket:()=>to,offSocketClose:()=>fo,offSocketError:()=>lo,offSocketMessage:()=>so,offSocketOpen:()=>ao,onSocketClose:()=>uo,onSocketError:()=>co,onSocketMessage:()=>oo,onSocketOpen:()=>io,sendSocketMessage:()=>no});function Q(e,t,r={}){let i=new Map;return{on(t){if(!n(t)||i.has(t))return;let a=S.store(e=>t(e),!0);i.set(t,a);try{return D(e,{...r,callback:a,keep:!0})}catch(e){throw i.delete(t),S.remove(a),e}},off(e){if(n(e)){let n=i.get(e);return n?(i.delete(e),S.remove(n),D(t,{...r,callback:n,keep:!0})):void 0}for(let e of i.values())S.remove(e);return i.clear(),D(t,{...r,keep:!0})}}}var eo=class{constructor(e){this.socketId=e,this._readyState=0,this._events={open:Q(`onSocketOpen`,`offSocketOpen`,{socketId:e}),message:Q(`onSocketMessage`,`offSocketMessage`,{socketId:e}),error:Q(`onSocketError`,`offSocketError`,{socketId:e}),close:Q(`onSocketClose`,`offSocketClose`,{socketId:e})}}send(e={}){let{data:t,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,data:t,...o};return n(r)&&(s.success=S.store(r)),n(i)&&(s.fail=S.store(i)),n(a)&&(s.complete=S.store(a)),D(`sendSocketMessage`,s)}close(e={}){let{code:t=1e3,reason:r=``,success:i,fail:a,complete:o,...s}=e,c={socketId:this.socketId,code:t,reason:r,...s};return n(i)&&(c.success=S.store(i)),n(a)&&(c.fail=S.store(a)),n(o)&&(c.complete=S.store(o)),D(`closeSocket`,c)}onOpen(e){return this._events.open.on(e)}offOpen(e){return this._events.open.off(e)}onMessage(e){return this._events.message.on(e)}offMessage(e){return this._events.message.off(e)}onError(e){return this._events.error.on(e)}offError(e){return this._events.error.off(e)}onClose(e){return this._events.close.on(e)}offClose(e){return this._events.close.off(e)}get readyState(){return this._readyState}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}},$={open:Q(`onSocketOpen`,`offSocketOpen`),message:Q(`onSocketMessage`,`offSocketMessage`),error:Q(`onSocketError`,`offSocketError`),close:Q(`onSocketClose`,`offSocketClose`)};function to(e={}){let{url:t,header:r={},protocols:i=[],tcpNoDelay:a=!1,perMessageDeflate:o=!1,timeout:s,forceCellularNetwork:c=!1,success:l,fail:u,complete:d,...f}=e;if(!t){let e=Error(`url is required`);throw n(u)&&u(e),n(d)&&d(e),e}let p=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,m=new eo(p),h={socketId:p,url:t,header:r,protocols:i,tcpNoDelay:a,perMessageDeflate:o,timeout:s,forceCellularNetwork:c,...f};return n(l)&&(h.success=S.store(e=>{m._readyState=eo.OPEN,l(e)})),n(u)&&(h.fail=S.store(e=>{m._readyState=eo.CLOSED,u(e)})),n(d)&&(h.complete=S.store(d)),D(`connectSocket`,h),m}function no(e){return D(`sendSocketMessage`,e)}function ro(e){return D(`closeSocket`,e)}function io(e){return $.open.on(e)}function ao(e){return $.open.off(e)}function oo(e){return $.message.on(e)}function so(e){return $.message.off(e)}function co(e){return $.error.on(e)}function lo(e){return $.error.off(e)}function uo(e){return $.close.on(e)}function fo(e){return $.close.off(e)}var po=t({getAccountInfoSync:()=>mo});function mo(){return D(`getAccountInfoSync`)}var ho=t({authorize:()=>go});function go(e){return D(`authorize`,e)}var _o=t({login:()=>vo});function vo(e){return D(`login`,e)}var yo=t({login:()=>bo});function bo(e){return D(`login`,e)}var xo=t({getPrivacySetting:()=>So});function So(e){return D(`getPrivacySetting`,e)}var Co=t({getSetting:()=>To,openSetting:()=>wo});function wo(e){return D(`openSetting`,e)}function To(e){return D(`getSetting`,e)}var Eo=t({getUserInfo:()=>Do});function Do(e){return D(`getUserInfo`,e)}var Oo=t({requestPayment:()=>ko});function ko(e){return D(`requestPayment`,e)}var Ao=t({hideShareMenu:()=>No,showShareImageMenu:()=>Mo,showShareMenu:()=>jo});function jo(e){return D(`shareShareMenu`,e)}function Mo(e){return D(`showShareImageMenu`,e)}function No(e){return D(`hideShareMenu`,e)}var Po=t({clearStorage:()=>Ho,clearStorageSync:()=>Ro,getStorage:()=>Bo,getStorageInfo:()=>Wo,getStorageInfoSync:()=>Uo,getStorageSync:()=>Io,removeStorage:()=>Vo,removeStorageSync:()=>Lo,setStorage:()=>zo,setStorageSync:()=>Fo});function Fo(...e){return D(`setStorageSync`,e)}function Io(e){return D(`getStorageSync`,e)}function Lo(e){return D(`removeStorageSync`,e)}function Ro(){return D(`clearStorageSync`)}function zo(e){return D(`setStorage`,e)}function Bo(e){return D(`getStorage`,e)}function Vo(e){return D(`removeStorage`,e)}function Ho(){return D(`clearStorage`)}function Uo(){return D(`getStorageInfoSync`)}function Wo(e){return D(`getStorageInfo`,e)}var Go=t({createAnimation:()=>Ko});function Ko(e={}){return new qo(e)}var qo=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`,y(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,y(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,y(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`,y(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`,y(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`,y(e)]}),this}},Jo=t({setBackgroundColor:()=>Xo,setBackgroundTextStyle:()=>Yo});function Yo(e){return D(`setBackgroundTextStyle`,e)}function Xo(e){return D(`setBackgroundColor`,e)}var Zo=t({canvasToTempFilePath:()=>ts,createCanvasContext:()=>$o,createContext:()=>Qo,createOffscreenCanvas:()=>Wr,drawCanvas:()=>es});function Qo(){return new rs}function $o(e,t){return new rs(e,ns(t))}function es(e={}){let t={...e,moduleId:e.moduleId||ns(e.component)};delete t.component,D(`drawCanvas`,t,`render`)}function ts(e={},t){let n={...e,moduleId:e.moduleId||ns(t||e.component)};return delete n.component,D(`canvasToTempFilePath`,n,`render`)}function ns(e){return e?.__id__||E.getPageInfo()?.id}var rs=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(es({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},is=t({nextTick:()=>cs}),as=[],os=null;function ss(){let e=as;as=[],os=null;for(let t=0;t<e.length;t++)e[t]()}function cs(e){n(e)&&(as.push(e),os||=setTimeout(ss,0))}var ls=t({disableAlertBeforeUnload:()=>_s,enableAlertBeforeUnload:()=>gs,hideLoading:()=>hs,hideToast:()=>ds,showActionSheet:()=>ms,showLoading:()=>ps,showModal:()=>fs,showToast:()=>us});function us(e){return D(`showToast`,e)}function ds(e){return D(`hideToast`,e)}function fs(e){return D(`showModal`,e)}function ps(e){return D(`showLoading`,e)}function ms(e){return D(`showActionSheet`,e)}function hs(e){return D(`hideLoading`,e)}function gs(e){return D(`enableAlertBeforeUnload`,e)}function _s(e){return D(`disableAlertBeforeUnload`,e)}var vs=t({getMenuButtonBoundingClientRect:()=>bs,offMenuButtonBoundingClientRectWeightChange:()=>Ss,onMenuButtonBoundingClientRectWeightChange:()=>xs}),ys=new Set;w.onUpdate(e=>{e.menuRect&&ys.forEach(t=>t(e.menuRect))});function bs(){return D(`getMenuButtonBoundingClientRect`)}function xs(e){n(e)&&ys.add(e)}function Ss(e){n(e)?ys.delete(e):ys.clear()}var Cs=t({hideNavigationBarLoading:()=>Ds,setNavigationBarColor:()=>Es,setNavigationBarTitle:()=>Ts,showNavigationBarLoading:()=>ws});function ws(e){return D(`showNavigationBarLoading`,e)}function Ts(e){return D(`setNavigationBarTitle`,e)}function Es(e){return D(`setNavigationBarColor`,e)}function Ds(e){return D(`hideNavigationBarLoading`,e)}var Os=t({startPullDownRefresh:()=>As,stopPullDownRefresh:()=>ks});function ks(e){return D(`stopPullDownRefresh`,e)}function As(e){return D(`startPullDownRefresh`,e)}var js=t({pageScrollTo:()=>Ms});function Ms(e){return D(`pageScrollTo`,e)}var Ns=t({hideTabBar:()=>Ls,hideTabBarRedDot:()=>Vs,removeTabBarBadge:()=>zs,setTabBarBadge:()=>Rs,setTabBarItem:()=>Fs,setTabBarStyle:()=>Ps,showTabBar:()=>Is,showTabBarRedDot:()=>Bs});function Ps(e){return D(`setTabBarStyle`,e)}function Fs(e){return D(`setTabBarItem`,e)}function Is(e){return D(`showTabBar`,e)}function Ls(e){return D(`hideTabBar`,e)}function Rs(e){return D(`setTabBarBadge`,e)}function zs(e){return D(`removeTabBarBadge`,e)}function Bs(e){return D(`showTabBarRedDot`,e)}function Vs(e){return D(`hideTabBarRedDot`,e)}var Hs=t({onWindowResize:()=>Us});function Us(e){e&&D(`onWindowResize`,{success:e})}var Ws=Object.assign({"./core/base/app-event/index.js":Ve,"./core/base/index.js":at,"./core/base/performance/index.js":ut,"./core/base/subpackage/index.js":ht,"./core/base/system/index.js":vt,"./core/base/update/index.js":At,"./core/camera/index.js":Rt,"./core/data-analysis/index.js":Vt,"./core/device/bluetooth/index.js":rn,"./core/device/bluetooth-ble/index.js":bn,"./core/device/clipboard/index.js":Bn,"./core/device/contact/index.js":Un,"./core/device/keyboard/index.js":Kn,"./core/device/memory/index.js":Jn,"./core/device/network/index.js":Zn,"./core/device/phone/index.js":$n,"./core/device/scan/index.js":tr,"./core/device/vibrate/index.js":rr,"./core/ext/index.js":or,"./core/file/index.js":Ze,"./core/life-cycle/index.js":Ii,"./core/location/index.js":zi,"./core/map/index.js":Ki,"./core/media/audio/index.js":Yi,"./core/media/image/index.js":$i,"./core/media/video/index.js":ia,"./core/navigate/index.js":la,"./core/network/download/index.js":ma,"./core/network/mdns/index.js":Ta,"./core/network/request/index.js":Ba,"./core/network/tcp/index.js":Ha,"./core/network/udp/index.js":Ga,"./core/network/upload/index.js":Ja,"./core/network/websocket/index.js":$a,"./core/open-api/account-info/index.js":po,"./core/open-api/authorize/index.js":ho,"./core/open-api/index.js":_o,"./core/open-api/login/index.js":yo,"./core/open-api/privacy/index.js":xo,"./core/open-api/setting/index.js":Co,"./core/open-api/user-info/index.js":Eo,"./core/payment/index.js":Oo,"./core/route/index.js":Fe,"./core/share/index.js":Ao,"./core/storage/index.js":Po,"./core/ui/animation/index.js":Go,"./core/ui/background/index.js":Jo,"./core/ui/canvas/index.js":Zo,"./core/ui/custom-component/index.js":is,"./core/ui/interaction/index.js":ls,"./core/ui/menu/index.js":vs,"./core/ui/navigation-bar/index.js":Cs,"./core/ui/pull-down-refresh/index.js":Os,"./core/ui/scroll/index.js":js,"./core/ui/tab-bar/index.js":Ns,"./core/ui/window/index.js":Hs,"./core/wxml/intersection-observer/index.js":Qr,"./core/wxml/media-query-observer/index.js":ti,"./core/wxml/selector-query/index.js":Gr}),Gs={};for(let e of Object.values(Ws))for(let[t,n]of Object.entries(e))Gs[t]=n;function Ks(e){for(let t of e||[])typeof t!=`string`||Object.prototype.hasOwnProperty.call(Gs,t)||t in Object.prototype||Object.defineProperty(Gs,t,{value:(...e)=>D(t,...e),writable:!0,enumerable:!0,configurable:!0})}var qs=new Proxy(Gs,{get(e,t,n){let r=Reflect.get(e,t,n);return typeof r==`function`||r!==void 0||t===`webpackJsonp`?r:(...e)=>D(t,...e)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),Js=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}Ks(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=qs;globalThis.modRequire=x,globalThis.modDefine=ie,globalThis.global={},globalThis.App=(e={})=>{q.createAppModule(e),J.createApp()},globalThis.Page=e=>{q.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Component=e=>{q.createModule(e,globalThis.__extraInfo,G.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>J.getApp(e),globalThis.getCurrentPages=()=>E.stack()}},Ys={navigateBack:Be,navigateTo:ze,reLaunch:Le,redirectTo:Re,switchTab:Ie};return new class{constructor(){console.log(`[service] init`),this.env=Js,this.message=T,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,scene:l}=e;o&&w.init(o),J.setAppLaunchOptions({scene:l,pagePath:r,query:s}),q.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c})}),this.message.on(`hostEnvUpdate`,e=>{w.update(e)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await J.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;S.invoke(t,n)}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=S.store(e=>s(r.success,e))),r.fail&&(o=S.store(e=>s(r.fail,e)));let c=S.store(e=>{s(r.complete,e),S.remove(a),S.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e,a=q.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=q.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=J.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});T.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,()=>{J.appShow()}),this.message.on(`appHide`,()=>{J.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{J.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{J.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{J.createInstance(e)}),this.message.on(`mA`,e=>{J.moduleAttached(e)}),this.message.on(`mR`,e=>{J.moduleReady(e)}),this.message.on(`mU`,e=>{J.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{J.pageUnload(e)}),this.message.on(`pageShow`,e=>{J.pageShow(e)}),this.message.on(`pageReady`,e=>{J.pageReady(e)}),this.message.on(`pageHide`,e=>{J.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{J.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{J.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=J.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=>{J.pageScroll(e)}),this.message.on(`pageResize`,e=>{J.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{J.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;J.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{J.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 J.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}})}Ys[t]?.({url:n,...e.params})})}}})();
|
|
6
|
+
`;console.error(`require ${e} error: ${a}`),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}b.async=async e=>new Promise((t,n)=>{try{t(b(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var x=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},oe=`__dimina_data_function_reference__`,se=1;function ce(e){return{[oe]:e,version:se}}function le(e){return typeof e==`object`&&!!e&&e.version===se&&typeof e[oe]==`string`&&Object.keys(e).length===2}function ue(e){return le(e)?e[oe]:void 0}function de(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(le(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=de(e[a],{mapFunction:t,mapReference:n},r);return i}var fe=new Set([String,Number,Boolean,Object,Array,null]);function pe(e){return fe.has(e)}function me(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function he(e){return Array.isArray(e)?e.filter(pe):[]}function ge(e){let t,n=[],r;return pe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=he(e.optionalTypes),r=e.value),pe(t)||(t=n[0]??null),r===void 0&&(r=me(t)),{type:t,optionalTypes:n,value:y(r)}}function _e(e){return Array.isArray(e)}function ve(e){return _e(e)&&e?.constructor?.name===Array.name}function ye(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?ve(t):t!==void 0}function S(e,t){typeof e==`function`&&e(t)}function be(e,t,{absent:n=!1,warn:r}={}){if(n)return y(e.value);for(let n of e.optionalTypes||[])if(ye(n,t))return t;let i=e.type;if(i===String)return t==null?(S(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&S(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 S(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?_e(t)?t:(S(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(S(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var C=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 xe(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 Se=new WeakMap,Ce=new Map;function we(e){let t=Se.get(e);if(t)return Ce.set(t,e),t;let n;do n=`data-function-${p()}`;while(Ce.has(n));return Se.set(e,n),Ce.set(n,e),n}function Te(e){return Ce.get(e)}function Ee(e){return de(e,{mapFunction(e){return ce(we(e))}})}function De(e){return de(e,{mapReference(e){return Te(ue(e))||e}})}var w=new class e{constructor(){this.event=xe(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){let t=De(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=Ee(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=Ee(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)}},T=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}else{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function Oe(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var ke={getWindowInfo:()=>Oe(C.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>C.getSystemInfo(),getAppBaseInfo:()=>Oe(C.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>Oe(C.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>C.getMenuRect()},Ae=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),je=new Set(`FileSystemManager.getSavedFileList,clearStorage,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function Me(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function Ne(e,t){return Ae.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||je.has(e)}function Pe(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:T.getPageInfo().id,params:t}};return n===`container`?w.invoke(r):w.send(r)}function Fe(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{x.remove(a),x.remove(o)};a=x.store(e=>{s(),r(e)}),o=x.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{Pe(e,t,n)}catch(e){s(),i(e)}})}function E(e,t,r=`container`){let i=ke[e];if(r===`container`&&i){let e=i();if(e)return e}let a;if(t===void 0){if(Ne(e,t))return Fe(e,{},r);a=t}else if(typeof t==`string`||Array.isArray(t))a=t;else if(n(t))a={success:x.store(t,!0)};else if(Me(t)){let{success:e,fail:r,complete:i,keep:o,evtId:s,...c}=t;a=c,s!==void 0&&(a.evtId=s),n(e)?a.success=x.store(e,o,s):a.success=e,n(r)&&(a.fail=x.store(r,o,s)),n(i)&&(a.complete=x.store(i,o,s))}else{let{keep:n,...i}=t;if(delete i.evtId,!n&&Ne(e,t))return a={...i},Fe(e,a,r);a=i}return Pe(e,a,r)}var Ie=t({navigateBack:()=>Ve,navigateTo:()=>Be,reLaunch:()=>Re,redirectTo:()=>ze,switchTab:()=>Le});function Le(e){return e.url=te(T.getPageInfo().route,e.url),E(`switchTab`,e)}function Re(e){return e.url=te(T.getPageInfo().route,e.url),E(`reLaunch`,e)}function ze(e){let t=te(T.getPageInfo().route,e.url);if(T.getPageInfo().route!==t)return e.url=t,E(`redirectTo`,e)}function Be(e){return e.url=te(T.getPageInfo().route,e.url),E(`navigateTo`,e)}function Ve(e){return E(`navigateBack`,e)}var He=t({offAppHide:()=>Je,offAppShow:()=>qe,offError:()=>We,onAppHide:()=>Ke,onAppRoute:()=>Ze,onAppShow:()=>Ge,onError:()=>Ue,onPageNotFound:()=>Xe,onUnhandledRejection:()=>Ye});function Ue(e){return E(`onError`,e)}function We(e){return E(`offError`,e)}function Ge(e){return E(`onAppShow`,e)}function Ke(e){return E(`onAppHide`,e)}function qe(e){return E(`offAppShow`,e)}function Je(e){return E(`offAppHide`,e)}function Ye(){}function Xe(){}function Ze(){}var Qe=t({USER_DATA_PATH:()=>$e,fileSystemManagerAPINames:()=>nt,getFileSystemManager:()=>it}),$e=`difile://`,et=`not supported by the dimina runtime`;function D(e){throw Error(`FileSystemManager.${e} ${et}`)}function O(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${et}`}),r?.()}var tt=class{access(e){O(`access`,e)}accessSync(){D(`accessSync`)}stat(e){O(`stat`,e)}statSync(){D(`statSync`)}readFile(e){O(`readFile`,e)}readFileSync(){D(`readFileSync`)}writeFile(e){O(`writeFile`,e)}writeFileSync(){D(`writeFileSync`)}appendFile(e){O(`appendFile`,e)}appendFileSync(){D(`appendFileSync`)}copyFile(e){O(`copyFile`,e)}copyFileSync(){D(`copyFileSync`)}rename(e){O(`rename`,e)}renameSync(){D(`renameSync`)}unlink(e){O(`unlink`,e)}unlinkSync(){D(`unlinkSync`)}mkdir(e){O(`mkdir`,e)}mkdirSync(){D(`mkdirSync`)}rmdir(e){O(`rmdir`,e)}rmdirSync(){D(`rmdirSync`)}readdir(e){O(`readdir`,e)}readdirSync(){D(`readdirSync`)}getFileInfo(e){O(`getFileInfo`,e)}saveFile(e){O(`saveFile`,e)}saveFileSync(){D(`saveFileSync`)}getSavedFileList(e){O(`getSavedFileList`,e)}removeSavedFile(e){O(`removeSavedFile`,e)}truncate(e){O(`truncate`,e)}truncateSync(){D(`truncateSync`)}unzip(e){O(`unzip`,e)}open(e){O(`open`,e)}openSync(){D(`openSync`)}close(e){O(`close`,e)}closeSync(){D(`closeSync`)}read(e){O(`read`,e)}readSync(){D(`readSync`)}write(e){O(`write`,e)}writeSync(){D(`writeSync`)}fstat(e){O(`fstat`,e)}fstatSync(){D(`fstatSync`)}ftruncate(e){O(`ftruncate`,e)}ftruncateSync(){D(`ftruncateSync`)}readCompressedFile(e){O(`readCompressedFile`,e)}readCompressedFileSync(){D(`readCompressedFileSync`)}readZipEntry(e){O(`readZipEntry`,e)}},nt=Object.getOwnPropertyNames(tt.prototype).filter(e=>e!==`constructor`),rt;function it(){return rt||=new tt,rt}var at=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],ot=t({canIUse:()=>ut,env:()=>st}),st={USER_DATA_PATH:`difile://usr`},ct=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,...at.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...nt.map(e=>`FileSystemManager.${e}`)]),lt={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function ut(e){if(ct.has(e))return!0;try{return E(`canIUse`,Object.hasOwn(lt,e)?lt[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var dt=t({getPerformance:()=>ft});function ft(){return pt.getInstance()}var pt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new mt,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new ht(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}},mt=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}},ht=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=x.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){E(`removePerformanceObserver`,{observerId:e.observerId},`render`),x.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),E(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new mt;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&&E(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&x.remove(this.callbackId),this.observerId=null,this.callbackId=null}},gt=t({loadSubpackage:()=>vt,preDownloadSubpackage:()=>_t});function _t(e){return E(`preDownloadSubpackage`,e)}function vt(e){return E(`loadSubpackage`,e)}var yt=t({getAppBaseInfo:()=>Dt,getDeviceInfo:()=>Ot,getSystemInfo:()=>wt,getSystemInfoAsync:()=>Et,getSystemInfoSync:()=>Tt,getWindowInfo:()=>St,offThemeChange:()=>At,onThemeChange:()=>kt,openAppAuthorizeSetting:()=>Ct,openSystemBluetoothSetting:()=>xt}),bt=new Set;C.onUpdate(e=>{let t=e.systemInfo?.theme;t&&bt.forEach(e=>e({theme:t}))});function xt(e){return E(`openSystemBluetoothSetting`,e)}function St(e){return E(`getWindowInfo`,e)}function Ct(e){return E(`openAppAuthorizeSetting`,e)}function wt(e){return new Promise(t=>{t(E(`getSystemInfo`,e))})}function Tt(){return E(`getSystemInfoSync`)}function Et(e){return E(`getSystemInfoAsync`,e)}function Dt(){return E(`getAppBaseInfo`)}function Ot(){return E(`getDeviceInfo`)}function kt(e){n(e)&&bt.add(e)}function At(e){n(e)?bt.delete(e):bt.clear()}var jt=t({getUpdateManager:()=>Lt}),Mt=`onUpdateStatusChange`,Nt=`updatefail`,Pt=`updateready`,Ft=`noupdate`,It=`updating`;function Lt(){return Rt.getInstance()}var Rt=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=[],w.on(Mt,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===Nt){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Pt){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===It){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Ft){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,E(`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())}};Rt.getInstance();var zt=t({createCameraContext:()=>Bt});function Bt(){return new Vt}var Vt=class{takePhoto(e={}){return E(`takePhoto`,e)}startRecord(e={}){return E(`startRecordCamera`,e)}stopRecord(e={}){return E(`stopRecordCamera`,e)}},Ht=t({reportAnalytics:()=>Ut,reportEvent:()=>Wt});function Ut(...e){return E(`reportAnalytics`,e)}function Wt(e,t){return E(`reportAnalytics`,{eventId:e,data:t})}var Gt=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Kt=(()=>{let e={};for(let t=0;t<64;t++)e[k[t]]=t;return e})();function qt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Jt(e){return qt(e)?e:e&&e.buffer&&qt(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Yt(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 Xt(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=Kt[t[e]],o=Kt[t[e+1]],s=t[e+2]===`=`?0:Kt[t[e+2]],c=t[e+3]===`=`?0:Kt[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 Zt(e){let t=Jt(e);return t?{[Gt]:Yt(t)}:e}function Qt(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?Xt(e[Gt]):e}function $t(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=Qt(r);return{...e,advertisData:Qt(e.advertisData),serviceData:t}}function en(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map($t)}}function tn(e){return!e||typeof e!=`object`?e:{...e,value:Qt(e.value)}}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 rn(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=E(e,n(nn(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function A(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=x.store(e=>t(n(e)),!0);return r.set(t,i),E(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),x.remove(n),E(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())x.remove(e);return r.clear(),E(t)}}}var an=t({closeBluetoothAdapter:()=>vn,getBluetoothAdapterState:()=>_n,getBluetoothDevices:()=>gn,getConnectedBluetoothDevices:()=>hn,isBluetoothDevicePaired:()=>yn,makeBluetoothPair:()=>bn,offBluetoothAdapterStateChange:()=>mn,offBluetoothDeviceFound:()=>pn,onBluetoothAdapterStateChange:()=>fn,onBluetoothDeviceFound:()=>dn,openBluetoothAdapter:()=>un,startBluetoothDevicesDiscovery:()=>ln,stopBluetoothDevicesDiscovery:()=>cn}),on=A(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,en),sn=A(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function cn(e){return E(`stopBluetoothDevicesDiscovery`,e)}function ln(e){return E(`startBluetoothDevicesDiscovery`,e)}function un(e){return E(`openBluetoothAdapter`,e)}function dn(e){return on.on(e)}function fn(e){return sn.on(e)}function pn(e){return on.off(e)}function mn(e){return sn.off(e)}function hn(e){return rn(`getConnectedBluetoothDevices`,e,{transform:en})}function gn(e){return rn(`getBluetoothDevices`,e,{transform:en})}function _n(e){return E(`getBluetoothAdapterState`,e)}function vn(e){return E(`closeBluetoothAdapter`,e)}function yn(e){return E(`isBluetoothDevicePaired`,e)}function bn(e){return E(`makeBluetoothPair`,e)}var xn=t({closeBLEConnection:()=>Ln,createBLEConnection:()=>In,getBLEDeviceCharacteristics:()=>Fn,getBLEDeviceRSSI:()=>Pn,getBLEDeviceServices:()=>Nn,getBLEMTU:()=>Rn,notifyBLECharacteristicValueChange:()=>Mn,offBLECharacteristicValueChange:()=>jn,offBLEConnectionStateChange:()=>An,offBLEMTUChange:()=>Bn,onBLECharacteristicValueChange:()=>kn,onBLEConnectionStateChange:()=>On,onBLEMTUChange:()=>zn,readBLECharacteristicValue:()=>Dn,setBLEMTU:()=>En,writeBLECharacteristicValue:()=>Tn}),Sn=A(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Cn=A(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,tn),wn=A(`onBLEMTUChange`,`offBLEMTUChange`);function Tn(e){return rn(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:Zt(e.value)}:e}})}function En(e){return E(`setBLEMTU`,e)}function Dn(e){return E(`readBLECharacteristicValue`,e)}function On(e){return Sn.on(e)}function kn(e){return Cn.on(e)}function An(e){return Sn.off(e)}function jn(e){return Cn.off(e)}function Mn(e){return E(`notifyBLECharacteristicValueChange`,e)}function Nn(e){return E(`getBLEDeviceServices`,e)}function Pn(e){return E(`getBLEDeviceRSSI`,e)}function Fn(e){return E(`getBLEDeviceCharacteristics`,e)}function In(e){return E(`createBLEConnection`,e)}function Ln(e){return E(`closeBLEConnection`,e)}function Rn(e){return E(`getBLEMTU`,e)}function zn(e){return wn.on(e)}function Bn(e){return wn.off(e)}var Vn=t({getClipboardData:()=>Un,setClipboardData:()=>Hn});function Hn(e){return E(`setClipboardData`,e)}function Un(e){return E(`getClipboardData`,e)}var Wn=t({addPhoneContact:()=>Kn,chooseContact:()=>Gn});function Gn(e){return E(`chooseContact`,e)}function Kn(e){return E(`addPhoneContact`,e)}var qn=t({hideKeyboard:()=>Jn});function Jn(e){return E(`hideKeyboard`,e)}var Yn=t({offMemoryWarning:()=>Zn,onMemoryWarning:()=>Xn});function Xn(e){return E(`onMemoryWarning`,e)}function Zn(e){return E(`offMemoryWarning`,e)}var Qn=t({getNetworkType:()=>$n});function $n(e){return E(`getNetworkType`,e)}var er=t({makePhoneCall:()=>tr});function tr(e){return E(`makePhoneCall`,e)}var nr=t({scanCode:()=>rr});function rr(e){return E(`scanCode`,e)}var ir=t({offUserCaptureScreen:()=>sr,onUserCaptureScreen:()=>or}),ar=A(`onUserCaptureScreen`,`offUserCaptureScreen`),j;function or(e){if(typeof e==`function`)return j&&j!==e&&ar.off(j),j=e,ar.on(e)}function sr(e){if(!(typeof e==`function`&&e!==j))return j=void 0,ar.off(e)}var cr=t({vibrateLong:()=>ur,vibrateShort:()=>lr});function lr(e){return E(`vibrateShort`,e)}function ur(e){return E(`vibrateLong`,e)}var dr=t({extBridge:()=>fr,extOffBridge:()=>mr,extOnBridge:()=>pr,offLoginStatusChanged:()=>gr,onLoginStatusChanged:()=>hr});function fr({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),E(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function pr({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}`;E(i,{evtId:i,keep:r,success:n})}function mr({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}`;E(r,{evtId:r,success:n})}function hr(e){w.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function gr(){w.off(`notifyLoginStatusChanged`)}var _r=new WeakSet;function vr(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!_r.has(e)){_r.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{_r.delete(e)}}console.error(`[service] ${r} error:`,t)}function M(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?vr(e,t,i):console.error(`[service] ${i} error:`,t);return}}function N(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])M(e,a,n,r,i)}var yr=[`onLaunch`,`onShow`,`onHide`],br=[`globalData`],xr=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){yr.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)yr.includes(t)||br.includes(t)||(n(e[t])?this[t]=e[t].bind(this):this[t]=e[t])}invokeSomeLifecycle(){M(this,this.onLaunch,[this.options],`onLaunch`),M(this,this.onShow,[this.options],`onShow`)}appShow(){M(this,this.onShow,[this.options],`onShow`)}appHide(){M(this,this.onHide,[],`onHide`)}},Sr=new Set([`2d`]),Cr=new Set([`webgl`,`experimental-webgl`,`webgl2`]),wr=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Tr=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),Er=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Dr=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),Or=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),kr={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Ar=new Map,P={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function jr(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function Mr(e,t){!e||!t||Ar.set(e,t)}function Nr(e){return Ar.get(e)||null}function Pr(e,t){return e&&e[jr(t)]||null}function F(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>F(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}let t={};for(let[n,r]of Object.entries(e))t[n]=F(r);return t}w.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{Mr(e,t)}),w.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{Mr(e,t)});var Fr=1,Ir=1;function Lr(){let e=T.getPageInfo();return e?.bridgeId||e?.id||``}function I(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)&&n>=0?Math.floor(n):t}function Rr(e,t,n){w.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function zr(e){Promise.resolve().then(e)}function Br(e){return Object.prototype.toString.call(e)===`[object Object]`}function Vr(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function L(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=Vr(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>L(e));if(Br(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}return e}function R(e){return Array.from(e).map(e=>L(e))}function z(e=`canvas_resource`){return`${e}_${p()}`}var B=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=Fr++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:R(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Hr=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=x.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=x.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},Ur=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}async getImageData(e,t,n,r){return await this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};if(e===`createImageData`){let e=t[0],n=t[1];return{width:e,height:n,data:new Uint8ClampedArray(e*n*4)}}let n=wr.has(e)?z():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:n}),n)return new B(this.canvas,n)}},Wr=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=z(`webgl_extension_resource`),n=new B(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof B)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:R(t),resultId:r}),n}},Gr=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...kr,...Br(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(P,t))return P[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:L(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(P.VIEWPORT,[0,0,e,t]),this.state.set(P.SCISSOR_BOX,[0,0,e,t]),this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(P.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(P.DEPTH_CLEAR_VALUE,1),this.state.set(P.DEPTH_WRITEMASK,!0),this.state.set(P.DEPTH_FUNC,P.LESS),this.state.set(P.STENCIL_CLEAR_VALUE,0),this.state.set(P.LINE_WIDTH,1),this.state.set(P.CULL_FACE_MODE,P.BACK),this.state.set(P.FRONT_FACE,P.CCW),this.state.set(P.ACTIVE_TEXTURE,P.TEXTURE0),this.state.set(P.PACK_ALIGNMENT,4),this.state.set(P.UNPACK_ALIGNMENT,4),this.state.set(P.CURRENT_PROGRAM,null),this.state.set(P.ARRAY_BUFFER_BINDING,null),this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(P.TEXTURE_BINDING_2D,null),this.state.set(P.FRAMEBUFFER_BINDING,null),this.state.set(P.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=F(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(F(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return F(e)}queueError(e){e&&e!==P.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(R(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:R(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=z(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new B(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:R(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),P.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,P.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t);default:break}let n=Tr.get(e)||Er.get(e);if(n)return this.createResource(e,t,n);if(Or.has(e)){let n=t[0];return n instanceof B&&n.resourceType===Or.get(e)&&!n.deleted}Dr.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:R(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(P.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(P.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(P.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(P.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(P.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(P.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(P.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(P.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(P.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(P.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(P.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(P.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(P.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===P.ARRAY_BUFFER?this.state.set(P.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===P.ELEMENT_ARRAY_BUFFER&&this.state.set(P.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===P.TEXTURE_2D&&this.state.set(P.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(P.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(P.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}default:break}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?F(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof B)||e.resourceType!==`shader`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.SHADER_TYPE:return e.metadata.shaderType;case P.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof B)||e.resourceType!==`program`)return null;switch(t){case P.DELETE_STATUS:return e.deleted;case P.LINK_STATUS:return!!e.metadata.linkStatus;case P.VALIDATE_STATUS:return!!e.metadata.validateStatus;case P.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=z(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new Wr(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},Kr=class{constructor({nodeId:e,bridgeId:t=Lr(),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||Nr(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=I(n,300),this._height=I(r,150)}get width(){return this._width}set width(e){this._width=I(e,300),this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width})}get height(){return this._height}set height(e){this._height=I(e,150),this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height})}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=jr(n),i=Cr.has(n);if(!Sr.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?Pr(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=z(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:L(t)});let s=i?new Gr(this,o,r,t,a):new Ur(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=z(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=F(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new Hr(this,z(`canvas_image`))}requestAnimationFrame(e){let t=Ir++,r=x.store(t=>{n(e)&&e(t)});return Rr(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){Rr(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){return new Promise((a,o)=>{let s=x.store(e=>{a(e)});this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s})})}toDataURL(e=`image/png`,t){return new Promise(n=>{let r=x.store(e=>{n(e)});this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:r})})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,zr(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback||e.typedArrayUpdateId)?x.store(e=>this.applyFlushFeedback(e)):void 0;Rr(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:t})}};function qr(e,t=Lr()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(Mr(t,e.webglCapabilities),new Kr({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function Jr(e,t=Lr()){return Array.isArray(e)?e.map(e=>Jr(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:qr(e.node,t)}:e}function Yr(e={}){let t=I(e.width,300),n=I(e.height,150),r=e.type||`2d`,i=z(`offscreen_canvas`),a=Lr();return Rr(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new Kr({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:Nr(a)})}var Xr=t({createSelectorQuery:()=>Zr});function Zr(){return new ti}function Qr(){return T.getPageInfo()}function $r(){let e=Qr();return e?.__id__||e?.id}function ei(){let e=Qr();return e?.bridgeId||e?.id}var ti=class{constructor(){this.__componentId=$r(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new ni(this,this.__componentId,e,!0)}selectAll(e){return new ni(this,this.__componentId,e,!1)}selectViewport(){return new ni(this,$r(),``,!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=ei();E(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Jr(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},ni=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)}},ri=t({createIntersectionObserver:()=>ii});function ii(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new ai(e,{thresholds:n,initialRatio:r,observeAll:i})}var ai=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=x.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);E(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){E(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},oi=t({createMediaQueryObserver:()=>ci});function si(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 ci(e,t={}){return new li(e,t)}var li=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=x.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){E(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),x.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),E(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:si(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,E(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(x.remove(this._callbackId),this._callbackId=null)}};function ui(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 di(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 fi(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function pi(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=ui(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function mi(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&fi(e.path,t)||fi(t,e.path)}function hi(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:pi(e.expression)}))}function gi(e,t,r=e.data,i=e.__info__||{}){for(let a of hi(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>mi(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 _i(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function vi(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 yi(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=ui(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=y(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;di(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=[],gi(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:_i(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:vi(e,a.changes)}}function V(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);s.length===1&&c===a.oldValue&&!t?.observeAssignments||(r(o)?M(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&M(e,o,[c,a.oldValue,s],`property observer`))}}var bi=new Map;function xi(e){return bi.has(e)||bi.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),bi.get(e)}function H(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return x.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function Si(e){let t=xi(e);t.depth++}function Ci(e){let t=xi(e);t.depth>0&&t.depth--,t.depth===0&&Ti(e)}function wi(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=ui(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(Ee({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function U(e,t,n,r,i=[]){let a=xi(e),o=a.byModuleId.get(t),s=wi(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&&Ti(e)}))}function Ti(e){let t=bi.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,w.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function Ei(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>Ei(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=Ei(n)),e),{}):e}function Di(e){if(e){let t={};for(let n in e){let r=ge(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ki),default:r.value}}return t}}var Oi=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ki(e){return Array.isArray(e)?e.map(e=>ki(e)):e===null||e===``?null:Oi.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function Ai(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 ji(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];typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?n[e]=g(r,i):n[e]=i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function W(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 Mi(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 Ni(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 Pi(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 Fi(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!W(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&&Ni(i,n)&&(o[r]=y(Pi(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 Ii=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],Li=[`show`,`hide`,`resize`,`routeDone`],Ri=class e{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=y(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__eventAttr__=t.eventAttr,this.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,ge(t)]))}init({deferInitialData:e=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=be(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,w.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__=[],U(this.bridgeId,this.__id__,{},H(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)}`}else 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(`/`)}else return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(J.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(J.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(J.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=yi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),V(this,n.propertyChanges);return}let r=Fi(this,J.instances[this.bridgeId],n.changedData);U(this.bridgeId,this.__id__,n.changedData,H(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)}),V(this,n.propertyChanges)}#u(){Ii.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&Li.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&&(gi(this,e),V(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),M(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return gi(this,o),V(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=be(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 Zr().in(this)}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]),n=t.find(n=>W(n,this.__id__,t)&&Mi(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]);return t.filter(n=>W(n,this.__id__,t)&&Mi(e,n))}selectOwnerComponent(){let e=Object.values(J.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return ii(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Si(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=Fi(this,J.instances[this.bridgeId],e);U(this.bridgeId,this.__id__,e,H(this,t),n),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];Ci(this.bridgeId)}}createMediaQueryObserver(e){return ci(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),E(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),E(`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=Ai(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 J.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?J.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=J.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=J.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(J.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)}},G=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,ji(this.moduleInfo,this.behaviors),this.noReferenceData=Ei(this.moduleInfo.data||{})}getProps(){let e=Di(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}},zi=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=y(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1}={}){this.#e(),this.#t(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,w.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__=[],U(this.bridgeId,this.__id__,{},H(this,e))}setData(e,t){let n=yi(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=Fi(this,J.instances[this.bridgeId],n.changedData);U(this.bridgeId,this.__id__,n.changedData,H(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{U(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Zr().in(this)}getTabBar(){let e=Object.values(J.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&W(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]||{}),n=t.find(n=>W(n,this.__id__,t)&&Mi(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]||{});return t.filter(n=>W(n,this.__id__,t)&&Mi(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];n(t)?this[e]=t.bind(this):this[e]=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`)}},K=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,ji(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=Ei(this.moduleInfo.data||{})}},Bi=class{static type=`app`;constructor(e){this.moduleInfo=e}},q=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}T.setInitId(n),b(`app`),b(r),w.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}})}createAppModule(e){let t=new Bi(e);this.staticModules[Bi.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))b(e);if(n===K.type){let n=new K(e,t);this.staticModules[r]=n}else if(n===G.type){let n=new G(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[Bi.type]}getModuleByPath(e){return this.staticModules[e]}},J=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.instances={},this.pageStates=new Map}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=e)}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e||{},i=q.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(i.moduleInfo,this.defaultApp),this.defaultApp={},this.app=new xr(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){T.pushStack(e)}stackHide(e){T.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=q.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===G.type){let e=new Ri(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||T.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}else if(m.type===K.type){let e=new zi(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,T.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}else 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__!==G.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__===G.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__===G.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__===K.type?i.push(e):e.__type__===G.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__===K.type||e.__type__===G.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__===G.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__===K.type?r.push(e):e.__type__===G.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__===G.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===G.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),T.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__===K.type?r.push(e):e.__type__===G.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__===G.type&&i.componentError(r)}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===G.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__===G.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})}},Vi=t({getEnterOptionsSync:()=>Ui,getLaunchOptionsSync:()=>Hi});function Hi(){return J.app?.options}function Ui(){return J.app?.options}var Wi=t({getLocation:()=>Gi,offLocationChange:()=>Xi,onLocationChange:()=>Yi,openLocation:()=>qi,startLocationUpdate:()=>Ki,stopLocationUpdate:()=>Ji});function Gi(e){return E(`getLocation`,e)}function Ki(e){return E(`startLocationUpdate`,e)}function qi(e){return E(`openLocation`,e)}function Ji(e){return E(`stopLocationUpdate`,e)}function Yi(e){e&&E(`onLocationChange`,{success:x.store(e,!0)})}function Xi(e){if(e){let t=x.store(e,!0);E(`offLocationChange`,{success:t}),x.remove(t)}else E(`offLocationChange`),x.remove()}var Zi=t({createMapContext:()=>Qi});function Qi(e,t){return new $i({mapId:e,obj:t})}var $i=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 E(e,{mapId:this.opts.mapId,...t})}},ea=t({createInnerAudioContext:()=>ra}),ta=1,na=class{constructor(){this._audioId=ta++,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={},E(`audioCreate`,{audioId:this._audioId}),E(`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,E(`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,E(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,E(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,E(`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)),E(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,E(`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,E(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,E(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,E(`audioStop`,{audioId:this._audioId})}seek(e){E(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){E(`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 ra(){return new na}var ia=t({chooseImage:()=>ca,compressImage:()=>sa,previewImage:()=>oa,saveImageToPhotosAlbum:()=>aa});function aa(e){return E(`saveImageToPhotosAlbum`,e)}function oa(e){return E(`previewImage`,e)}function sa(e){return E(`compressImage`,e)}function ca(e){return E(`chooseImage`,e)}var la=t({chooseMedia:()=>fa,chooseVideo:()=>da,createVideoContext:()=>ua});function ua(e,t){return new pa({videoId:e,obj:t})}function da(e){return E(`chooseVideo`,e)}function fa(e){return E(`chooseMedia`,e)}var pa=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={}){E(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},ma=t({exitMiniProgram:()=>va,navigateBackMiniProgram:()=>_a,navigateToMiniProgram:()=>ga,restartMiniProgram:()=>ha});function ha(e){return E(`restartMiniProgram`,e)}function ga(e){return E(`navigateToMiniProgram`,e)}function _a(e){return E(`navigateBackMiniProgram`,e)}function va(e){return E(`exitMiniProgram`,e)}var ya=t({downloadFile:()=>ba});function ba(e){return E(`downloadFile`,e)}var xa=`__diminaArrayBufferBase64`,Y=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Sa=Object.fromEntries([...Y].map((e,t)=>[e,t]));function Ca(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function wa(e){return Ca(e)?e:e&&Ca(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Ta(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=Y[t[r]>>2],n+=Y[(t[r]&3)<<4|t[r+1]>>4],n+=Y[(t[r+1]&15)<<2|t[r+2]>>6],n+=Y[t[r+2]&63];return r<t.length&&(n+=Y[t[r]>>2],r+1<t.length?(n+=Y[(t[r]&3)<<4|t[r+1]>>4],n+=`${Y[(t[r+1]&15)<<2]}=`):n+=`${Y[(t[r]&3)<<4]}==`),n}function Ea(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=Sa[t[e]],o=Sa[t[e+1]],s=t[e+2]===`=`?0:Sa[t[e+2]],c=t[e+3]===`=`?0:Sa[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 Da(e){let t=wa(e);return t?{[xa]:Ta(t)}:e}function Oa(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:Ea(t[xa])}}function ka(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function X(e,t,n={}){return E(e,{socketId:t,...n,keep:!0})}function Z(e,t,n={},r=e=>e){let i=new Set,a,o;function s(){if(!a)return;let e=a;a=void 0,x.remove(e),E(t,{...n,callbackId:e,keep:!0})}return{on(t){if(!(typeof t!=`function`||i.has(t))&&(i.add(t),!a))return a=x.store(e=>{let t=r(e);for(let e of[...i])e(t);o?.()},!0),E(e,{...n,callbackId:a,success:a,keep:!0})},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return s()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return s();a&&x.remove(a),a=void 0},hasListeners(){return i.size>0},setAfterEmit(e){o=e}}}var Aa=t({offLocalServiceDiscoveryStop:()=>Ra,offLocalServiceFound:()=>Ba,offLocalServiceLost:()=>Ha,offLocalServiceResolveFail:()=>Wa,onLocalServiceDiscoveryStop:()=>La,onLocalServiceFound:()=>za,onLocalServiceLost:()=>Va,onLocalServiceResolveFail:()=>Ua,startLocalServiceDiscovery:()=>Fa,stopLocalServiceDiscovery:()=>Ia}),ja=Z(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),Ma=Z(`onLocalServiceFound`,`offLocalServiceFound`),Na=Z(`onLocalServiceLost`,`offLocalServiceLost`),Pa=Z(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function Fa(e={}){return E(`startLocalServiceDiscovery`,e)}function Ia(e={}){return E(`stopLocalServiceDiscovery`,e)}function La(e){return ja.on(e)}function Ra(e){return ja.off(e)}function za(e){return Ma.on(e)}function Ba(e){return Ma.off(e)}function Va(e){return Na.on(e)}function Ha(e){return Na.off(e)}function Ua(e){return Pa.on(e)}function Wa(e){return Pa.off(e)}var Ga=t({request:()=>Ka});function Ka(e){return E(`request`,e)}var qa=t({createTCPSocket:()=>Ya}),Ja=class{constructor(e){this.socketId=e,this.events={bindWifi:Z(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:Z(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:Z(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:Z(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:Z(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},Oa)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return X(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=X(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return X(`TCPSocket.connect`,this.socketId,e)}write(e){return X(`TCPSocket.write`,this.socketId,{data:Da(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 Ya(){return new Ja(ka(`tcp`))}var Xa=t({createUDPSocket:()=>Qa}),Za=class{constructor(e){this.socketId=e,this.events={close:Z(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:Z(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:Z(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:Z(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},Oa)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return X(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=X(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return X(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return X(`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 X(e,this.socketId,{...t,message:Da(t.message)})}};function Qa(){return new Za(ka(`udp`))}var $a=t({uploadFile:()=>ro}),eo=1;function to(){return`upload_${Date.now()}_${eo++}`}function no(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function ro(e={}){let t=to(),n=no(),r=no(),i=x.store(e=>n.dispatch(e),!0,`${t}_progress`),a=x.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,x.remove(i),x.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{E(`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||E(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var io=t({closeSocket:()=>co,connectSocket:()=>oo,offSocketClose:()=>_o,offSocketError:()=>ho,offSocketMessage:()=>po,offSocketOpen:()=>uo,onSocketClose:()=>go,onSocketError:()=>mo,onSocketMessage:()=>fo,onSocketOpen:()=>lo,sendSocketMessage:()=>so});function Q(e,t,r={}){let i=new Map;return{on(t){if(!n(t)||i.has(t))return;let a=x.store(e=>t(e),!0);i.set(t,a);try{return E(e,{...r,callback:a,keep:!0})}catch(e){throw i.delete(t),x.remove(a),e}},off(e){if(n(e)){let n=i.get(e);return n?(i.delete(e),x.remove(n),E(t,{...r,callback:n,keep:!0})):void 0}for(let e of i.values())x.remove(e);return i.clear(),E(t,{...r,keep:!0})}}}var ao=class{constructor(e){this.socketId=e,this._readyState=0,this._events={open:Q(`onSocketOpen`,`offSocketOpen`,{socketId:e}),message:Q(`onSocketMessage`,`offSocketMessage`,{socketId:e}),error:Q(`onSocketError`,`offSocketError`,{socketId:e}),close:Q(`onSocketClose`,`offSocketClose`,{socketId:e})}}send(e={}){let{data:t,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,data:t,...o};return n(r)&&(s.success=x.store(r)),n(i)&&(s.fail=x.store(i)),n(a)&&(s.complete=x.store(a)),E(`sendSocketMessage`,s)}close(e={}){let{code:t=1e3,reason:r=``,success:i,fail:a,complete:o,...s}=e,c={socketId:this.socketId,code:t,reason:r,...s};return n(i)&&(c.success=x.store(i)),n(a)&&(c.fail=x.store(a)),n(o)&&(c.complete=x.store(o)),E(`closeSocket`,c)}onOpen(e){return this._events.open.on(e)}offOpen(e){return this._events.open.off(e)}onMessage(e){return this._events.message.on(e)}offMessage(e){return this._events.message.off(e)}onError(e){return this._events.error.on(e)}offError(e){return this._events.error.off(e)}onClose(e){return this._events.close.on(e)}offClose(e){return this._events.close.off(e)}get readyState(){return this._readyState}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}},$={open:Q(`onSocketOpen`,`offSocketOpen`),message:Q(`onSocketMessage`,`offSocketMessage`),error:Q(`onSocketError`,`offSocketError`),close:Q(`onSocketClose`,`offSocketClose`)};function oo(e={}){let{url:t,header:r={},protocols:i=[],tcpNoDelay:a=!1,perMessageDeflate:o=!1,timeout:s,forceCellularNetwork:c=!1,success:l,fail:u,complete:d,...f}=e;if(!t){let e=Error(`url is required`);throw n(u)&&u(e),n(d)&&d(e),e}let p=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,m=new ao(p),h={socketId:p,url:t,header:r,protocols:i,tcpNoDelay:a,perMessageDeflate:o,timeout:s,forceCellularNetwork:c,...f};return n(l)&&(h.success=x.store(e=>{m._readyState=ao.OPEN,l(e)})),n(u)&&(h.fail=x.store(e=>{m._readyState=ao.CLOSED,u(e)})),n(d)&&(h.complete=x.store(d)),E(`connectSocket`,h),m}function so(e){return E(`sendSocketMessage`,e)}function co(e){return E(`closeSocket`,e)}function lo(e){return $.open.on(e)}function uo(e){return $.open.off(e)}function fo(e){return $.message.on(e)}function po(e){return $.message.off(e)}function mo(e){return $.error.on(e)}function ho(e){return $.error.off(e)}function go(e){return $.close.on(e)}function _o(e){return $.close.off(e)}var vo=t({getAccountInfoSync:()=>yo});function yo(){return E(`getAccountInfoSync`)}var bo=t({authorize:()=>xo});function xo(e){return E(`authorize`,e)}var So=t({login:()=>Co});function Co(e){return E(`login`,e)}var wo=t({login:()=>To});function To(e){return E(`login`,e)}var Eo=t({getPrivacySetting:()=>Do});function Do(e){return E(`getPrivacySetting`,e)}var Oo=t({getSetting:()=>Ao,openSetting:()=>ko});function ko(e){return E(`openSetting`,e)}function Ao(e){return E(`getSetting`,e)}var jo=t({getUserInfo:()=>Mo});function Mo(e){return E(`getUserInfo`,e)}var No=t({requestPayment:()=>Po});function Po(e){return E(`requestPayment`,e)}var Fo=t({hideShareMenu:()=>Ro,showShareImageMenu:()=>Lo,showShareMenu:()=>Io});function Io(e){return E(`shareShareMenu`,e)}function Lo(e){return E(`showShareImageMenu`,e)}function Ro(e){return E(`hideShareMenu`,e)}var zo=t({clearStorage:()=>qo,clearStorageSync:()=>Uo,getStorage:()=>Go,getStorageInfo:()=>Yo,getStorageInfoSync:()=>Jo,getStorageSync:()=>Vo,removeStorage:()=>Ko,removeStorageSync:()=>Ho,setStorage:()=>Wo,setStorageSync:()=>Bo});function Bo(...e){return E(`setStorageSync`,e)}function Vo(e){return E(`getStorageSync`,e)}function Ho(e){return E(`removeStorageSync`,e)}function Uo(){return E(`clearStorageSync`)}function Wo(e){return E(`setStorage`,e)}function Go(e){return E(`getStorage`,e)}function Ko(e){return E(`removeStorage`,e)}function qo(){return E(`clearStorage`)}function Jo(){return E(`getStorageInfoSync`)}function Yo(e){return E(`getStorageInfo`,e)}var Xo=t({createAnimation:()=>Zo});function Zo(e={}){return new Qo(e)}var Qo=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,v(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,v(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,v(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,v(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,v(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,v(e)]}),this}},$o=t({setBackgroundColor:()=>ts,setBackgroundTextStyle:()=>es});function es(e){return E(`setBackgroundTextStyle`,e)}function ts(e){return E(`setBackgroundColor`,e)}var ns=t({canvasToTempFilePath:()=>os,createCanvasContext:()=>is,createContext:()=>rs,createOffscreenCanvas:()=>Yr,drawCanvas:()=>as});function rs(){return new cs}function is(e,t){return new cs(e,ss(t))}function as(e={}){let t={...e,moduleId:e.moduleId||ss(e.component)};delete t.component,E(`drawCanvas`,t,`render`)}function os(e={},t){let n={...e,moduleId:e.moduleId||ss(t||e.component)};return delete n.component,E(`canvasToTempFilePath`,n,`render`)}function ss(e){return e?.__id__||T.getPageInfo()?.id}var cs=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(as({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},ls=t({nextTick:()=>ps}),us=[],ds=null;function fs(){let e=us;us=[],ds=null;for(let t=0;t<e.length;t++)e[t]()}function ps(e){n(e)&&(us.push(e),ds||=setTimeout(fs,0))}var ms=t({disableAlertBeforeUnload:()=>Ss,enableAlertBeforeUnload:()=>xs,hideLoading:()=>bs,hideToast:()=>gs,showActionSheet:()=>ys,showLoading:()=>vs,showModal:()=>_s,showToast:()=>hs});function hs(e){return E(`showToast`,e)}function gs(e){return E(`hideToast`,e)}function _s(e){return E(`showModal`,e)}function vs(e){return E(`showLoading`,e)}function ys(e){return E(`showActionSheet`,e)}function bs(e){return E(`hideLoading`,e)}function xs(e){return E(`enableAlertBeforeUnload`,e)}function Ss(e){return E(`disableAlertBeforeUnload`,e)}var Cs=t({getMenuButtonBoundingClientRect:()=>Ts,offMenuButtonBoundingClientRectWeightChange:()=>Ds,onMenuButtonBoundingClientRectWeightChange:()=>Es}),ws=new Set;C.onUpdate(e=>{e.menuRect&&ws.forEach(t=>t(e.menuRect))});function Ts(){return E(`getMenuButtonBoundingClientRect`)}function Es(e){n(e)&&ws.add(e)}function Ds(e){n(e)?ws.delete(e):ws.clear()}var Os=t({hideHomeButton:()=>Ns,hideNavigationBarLoading:()=>Ms,setNavigationBarColor:()=>js,setNavigationBarTitle:()=>As,showNavigationBarLoading:()=>ks});function ks(e){return E(`showNavigationBarLoading`,e)}function As(e){return E(`setNavigationBarTitle`,e)}function js(e){return E(`setNavigationBarColor`,e)}function Ms(e){return E(`hideNavigationBarLoading`,e)}function Ns(e){return E(`hideHomeButton`,e)}var Ps=t({startPullDownRefresh:()=>Is,stopPullDownRefresh:()=>Fs});function Fs(e){return E(`stopPullDownRefresh`,e)}function Is(e){return E(`startPullDownRefresh`,e)}var Ls=t({pageScrollTo:()=>Rs});function Rs(e){return E(`pageScrollTo`,e)}var zs=t({hideTabBar:()=>Us,hideTabBarRedDot:()=>qs,removeTabBarBadge:()=>Gs,setTabBarBadge:()=>Ws,setTabBarItem:()=>Vs,setTabBarStyle:()=>Bs,showTabBar:()=>Hs,showTabBarRedDot:()=>Ks});function Bs(e){return E(`setTabBarStyle`,e)}function Vs(e){return E(`setTabBarItem`,e)}function Hs(e){return E(`showTabBar`,e)}function Us(e){return E(`hideTabBar`,e)}function Ws(e){return E(`setTabBarBadge`,e)}function Gs(e){return E(`removeTabBarBadge`,e)}function Ks(e){return E(`showTabBarRedDot`,e)}function qs(e){return E(`hideTabBarRedDot`,e)}var Js=t({onWindowResize:()=>Ys});function Ys(e){e&&E(`onWindowResize`,{success:e})}var Xs=Object.assign({"./core/base/app-event/index.js":He,"./core/base/index.js":ot,"./core/base/performance/index.js":dt,"./core/base/subpackage/index.js":gt,"./core/base/system/index.js":yt,"./core/base/update/index.js":jt,"./core/camera/index.js":zt,"./core/data-analysis/index.js":Ht,"./core/device/bluetooth/index.js":an,"./core/device/bluetooth-ble/index.js":xn,"./core/device/clipboard/index.js":Vn,"./core/device/contact/index.js":Wn,"./core/device/keyboard/index.js":qn,"./core/device/memory/index.js":Yn,"./core/device/network/index.js":Qn,"./core/device/phone/index.js":er,"./core/device/scan/index.js":nr,"./core/device/screen/index.js":ir,"./core/device/vibrate/index.js":cr,"./core/ext/index.js":dr,"./core/file/index.js":Qe,"./core/life-cycle/index.js":Vi,"./core/location/index.js":Wi,"./core/map/index.js":Zi,"./core/media/audio/index.js":ea,"./core/media/image/index.js":ia,"./core/media/video/index.js":la,"./core/navigate/index.js":ma,"./core/network/download/index.js":ya,"./core/network/mdns/index.js":Aa,"./core/network/request/index.js":Ga,"./core/network/tcp/index.js":qa,"./core/network/udp/index.js":Xa,"./core/network/upload/index.js":$a,"./core/network/websocket/index.js":io,"./core/open-api/account-info/index.js":vo,"./core/open-api/authorize/index.js":bo,"./core/open-api/index.js":So,"./core/open-api/login/index.js":wo,"./core/open-api/privacy/index.js":Eo,"./core/open-api/setting/index.js":Oo,"./core/open-api/user-info/index.js":jo,"./core/payment/index.js":No,"./core/route/index.js":Ie,"./core/share/index.js":Fo,"./core/storage/index.js":zo,"./core/ui/animation/index.js":Xo,"./core/ui/background/index.js":$o,"./core/ui/canvas/index.js":ns,"./core/ui/custom-component/index.js":ls,"./core/ui/interaction/index.js":ms,"./core/ui/menu/index.js":Cs,"./core/ui/navigation-bar/index.js":Os,"./core/ui/pull-down-refresh/index.js":Ps,"./core/ui/scroll/index.js":Ls,"./core/ui/tab-bar/index.js":zs,"./core/ui/window/index.js":Js,"./core/wxml/intersection-observer/index.js":ri,"./core/wxml/media-query-observer/index.js":oi,"./core/wxml/selector-query/index.js":Xr}),Zs={};for(let e of Object.values(Xs))for(let[t,n]of Object.entries(e))Zs[t]=n;function Qs(e){for(let t of e||[])typeof t!=`string`||Object.prototype.hasOwnProperty.call(Zs,t)||t in Object.prototype||Object.defineProperty(Zs,t,{value:(...e)=>E(t,...e),writable:!0,enumerable:!0,configurable:!0})}var $s=new Proxy(Zs,{get(e,t,n){let r=Reflect.get(e,t,n);return typeof r==`function`||r!==void 0||t===`webpackJsonp`?r:(...e)=>E(t,...e)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),ec=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}Qs(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=$s;globalThis.modRequire=b,globalThis.modDefine=ae,globalThis.global={},globalThis.App=(e={})=>{q.createAppModule(e),J.createApp()},globalThis.Page=e=>{q.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Component=e=>{q.createModule(e,globalThis.__extraInfo,G.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>J.getApp(e),globalThis.getCurrentPages=()=>T.stack()}},tc={navigateBack:Ve,navigateTo:Be,reLaunch:Re,redirectTo:ze,switchTab:Le};return new class{constructor(){console.log(`[service] init`),this.env=ec,this.message=w,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,scene:l}=e;o&&C.init(o),J.setAppLaunchOptions({scene:l,pagePath:r,query:s}),q.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c})}),this.message.on(`hostEnvUpdate`,e=>{C.update(e)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await J.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;x.invoke(t,n)}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=x.store(e=>s(r.success,e))),r.fail&&(o=x.store(e=>s(r.fail,e)));let c=x.store(e=>{s(r.complete,e),x.remove(a),x.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e,a=q.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=q.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=J.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});w.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,()=>{J.appShow()}),this.message.on(`appHide`,()=>{J.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{J.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{J.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{J.createInstance(e)}),this.message.on(`mA`,e=>{J.moduleAttached(e)}),this.message.on(`mR`,e=>{J.moduleReady(e)}),this.message.on(`mU`,e=>{J.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{J.pageUnload(e)}),this.message.on(`pageShow`,e=>{J.pageShow(e)}),this.message.on(`pageReady`,e=>{J.pageReady(e)}),this.message.on(`pageHide`,e=>{J.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{J.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{J.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=J.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=>{J.pageScroll(e)}),this.message.on(`pageResize`,e=>{J.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{J.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;J.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{J.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 J.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}})}tc[t]?.({url:n,...e.params})})}}})();
|