@melt-js/libs-core 2026.11.14 → 2026.11.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/demo/index.js +1 -0
- package/dist/browser.mjs +50 -0
- package/dist/hel-deployment.json +8 -0
- package/package.json +16 -4
- package/scripts/build-browser.mjs +13 -0
- package/scripts/component-events.mjs +57 -0
- package/scripts/hel-build-paths.cjs +48 -0
- package/scripts/package-env.cjs +15 -2
- package/src/browser.d.mts +2 -0
- package/src/browser.mjs +3 -0
- package/src/demo/docs.d.mts +25 -0
- package/src/demo/docs.mjs +75 -0
- package/src/demo/download.d.mts +33 -0
- package/src/demo/download.mjs +118 -0
- package/src/demo/fullscreen.d.mts +8 -0
- package/src/demo/fullscreen.mjs +80 -0
- package/src/demo/index.d.mts +4 -0
- package/src/demo/index.mjs +4 -0
- package/src/demo/model.d.mts +12 -0
- package/src/demo/model.mjs +203 -0
- package/src/demo/runtime.mjs +104 -0
- package/src/remote.d.mts +1 -0
- package/src/remote.mjs +37 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ import { preloadHelLibs, loadHelLib } from '@melt-js/libs-core'
|
|
|
13
13
|
// 先绑定宿主的 Vue / React 共享运行时。
|
|
14
14
|
await preloadHelLibs({
|
|
15
15
|
type: 'custom',
|
|
16
|
-
base: 'http://
|
|
16
|
+
base: 'http://xx.xx.xx.xx',
|
|
17
17
|
deps: [
|
|
18
18
|
'@melt-js/comps-vue3',
|
|
19
19
|
'https://xxx.com/xxx-melt-js/comps-vue3-antd@1.1.1',
|
|
@@ -37,7 +37,7 @@ const charts = await loadHelLib('@example/comps-charts@1.1.1', { type: 'github'
|
|
|
37
37
|
|
|
38
38
|
公共库没有默认组织或 scope。`@melt-js/libs-xxx@1.1.1` 和 `libs-xxx@1.1.1` 在 unpkg 是两个不同的 npm 包,分别保留原路径;其他 scope 也一样。GitHub 从显式 scope 推导 owner;npm scope 与 GitHub owner 不同或使用自定义域名时,传 `base` 覆盖。
|
|
39
39
|
|
|
40
|
-
SFTP 的 base 只配置站点根 `http://
|
|
40
|
+
SFTP 的 base 只配置站点根 `http://xx.xx.xx.xx`。`@melt-js/comps-vue3`、`@other/comps-vue3`、`comps-vue3` 分别解析到 `/@melt-js/comps-vue3`、`/@other/comps-vue3`、`/comps-vue3`,不会自动补 scope。为兼容带命名空间的旧 base,完整 scoped 引用会替换 base 末尾的 `/@scope`,避免重复。
|
|
41
41
|
|
|
42
42
|
- `type` 选择默认 base 和拼接逻辑,`base` 可以覆盖预设;完整 HTTP(S) URL 保持自己的域名与目录。
|
|
43
43
|
- `/comps-vue3` 与 `comps-vue3` 都相对 base 目录;不会丢失 `/@melt-js` 等前缀。
|
|
@@ -167,6 +167,11 @@ Vite / Vue CLI / CRA / Umi 配置先导入本包 bootstrap,原 `dev` / `build`
|
|
|
167
167
|
`REMOTE_TARGET` 支持 `auto/local/sftp/github/unpkg`;每个 `*_PACKAGE` 可单独使用 `*_TARGET` / `*_URL` 覆盖。
|
|
168
168
|
`*_VERSION=installed` 通过已安装依赖的公开入口解析其包版本;显式版本与 `latest` 也受支持。
|
|
169
169
|
未配置工作区时可独立 localhost 开发、unpkg 构建;私有 SFTP/GitHub 地址由消费包 `.env.local` 或进程变量提供。
|
|
170
|
+
`HEL_RELATIVE_PATH=1` 让生产构建的 `HEL_APP_HOME_PAGE` 默认为 `/`;已有 HTTP(S) homePage 则只保留 pathname。
|
|
171
|
+
因此 HTML、JS/CSS 与 `hel-meta.json` 从同一 homePage 生成站点根路径,静态产物可更换域名;部署目录段保持不变。
|
|
172
|
+
该开关不改变开发或 `HEL_LOCAL_BUILD=1` 联调构建;`0` 或未设置时保持原行为。
|
|
173
|
+
HEL 配置与元数据脚本通过 `@melt-js/libs-core/scripts/hel-build-paths.cjs` 适配自身直接声明的 `hel-dev-utils`,
|
|
174
|
+
使显式 `/` 不再回退到 localhost,并统一 Windows 路径分隔符、保留根目录 `webDirPath=/`。
|
|
170
175
|
只有公共地址会生成 `VITE_` / `VUE_APP_` 等前端变量,不复制 SFTP 凭据。
|
|
171
176
|
|
|
172
177
|
发布顺序:先发布包含该入口的新版 `libs-core`,再发布/交付使用它的包。
|
|
@@ -185,3 +190,15 @@ const inlineProps = parseCode('export default { props: { title: String } }')
|
|
|
185
190
|
提供同步/异步文件解析、源码解析与 TypeScript 类型提取,供 Vue 2 / Vue 3 leva 的 schema CLI 共用。此子路径是 Node 专用工具,不改变默认浏览器入口;Babel、SFC 编译器和 JSDoc 解析依赖由本包携带。
|
|
186
191
|
|
|
187
192
|
CLI 发布后也会调用本包,因此 leva 包将 `@melt-js/libs-core` 声明在 `dependencies`,而非仅放在 `devDependencies`。发布时先发布包含此子路径的新版 `libs-core`,再发布依赖它的 leva 包,不能让新 CLI 引用尚无此入口的旧版 core。源码出处与适配记录见 `scripts/vdoc-parser/NOTICE.md`。
|
|
193
|
+
## HTML 浏览器入口
|
|
194
|
+
|
|
195
|
+
`pnpm run build` 生成 `dist/browser.mjs`,`pnpm pack` 前自动构建。该文件打包 core 和 hel-micro 的浏览器依赖,可通过 unpkg 直接用于原生 ESM HTML,导出 core 加载 API 及 `bindReactRuntime`。框架适配层仍使用各自的 `src/index.mjs`,通过 importmap 将 `@melt-js/libs-core` 指向此入口,并将 Vue/React 映射到宿主同一运行时。
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## Demo 公共能力
|
|
199
|
+
|
|
200
|
+
`@melt-js/libs-core/demo` 提供 `buildDownloadFile`、`createDownloadController`、`buildComponentDocs`、`componentEvents`、`resolveModels` 和 `createDemoFullscreen`。它不引入 Vue、React、Leva 或 Tweakpane,也不附带 UI 样式。三个框架的 leva 包负责 Panel、Playground、文档区与按钮展示。
|
|
201
|
+
|
|
202
|
+
下载 HTML 只引用 unpkg 的框架、core 浏览器产物、框架适配层和组件包,使用 `defineHelComponent` 懒加载组件。`libName` 支持版本号。单文件需联网,新增入口与组件导出需实际发布后才能从 unpkg 获取。
|
|
203
|
+
|
|
204
|
+
`@melt-js/libs-core/scripts/component-events.mjs` 是 Node 专用事件解析入口,供 Vue schema CLI 复用;浏览器入口不会导入 Babel 或文件系统模块。
|
package/demo/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../src/demo/index.mjs'
|
package/dist/browser.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var Ia=Object.create;var hr=Object.defineProperty;var Ta=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var Ma=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var it=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var xa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pa(t))!Da.call(e,a)&&a!==r&&hr(e,a,{get:()=>t[a],enumerable:!(n=Ta(t,a))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Ia(Ma(e)):{},xa(t||!e||!e.__esModule?hr(r,"default",{value:e,enumerable:!0}):r,e));var qe=it(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});function pt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Va(e){if(Array.isArray(e))return e}function wa(e){if(Array.isArray(e))return pt(e)}function Ra(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=yt(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return s=u.done,u},e:function(u){o=!0,i=u},f:function(){try{s||r.return==null||r.return()}finally{if(o)throw i}}}}function vt(e,t,r){return(t=Ua(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Na(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fa(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,o=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(o.push(n.value),o.length!==t);u=!0);}catch(f){c=!0,a=f}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw a}}return o}}function Oa(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ja(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function De(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mr(Object(r),!0).forEach(function(n){vt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function He(e,t){return Va(e)||Fa(e,t)||yt(e,t)||Oa()}function st(e){return wa(e)||Na(e)||yt(e)||ja()}function ka(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ua(e){var t=ka(e,"string");return typeof t=="symbol"?t:t+""}function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}function yt(e,t){if(e){if(typeof e=="string")return pt(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pt(e,t):void 0}}var ie=null;function Ha(){if(typeof window<"u"){ie=window;return}if(typeof global<"u"){ie=global;return}throw new Error("unable to locate global object")}function z(){return ie||Ha(),ie}function Ba(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=null;(t=ie)!==null&&t!==void 0&&t.__HEL_MICRO_SHARED__&&(n=ie.__HEL_MICRO_SHARED__),r?ie=De(De({},ie),e):ie=e,n&&(ie.__HEL_MICRO_SHARED__=n)}function Be(){return z()}function Pr(){var e=z();return e.MutationObserver||e.WebKitMutationObserver||e.MozMutationObserver}function gr(e,t){for(var r=null,n=e.length,a=0;a<n;a++){var i=e[a];if(i.tagName===t){r=i;break}}return r}function Mr(e){return Object.keys(e)}function Ga(){var e=function(a){var i=a||{},s=i.search||"";if(!s){var o=i.hash||"",u=o.split("?")[1]||"";u&&(s="?".concat(u))}return s};try{var t;return e((t=z())===null||t===void 0||(t=t.top)===null||t===void 0?void 0:t.location)}catch{var r;return e((r=z())===null||r===void 0?void 0:r.location)}}function br(e){var t,r=(t=z())===null||t===void 0?void 0:t.localStorage;return r?.getItem(e)}function Ar(e,t){var r,n=(r=z())===null||r===void 0?void 0:r.localStorage;return n?.setItem(e,t)}function Ka(){var e=Ga(),t={};if(e!=null&&e.startsWith("?")){var r=e.substring(1),n=r.split("&");n.forEach(function(a){var i=a.split("="),s=He(i,2),o=s[0],u=s[1];t[o]=u})}return t}function Dr(){var e="";try{throw new Error("getJsRunLocation")}catch(n){var t=n.stack.split(`
|
|
5
|
+
`),r=t.length;e=t[r-1]||t[r-2]||""}return e}function re(e,t,r,n){var a=U(e,t);a[r]=n}function U(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=e[t];return n||(n=r,e[t]=n),n}function xr(e,t){Object.keys(t).forEach(function(r){var n=t[r];[null,void 0,""].includes(n)||(e[r]=n)})}function dt(e,t){e.includes(t)||e.push(t)}function Vr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.nullValues,n=r===void 0?[null,void 0,""]:r,a=t.emptyObjIsNull,i=a===void 0?!0:a,s=t.emptyArrIsNull,o=s===void 0?!0:s,u=n.includes(e);if(u)return!0;if(Array.isArray(e))return o?e.length===0:!1;if(ye(e)==="object"){var c=Mr(e),f=c.length;return i?f===0:!1}return!1}function wr(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t}function $a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ya(){var e=z();return e.process&&e.global&&!e.document}function Wa(e,t,r){if(e&&typeof e!="string")return e;try{var n=JSON.parse(e);return n||t}catch(a){if(t!==void 0)return t;throw r?new Error(r):a}}var Rr=Vr,ht=dt,Nr=Mr;function qa(e,t){var r=[];return e.forEach(function(n){return ht(r,n)}),t.forEach(function(n){return ht(r,n)}),r}function Fr(e,t){var r=t||function(a){return!Rr(a)},n={};return Nr(e).forEach(function(a){r(e[a])&&(n[a]=e[a])}),n}function Xa(e,t,r){var n=r,a=Ra(e),i;try{for(a.s();!(i=a.n()).done;){var s=i.value,o=s[t];if(![null,void 0,""].includes(o)){n=o;break}}}catch(u){a.e(u)}finally{a.f()}return n}function Or(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"MULTI",r=e.split(`
|
|
6
|
+
`),n=r.length-1,a=r.map(function(i,s){var o;if(!i&&(s===0||s===n))return"";var u=function(p,v){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",h=p;return p.endsWith("<br/>")?(h=p.substring(0,h.length-5),"".concat(h).concat(v)):"".concat(h).concat(d)},c=((o=i.trimStart)===null||o===void 0?void 0:o.call(i))||i;return t==="MULTI"?"".concat(u(c,""),`
|
|
7
|
+
`):(c=u(c,`
|
|
8
|
+
`," "),c)}).join("");return a}function jr(e){return Or(e,"ONE")}function Ja(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=z(),n=jr(e),a=r.alert||wr;if(t){var i;!((i=r.location)===null||i===void 0)&&i.port&&a(n);return}a(n)}function oe(e,t,r){e.dataset?e.dataset[t]=r:e.setAttribute("data-".concat(t),r)}function Ge(e){oe(e,"heldisabled","1"),e.disabled=!0}var za=Object.freeze({__proto__:null,noop:wr,hasProp:$a,isServer:Ya,safeParse:Wa,isNull:Rr,noDupPush:ht,okeys:Nr,merge2List:qa,purify:Fr,getObjsVal:Xa,pfstr:Or,nbstr:jr,nbalert:Ja,setDataset:oe,disableNode:Ge});function Qa(e,t){var r=this,n=t.fn,a=t.fnName,i=t.arg1PlatObjFnKeys,s=i.includes(a);return function(){for(var o=function(h){return De({platform:e},Fr(h||{}))},u=arguments.length,c=new Array(u),f=0;f<u;f++)c[f]=arguments[f];var p=c[0],v=c[1];return s?c[0]=o(p):c[1]=o(v),n.apply(r,c)}}function kr(e,t,r){var n=r||{},a=n.ignoreKeys,i=a===void 0?[]:a,s=n.arg1PlatObjFnKeys,o=s===void 0?[]:s,u={};return Object.keys(t).forEach(function(c){var f=t[c];if(i.includes(c)){u[c]=f;return}var p=ye(f);if(p&&p==="object"){u[c]=kr(e,f,r);return}if(p==="function"){u[c]=Qa(e,{arg1PlatObjFnKeys:o,fn:f,fnName:c});return}u[c]=f}),u}var Za="hel",Ur="unpkg",St={NONE:0,LOG:1,TRACE:2},G="__default_online_ver__",Hr=Ur,$={CORE_VER:"4.13.1",DEFAULT_API_PREFIX:"https://unpkg.com",DEFAULT_API_URL:"/openapi/v1/app/info",DEFAULT_ONLINE_VER:G,DEFAULT_USER_LS_KEY:"HelUserRtxName",DEFAULT_PLAT:Hr,LS_LOG_MODE:"HelConfig.logMode",LS_LOG_FILTER:"HelConfig.logFilter",PLAT_HEL:Za,PLAT_UNPKG:Ur,KEY_CSS_STR:"CSS_STR",KEY_ASSET_CTX:"ASSET_CTX",KEY_STYLE_TAG_ADDED:"STYLE_TAG_ADDED",KEY_CSS_LINK_TAG_ADDED:"CSS_LINK_TAG_ADDED",KEY_IGNORE_CSS_PREFIX_LIST:"IGNORE_CSS_PREFIX_LIST",KEY_IGNORE_STYLE_TAG_KEY:"IGNORE_STYLE_TAG_KEY",KEY_IGNORE_CSS_PREFIX_2_KEYS:"IGNORE_CSS_PREFIX_2_KEYS"},Ve={SUB_APP_LOADED:"subAppLoaded",SUB_LIB_LOADED:"SubLibLoaded",STYLE_STR_FETCHED:"StyleStrFetched",STYLE_TAG_ADDED:"StyleTagAdded",CSS_LINK_TAG_ADDED:"CssLinkTagAdded"},we={NOT_LOAD:0,LOADING:1,LOADED:2},Br=$.LS_LOG_FILTER,Gr=$.LS_LOG_MODE,Re=St.NONE,Kr=St.LOG,ei=St.TRACE,fe={isIncludeFilter:function(t,r){if(!r.includes(","))return t.includes(r);var n=r.split(",");return n.some(function(a){return t.includes(a)})},getLogFilter:function(){return he().logFilter},setLogFilter:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;he().logFilter=t,r&&Ar(Br,t)},setLogMode:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=parseInt(t,10);[Re,Kr,ei].includes(n)&&(he().logMode=n,r&&Ar(Gr,n))},getLogMode:function(){return he().logMode}},le={};function ti(){if(!he().isInit){he().isInit=!0;var e=Ka(),t=e.hellog,r=e.hellogf,n=t||br(Gr)||Re;fe.setLogMode(n,!1);var a=r||br(Br)||"";fe.setLogFilter(a,!1)}}function ri(){return{logMode:Re,logFilter:"",isInit:!1}}function ni(){if(le=Be().__HEL_MICRO_DEBUG__,!Vr(le)){le.logMode===void 0&&(le.logMode=Re,le.logFilter="");return}le=ri(),Be().__HEL_MICRO_DEBUG__=le;try{ti()}catch{}}function Ke(){return fe.getLogMode()!==Re}function he(){return le}var yr=" %c--> HEL LOG:",Sr="color:#ad4e00;font-weight:600";function J(){if(Ke()){for(var e=fe.getLogMode()===Kr?console.log:console.trace||console.log,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r[0],i=r.slice(1);if(typeof a!="string")return e.apply(void 0,[yr,Sr].concat(r));var s=fe.getLogFilter(),o=["".concat(yr," ").concat(a),Sr].concat(st(i));if(s){fe.isIncludeFilter(a,s)&&e.apply(void 0,st(o));return}e.apply(void 0,st(o))}}var xe={};function ai(e){!Ke()||xe[e]||(xe[e]=Date.now())}function _t(e,t,r){if(!(!Ke()||!xe[e])){var n=xe[e];J("[[ PerfCheck ]] (".concat(e,"/").concat(t,") costs ").concat(Date.now()-n," ms")),r&&$r(e)}}function $r(e){xe[e]=0}var ii=$.DEFAULT_API_URL,si=$.DEFAULT_USER_LS_KEY,ot=$.PLAT_HEL,_r=$.PLAT_UNPKG,oi=$.DEFAULT_API_PREFIX,ui=$.CORE_VER,ci=$.KEY_CSS_LINK_TAG_ADDED,li=$.KEY_STYLE_TAG_ADDED,Lr=$.KEY_IGNORE_CSS_PREFIX_LIST,fi=$.KEY_IGNORE_STYLE_TAG_KEY,pi=$.KEY_IGNORE_CSS_PREFIX_2_KEYS;function mt(e){var t=e||{},r=t.apiPrefix;return{apiMode:"get",apiPrefix:r,apiSuffix:"",apiPathOfApp:ii,apiPathOfAppVersion:"",getSubAppAndItsVersionFn:null,customMetaUrl:"",customMetaJsonpUrl:"",getMeta:null,onFetchMetaFailed:null,strictMatchVer:!0,getUserName:null,userLsKey:si,shouldUseGray:null,trustAppNames:null,semverApi:null,hook:{}}}function gt(e){var t=De(De({isConfigOverwrite:!1,platform:e,appName2Comp:{},appName2Lib:{},appName2isLibAssigned:{},appName2EmitApp:{},appName2verLoadStatus:{},appName2verEmitLib:{},appName2verEmitApp:{},appName2verStyleStr:{},appName2verStyleFetched:{},appName2verExtraCssList:{},appName2verAppVersion:{},appName2verCustomData:{},appName2app:{},appName2appVersion:{},appName2styleStr:{},appGroupName2firstVer:{},isOriginInitCalled:!1},mt()),{},{origin:mt({apiPrefix:oi})});return t}function bt(){var e={};return{on:function(r,n){var a=e[r];if(!a){var i=[];e[r]=i,a=i}a.push(n)},emit:function(r){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];var s=e[r];if(s){var o=s.slice();o.forEach(function(u){return u.apply(void 0,a)})}},off:function(r,n){var a=e[r];if(a)for(var i=0,s=a.length;i<s;i++){var o=a[i];if(o===n){a.splice(i,1);break}}}}}function vi(){var e=gt(_r),t=gt(ot),r={platform:ot,platformHint:"the platform value here does not make any sense!",appName2platform:{},appGroupName2platform:{},caches:vt(vt({},_r,e),ot,t),common:{}},n=bt(),a=bt();return{ver:ui,isStyleObInit:!1,nativeHeadAppend:null,nativeBodyAppend:null,patchedHeadAppend:null,patchedBodyAppend:null,createFeature:Dr(),eventBus:n,userEventBus:a,cacheRoot:r,unpkgCache:e,helCache:t,dev:{setLogMode:fe.setLogMode,setLogFilter:fe.setLogFilter}}}function Er(e){var t=[ci,li,Lr,fi,pi],r=function(a){return a===Lr?[]:{}};t.forEach(function(n){return U(e,n,r(n))})}function di(){var e=me();if(e){var t=e.cacheRoot;U(t,"appGroupName2platform"),U(t,"common");var r=t.caches;Object.keys(r).forEach(function(n){var a=r[n];U(a,"appGroupName2firstVer"),U(a,"appName2isLibAssigned"),U(a,"appName2verExtraCssList"),U(a,"appName2verCustomData"),U(a,"hook"),U(a,"origin",mt()),U(a.origin,"hook")}),Er(t.common),e.userEventBus||(e.userEventBus=bt());return}e=vi(),Er(e.cacheRoot.common),Be().__HEL_MICRO_SHARED__=e}function me(){var e=Be().__HEL_MICRO_SHARED__;return e}function $e(){return Hr}function K(e){var t=e||$e(),r=ge(),n=r.caches[t];if(!n){var a=ye(e);if(a!=="string")throw console.error("invalid plaform:",e),new Error("fatal error: platform only can be a string, now it is ".concat(a));var i=gt(e);r.caches[t]=i,n=i}return n}function ge(){return me().cacheRoot}var ue={getCustomData:function(t,r,n){var a=n.versionId,i=n.platform,s=K(i),o=s.appName2verCustomData,u=U(o,t),c=U(u,r);return c[a||G]},getAppMeta:function(t,r){var n=K(r),a=n.appName2app;return a[t]},setVerLoadStatus:function(t,r,n,a){var i=a||{},s=i.versionId,o=i.platform,u=K(o)[n],c=s||G;re(u,t,c,r)},getVerLoadStatus:function(t,r,n){var a,i=n||{},s=i.versionId,o=i.platform,u=K(o)[r],c=s||G;return((a=u[t])===null||a===void 0?void 0:a[c])||we.NOT_LOAD},ensureOnlineModule:function(t,r,n){if(!t[G]){var a=ue.getAppMeta(r,n),i=t[a?.online_version];i&&(t[G]=i)}}};function hi(e,t){var r,n=t||{},a=n.versionId,i=n.platform,s=K(i),o=s.appName2verEmitApp,u=s.appName2Comp,c=s.strictMatchVer,f=s.appName2EmitApp,p=(r=n.strictMatchVer)!==null&&r!==void 0?r:c,v=U(o,e);ue.ensureOnlineModule(v,e,i);var d=a||G,h=v[d],m=u[e],g=m?{Comp:m}:null,b=p?null:f[e]||g,y=h||b||null;return J("[[ core:getVerApp ]] appName,options,result:",e,n,y),y}function Yr(e,t){J("[[ core:setEmitApp ]] appName,emitApp:",e,t);var r=t.versionId,n=t.platform,a=K(n),i=a.appName2verEmitApp,s=a.appName2Comp,o=a.appName2EmitApp,u=U(i,e);u[G]||(s[e]=t.Comp,o[e]=t,re(i,e,G,t)),r&&re(i,e,r,t)}var Cr=$.KEY_CSS_LINK_TAG_ADDED,ut=$.KEY_STYLE_TAG_ADDED,Ir=$.KEY_IGNORE_CSS_PREFIX_LIST,mi=$.KEY_IGNORE_STYLE_TAG_KEY,ct=$.KEY_IGNORE_CSS_PREFIX_2_KEYS;function Wr(e){var t=ge(),r=t.common,n=U(r,e);return n}function Ue(e){var t=ge(),r=t.common;return r[e]}function Me(e,t){var r=Wr(e),n=r[t];return n!==void 0?n:null}function Pe(e,t,r){var n=Wr(e);n[t]=r}var Z={setIgnoreCssPrefix:function(t){var r=Ue(Ir);dt(r,t)},setIgnoreStyleTagKey:function(t){var r=Z.getIgnoreStyleTagMap();r[t]=1},getIgnoreStyleTagMap:function(){var t=Ue(mi);return t},setIgnoreCssPrefixKey:function(t,r){var n=Me(ct,t);n||(n=[],Pe(ct,t,n)),dt(n,r)},getIgnoreCssPrefixKeys:function(t){var r=Ue(ct);return r[t]||[]},getMatchedIgnoreCssPrefix:function(t){for(var r=Ue(Ir),n="",a=0;a<r.length;a++){var i=r[a];if(t.startsWith(i)){n=i;break}}return n},getIgnoreCssPrefixCssUrlList:function(t){var r=Me(Cr,t);return r||(r=[],Pe(Cr,t,r)),r},setIgnoreCssPrefixCssUrl:function(t,r){var n=Z.getIgnoreCssPrefixCssUrlList(t);n.push(r)},getStyleTagText:function(t){var r=Me(ut,t)||"";return r},clearStyleTagText:function(t){Pe(ut,t,"")},appendStyleTagText:function(t,r){var n=Z.getStyleTagText(t);Pe(ut,t,"".concat(n," ").concat(r))}};function Lt(e,t){var r=e.apiMode,n=e.apiPrefix,a=e.apiSuffix,i=e.apiPathOfApp,s=e.apiPathOfAppVersion,o=e.getSubAppAndItsVersionFn,u=e.onFetchMetaFailed,c=e.strictMatchVer,f=e.getUserName,p=e.userLsKey,v=e.shouldUseGray,d=e.getApiPrefix,h=e.trustAppNames,m=e.platform,g=e.origin,b=e.hook,y=e.customMetaUrl,S=e.customMetaJsonpUrl,A=e.getMeta,C={apiMode:r,apiPrefix:n,apiSuffix:a,apiPathOfApp:i,apiPathOfAppVersion:s,getSubAppAndItsVersionFn:o,onFetchMetaFailed:u,strictMatchVer:c,getUserName:f,userLsKey:p,shouldUseGray:v,getApiPrefix:d,trustAppNames:h,hook:b,platform:m,customMetaUrl:y,customMetaJsonpUrl:S,getMeta:A};return t&&(C.origin=g),C}function gi(e){var t=K(e);return Lt(t,!0)}function bi(e){var t=me(),r=t.nativeHeadAppend,n=t.nativeBodyAppend,a=e.headAppend||null,i=e.bodyAppend||null,s=function(u){return"pass same ".concat(u," handle, hel will ignore it for avlid 'Maximum call stack size exceeded'")};a&&a===r?console.error(s("headAppend")):t.patchedHeadAppend=a,i&&i===n?console.error(s("bodyAppend")):t.patchedBodyAppend=i}function Ai(e,t){var r=K(t),n=Lt(e);r.isConfigOverwrite||(r.isConfigOverwrite=!0,xr(r,n))}function yi(e,t){var r=K(e),n="[[ core:originInit ]] invalid call, it can only been called";if(r.isConfigOverwrite){J("".concat(n," before init"));return}if(r.isOriginInitCalled){J("".concat(n," one time"));return}var a=Lt(t);r.isOriginInitCalled=!0,xr(r.origin,a)}function Ye(e){return ge().appGroupName2platform[e]||$e()}function Si(e,t,r){var n=ge().appGroupName2platform;return(r||!n[e])&&(n[e]=t),Ye(e)}function Et(e){return ge().appName2platform[e]||$e()}function _i(e,t,r){var n=ge().appName2platform;return(r||!n[e])&&(n[e]=t),Et(e)}function qr(e,t){var r=t.customKey,n=t.platform,a=n===void 0?Et(e):n,i=K(a),s=i.appName2verCustomData,o=U(s,e),u=U(o,r);return u}function Li(e,t){var r=qr(e,t),n=r[t.versionId||G];return n!==void 0?n:null}function Ei(e,t){var r=t.customValue,n=t.versionId,a=qr(e,t);a[n||G]=r,a[G]||(a[G]=r)}var Ci=Ve.STYLE_TAG_ADDED,Ii=Ve.CSS_LINK_TAG_ADDED;function Se(){return me().eventBus}function Ti(){return me().userEventBus}var We={styleTagAdded:function(t){return"".concat(Ci,"/").concat(t)},cssLinkTagAdded:function(t){return"".concat(Ii,"(").concat(t,")")}};function Pi(e,t){var r,n=t||{},a=n.versionId,i=n.platform,s=K(i),o=s.appName2verEmitLib,u=s.appName2Lib,c=s.strictMatchVer,f=s.appName2isLibAssigned,p=(r=n.strictMatchVer)!==null&&r!==void 0?r:c,v=U(o,e);ue.ensureOnlineModule(v,e);var d=a||G,h=v[d],m=f[e]?u[e]:null,g=p?null:m,b=h||g||null;return J("[[ core:getVerLib ]] appName,options,result:",e,n,b),b}function Xr(e,t,r){var n=r||{},a=n.appGroupName,i=t.versionId,s=t.appProperties,o=t.platform||r.platform,u=K(o),c=u.appName2verEmitLib,f=u.appName2Lib,p=u.appName2isLibAssigned,v=ue.getAppMeta(e,o),d=function(g){var b=f[g];b?ye(b)==="object"&&Object.keys(b).length===0&&Object.assign(b,s):f[g]=s,p[g]=!0};d(e),a?d(a):v&&d(v.app_group_name),J("[[ core:setEmitLib ]] appMeta:",v);var h=U(c,e);h[G]||re(c,e,G,s),i&&re(c,e,i,s)}function Jr(e,t){var r=K(t),n=r.appName2app;return n[e]}function Mi(e,t){var r=K(t),n=r.appName2app;n[e.name]=e}function Ct(e,t,r){ue.setVerLoadStatus(e,t,"appName2verLoadStatus",r)}function Di(e,t){return ue.getVerLoadStatus(e,"appName2verLoadStatus",t)}function xi(e,t,r){ue.setVerLoadStatus(e,t,"appName2verStyleFetched",r)}function Vi(e,t){return ue.getVerLoadStatus(e,"appName2verStyleFetched",t)}function wi(e,t){var r,n=t||{},a=n.platform,i=n.versionId,s=K(a),o=s.appName2verStyleStr,u=s.appName2styleStr,c=u[e]||"";return i?((r=o[e])===null||r===void 0?void 0:r[i])||c||"":c}function Ri(e,t,r){var n=r||{},a=n.platform,i=n.versionId,s=K(a),o=s.appName2verStyleStr,u=s.appName2verStyleFetched,c=s.appName2styleStr;if(!i){c[e]=t;return}re(o,e,i,t),re(u,e,i,we.LOADED)}function Ni(e,t,r){var n=r||{},a=n.versionId,i=n.platform,s=K(i),o=s.appName2verExtraCssList;J("[[ core:setVerExtraCssList ]] cssList:",t);var u=U(o,e);u[G]||re(o,e,G,t),a&&re(o,e,a,t)}function Fi(e,t){var r=t||{},n=r.versionId,a=r.platform,i=K(a),s=i.appName2verExtraCssList,o=U(s,e),u=o[n]||o[G]||[];return J("[[ core:getVerExtraCssList ]] options,cssList:",r,u),u}function Oi(e,t){var r,n=t||{},a=n.platform,i=n.versionId,s=K(a),o=s.appName2verAppVersion,u=s.appName2appVersion,c=u[e]||null;return i&&((r=o[e])===null||r===void 0?void 0:r[i])||c}function ji(e,t,r){var n=r||{},a=n.platform,i=K(a),s=i.appName2verAppVersion,o=i.appGroupName2firstVer,u=i.appName2appVersion,c=t.version_tag||t.sub_app_version;if(c){var f=ue.getAppMeta(e,a),p=U(s,e);p[G]||(re(s,e,G,t),u[e]=t),re(s,e,c,t),o[f.app_group_name]=t.sub_app_version}}function Te(e,t){var r=e.split("@"),n=r.slice(1),a=n.join("@");return a||t||e}function Tr(e){return e==="js"||e==="mjs"}function It(e,t){var r=Dr();J("[[ core:tryGetVersion ]] may include ver source > ".concat(r));var n=K(t),a=n.appGroupName2firstVer,i=a[e]||"";if(r.includes("https://")||r.includes("http://")){var s=r.split("//"),o=He(s,2),u=o[1],c=u.split("/");if(i){var f=u.includes("/".concat(i,"/"));if(f){var p=i.startsWith("@");if(p){var m=i.split("/")[1]||"";return Te(m)}else{var v=c.indexOf(i),d=c[v-1],h=d.startsWith("@");if(!h)return Te(i)}}var g=c[1],b=c[2];if(g==="static"&&Tr(b)||Tr(g))return Te(i)}var y=u.indexOf("@");if(y>=0){var S=c.filter(function(R){return R.includes("@")}),A=S.findIndex(function(R){return R.startsWith("@")});if(A>=0){var C=S[A+1]||"";return Te(C,i)}var M=S[0]||"";return Te(M,i)}var _=u.split("/".concat(t,"/")),x=He(_,2),O=x[1],j=O===void 0?"":O,F=j.split("/"),k=He(F,1),H=k[0];return H||i}return i}function Tt(e,t){if(e===G)return t||"";if(e.includes("_")){var r=e.substring(0,e.length-15);return r}return t||""}var At=!1,lt=!1;function ki(e){if(e&&(At=!1,lt=!1),!lt){lt=!0;var t=z();t.__MASTER_APP_LOADED__===void 0&&(t.__MASTER_APP_LOADED__=!0,At=!0)}}function Ui(){var e=`WARNING: calling isSubApp is unsafe, use hel-iso.isSubApp instead,
|
|
9
|
+
`;return e+="more details see: https://tnfe.github.io/hel/docs/tutorial/attention-is-subapp",console.log("%c".concat(e),"color:red;"),!At}function Hi(e,t){var r=t.platform,n=t.groupName,a=t.name,i=t.ver,s=t.elName;oe(e,"el",s),oe(e,"plat",r),oe(e,"gname",n),oe(e,"name",a),oe(e,"ver",i)}var Bi=$.KEY_ASSET_CTX;function ft(e,t){if(!t||!["LINK","SCRIPT"].includes(t.tagName))return e(t);var r=t.href,n=t.tagName,a=t.src,i=r||a||"",s=n==="LINK",o=Me(Bi,i)||{},u=o.platform,c=o.groupName,f=o.name,p=o.ver,v=o.beforeAppend,d=t;if(v){var h=s?"href":"src",m=t.getAttribute(h),g=function(S){return t.setAttribute(h,S)};d=v({el:t,nativeAppend:e,setAssetUrl:g,url:m,tagName:n})||t}var b=s?"HelLink":"HelScript";return u&&Hi(d,{platform:u,groupName:c,name:f,ver:p,elName:b}),e(d)}function Gi(){var e=z();if(!(e.__POWERED_BY_QIANKUN__||e.__DISABLE_HEL_MONKEY_PATCH__)){var t=me(),r=e.document,n=t.nativeHeadAppend,a=t.nativeBodyAppend;if(!(n||!r)){var i=r.head,s=r.body;if(n=i.appendChild.bind(i),t.nativeHeadAppend=n,s)a=s.appendChild.bind(s),t.nativeBodyAppend=a;else{var o=Pr(),u=new o(function(p){for(var v,d=0;d<p.length;d++){var h=p[d].addedNodes;if(v=gr(h,"BODY"),v)break}v&&(a=v.appendChild.bind(v),t.nativeBodyAppend=a,v.appendChild=function(m){return ft(f(a,v,"body"),m)},u.disconnect())}),c=gr(r.childNodes,"HTML");c&&u.observe(c,{childList:!0})}var f=function(v,d,h){var m=t.patchedHeadAppend,g=t.patchedBodyAppend,b=h==="head";if(m&&b)return m;if(g&&!b)return g;if(e.__POWERED_BY_WUJIE__)return v;var y=e.Element;return y?y.prototype.appendChild.bind(d):v};i.appendChild=function(p){return ft(f(n,i,"head"),p)},s&&(s.appendChild=function(p){return ft(f(a,s,"body"),p)})}}}var zr="preFetch";function Ki(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.platform||Ye(e),a=r.versionId||It(e,n),i=r.appName||Tt(a,e);J("[[ core:libReady ]] appGroupName ".concat(e,", appName ").concat(i,", versionId ").concat(a));var s=Jr(i,n);s!=null&&s.__fromCust&&(a=r.versionId||s.online_version,i=s.name,J("[[ core:libReady ]] fromCust, appGroupName ".concat(e,", appName ").concat(i,", versionId ").concat(a)));var o={platform:n,appName:i,appGroupName:e,versionId:a,appProperties:t,Comp:function(){},lifecycle:{}};Xr(i,o,{appGroupName:e,platform:n}),Ct(i,we.LOADED,{versionId:a,platform:n});var u=Se();_t(zr,"libReady"),u.emit(Ve.SUB_LIB_LOADED,o)}function $i(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.lifecycle,a=r.platform||Ye(e),i=r.versionId||It(e,a),s=r.appName||Tt(i,e),o={Comp:t,appName:s,appGroupName:e,lifecycle:n,platform:a,versionId:i,isLib:!1};Yr(s,o),Ct(s,we.LOADED,{versionId:i,platform:a});var u=Se();_t(zr,"appReady"),u.emit(Ve.SUB_APP_LOADED,o)}var Qr="/* @helstart ",Yi=" @helend */",Wi=Qr.length;function qi(e,t){var r=Se(),n=Z.getMatchedIgnoreCssPrefix(t);return n&&(Z.setIgnoreCssPrefixCssUrl(n,t),r.emit(We.cssLinkTagAdded(n),{nodes:[e]})),n}function Xi(e){var t=z();if(t){var r=t.document.head.querySelectorAll('style[data-gname="'.concat(e,'"]'));if(r.length){Z.clearStyleTagText(e),r.forEach(function(a){Ge(a),Z.appendStyleTagText(e,a.innerText)});var n=Se();n.emit(We.styleTagAdded(e),{nodes:r})}}}function Ji(e,t){var r=e.tagName,n=e.innerText,a=e.href;if(["STYLE","LINK"].includes(r)){if(r==="STYLE"){if(!n)return;var i=n.indexOf(Qr);if(i<0)return;var s=n.indexOf(Yi);if(s<0)return;var o=n.substring(Wi+i,s);if(o){var u=o.trim(),c="",f=u;if(u.includes("/")){var p=u.split("/");c=p[0],f=p[1]}oe(e,"gname",f),c&&oe(e,"plat",c),t[u]&&Ge(e);var v=Se();Z.appendStyleTagText(u,n),v.emit(We.styleTagAdded(u),{nodes:[e]})}return}var d=qi(e,a);d&&Ge(e)}}function zi(e,t){var r=e.tagName,n=e.src,a=n===void 0?"":n;if(r!=="SCRIPT"||!a.endsWith(".hot-update.js"))return!1;var i=Z.getMatchedIgnoreCssPrefix(a);if(!i)return!1;var s=Z.getIgnoreCssPrefixKeys(i);if(!s.length)return!1;var o=!1;return s.forEach(function(u){t[u]&&(Xi(u),o=!0)}),o}function Qi(){var e=me(),t=z(),r=e.isStyleObInit,n=t.document;if(!(r||!n)){e.isStyleObInit=!0;var a=Z.getIgnoreStyleTagMap(),i=Pr();if(i){var s=new i(function(o){o.forEach(function(u){for(var c=u.addedNodes,f=u.removedNodes,p=c.length,v=0;v<p;v++)Ji(c[v],a);for(var d=f.length,h=0;h<d&&!zi(f[h],a);h++);})});s.observe(document.head,{childList:!0})}}}Zr();J("hel-micro-core ver ".concat($.CORE_VER));var Zi=Ve,es=we,ts=$,rs=kr,ns=za,as=Ui;function Zr(e){e&&en(e),ki(!!e),di(),ni(),Gi(),Qi()}var is=$e,ss=K,os=he,us=Ke,cs=J,ls=ai,fs=_t,ps=$r,vs=z,en=Ba,ds=hi,hs=Yr,ms=Pi,gs=Xr,bs=Jr,As=Mi,ys=Oi,Ss=ji,_s=Li,Ls=Ei,Es=Me,Cs=Pe,Is=Z,Ts=Di,Ps=Ct,Ms=Vi,Ds=xi,xs=wi,Vs=Ri,ws=Fi,Rs=Ni,Ns=It,Fs=Tt,Os=gi,js=Ye,ks=Si,Us=_i,Hs=Et,Bs=Ai,Gs=yi,Ks=bi,$s=Se,Ys=Ti,Ws=We,qs=Ki,Xs=$i;L.allowLog=us;L.appReady=Xs;L.clearPerfMark=ps;L.commonDataUtil=Is;L.commonUtil=ns;L.evName=Ws;L.getAppMeta=bs;L.getAppPlatform=js;L.getAppPlatformByAppName=Hs;L.getAppStyleStr=xs;L.getCommonData=Es;L.getCustomData=_s;L.getGlobalThis=vs;L.getHelDebug=os;L.getHelEventBus=$s;L.getPlatform=is;L.getPlatformConfig=Os;L.getSharedCache=ss;L.getUserEventBus=Ys;L.getVerApp=ds;L.getVerExtraCssList=ws;L.getVerLib=ms;L.getVerLoadStatus=Ts;L.getVerStyleStrStatus=Ms;L.getVersion=ys;L.helConsts=ts;L.helEvents=Zi;L.helLoadStatus=es;L.inectPlatToMod=rs;L.initGlobalConfig=Ks;L.initPlatformConfig=Bs;L.isSubApp=as;L.libReady=qs;L.log=cs;L.originInit=Gs;L.perfMark=ls;L.perfPeek=fs;L.resetGlobalThis=Zr;L.setAppMeta=As;L.setAppPlatform=ks;L.setAppPlatformByAppName=Us;L.setAppStyleStr=Vs;L.setCommonData=Cs;L.setCustomData=Ls;L.setEmitApp=hs;L.setEmitLib=gs;L.setGlobalThis=en;L.setVerExtraCssList=Rs;L.setVerLoadStatus=Ps;L.setVerStyleStrStatus=Ds;L.setVersion=Ss;L.tryGetAppName=Fs;L.tryGetVersion=Ns});var rn=it((Xe,tn)=>{(function(e,t){typeof Xe=="object"&&typeof tn<"u"?t(Xe,qe()):typeof define=="function"&&define.amd?define(["exports","hel-micro-core"],t):t((e=typeof globalThis<"u"?globalThis:e||self).HelLibProxy={},e.HelMicroCore)})(Xe,function(e,t){"use strict";var r=function(){return r=Object.assign||function(D){for(var E,I=1,N=arguments.length;I<N;I++)for(var B in E=arguments[I])Object.prototype.hasOwnProperty.call(E,B)&&(D[B]=E[B]);return D},r.apply(this,arguments)};function n(D,E){var I=E||(t.getAppPlatform===null||t.getAppPlatform===void 0?void 0:t.getAppPlatform(D)),N=t.getSharedCache(I).appName2Lib;return N[D]||(N[D]={}),N[D]}var a="4.12.1";t.log("hel-lib-proxy ver ".concat(a));var i=t.getUserEventBus,s=t.helConsts,o=i();function u(D,E){var I=r({},E||{});return I.platform=I.platform||s.DEFAULT_PLAT,t.getVerLib(D,I)}function c(D,E){var I,N=!0,B="";E&&(typeof E=="string"?B=E:(B=E.platform||"",N=(I=E.asProxy)===null||I===void 0||I));var Y=n(D,B=B||t.getAppPlatform(D)||s.DEFAULT_PLAT);return typeof Proxy=="function"&&N&&(Y=(function(Q,W,q){return new Proxy(W,{get:function(X,te){var ve=String(te);return t.log("[[getLibProxy]] call lib [".concat(Q,"] method [").concat(ve,"]")),Object.keys(X).length?X[ve]:n(Q,q)[ve]}})})(D,Y,B)),t.log("[[ exposeLib ]] libName, libObj",D,Y),Y}function f(D,E,I){var N=(function(B){var Y={allowDup:!1,platform:t.helConsts.DEFAULT_PLAT};return r(r({},Y),B||{})})(I);t.libReady(D,E,N)}function p(D,E,I){t.appReady(D,E,I)}function v(D,E){return t.getVerApp(D,E)}var d=t.isSubApp;function h(){return!t.isSubApp()}var m=Object.freeze({__proto__:null,VER:a,eventBus:o,getLib:u,exposeLib:c,libReady:f,appReady:p,exposeApp:v,isSubApp:d,isMasterApp:h}),g=t.commonUtil.purify,b=["isMasterApp","isSubApp","eventBus"],y=["appReady","libReady"];function S(D,E){return E&&typeof E=="object"&&!Array.isArray(E)?r({platform:D},g(E)):{platform:D}}function A(D,E){var I={};return Object.keys(D).forEach(function(N){var B=D[N];if(b.includes(N))I[N]=B;else if(y.includes(N))I[N]=(function(Q,W){return function(){for(var q=[],X=0;X<arguments.length;X++)q[X]=arguments[X];var te=q[0],ve=q[1],de=q[2];return Q(te,ve,S(W,de===void 0?{}:de))}})(B,E);else{var Y=N==="exposeLib";I[N]=(function(Q,W,q){return function(){for(var X=[],te=0;te<arguments.length;te++)X[te]=arguments[te];var ve=X[0],de=X[1];return Q(ve,!q||typeof de!="string"&&de!==void 0?S(W,de):de||W)}})(B,E,Y)}}),I}var C=function D(E){var I=A(m,E);return I.createInstance=D,I},M=a,_=f,x=c,O=u,j=d,F=h,k=o,H=p,R=v,V={VER:M,libReady:_,exposeLib:x,getLib:O,isSubApp:j,isMasterApp:F,eventBus:k,appReady:H,exposeApp:R,createInstance:C};(function(D){var E=t.getGlobalThis();t.commonUtil.isServer()||E.HelLibProxy||(t.log("auto bind hel-lib-proxy to global.HelLibProxy"),E.HelLibProxy=D)})(V),e.VER=M,e.appReady=H,e.createInstance=C,e.default=V,e.eventBus=k,e.exposeApp=R,e.exposeLib=x,e.getLib=O,e.isMasterApp=F,e.isSubApp=j,e.libReady=_,Object.defineProperty(e,"__esModule",{value:!0})})});var Sa=it((tc,ya)=>{"use strict";var Aa=Object.freeze({unpkg:"https://unpkg.com"});function Hu(e){let t=/^(?:(@[a-z\d._-]+)\/)?([a-z\d][a-z\d._-]*)(?:@([a-z\d][a-z\d.+_-]*))?$/i.exec(e);if(!t)throw new Error("\u65E0\u6548\u7684\u8FDC\u7A0B\u5305\u540D\u79F0\u6216\u7248\u672C\uFF1A"+e);let[,r,n,a]=t;return{scope:r||"",name:n,packageName:(r?r+"/":"")+n,version:a||""}}function Bu(e,{type:t="unpkg",base:r,projectName:n,versioned:a=!0}={}){let i=r||Aa[t]||(t==="github"&&e.scope?"https://"+e.scope.slice(1)+".github.io":"");if(!i)throw new Error(t==="github"?"github \u65E0 scope \u7684\u5305\u5F15\u7528\u9700\u8981 base\uFF08\u65E0\u6CD5\u63A8\u5BFC\u7EC4\u7EC7\uFF09":"custom \u52A0\u8F7D\u9700\u8981 base");let s;try{s=new URL(i)}catch{throw new Error("\u9700\u8981\u7EDD\u5BF9 HTTP(S) \u5730\u5740\uFF1A"+i)}if(!/^https?:$/.test(s.protocol))throw new Error("\u4E0D\u652F\u6301\u7684\u5730\u5740\u534F\u8BAE\uFF1A"+i);if(s.search||s.hash)throw new Error("base \u4E0D\u80FD\u5305\u542B\u67E5\u8BE2\u53C2\u6570\u6216 hash\uFF1A"+i);let o=n||(t==="github"?e.name:e.packageName);!n&&t!=="github"&&e.scope&&(s.pathname=s.pathname.replace(/\/@[a-z\d._-]+\/*$/i,""));let u=a&&e.version&&e.version.toLowerCase()!=="latest"?"@"+e.version:"";return s.pathname=s.pathname.replace(/\/+$/,"")+"/"+o+u,s}ya.exports={HEL_BASES:Aa,packageRef:Hu,packageUrl:Bu}});var En=ke(rn()),$t=ke(qe()),l=ke(qe());function Js(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zs(n.key),n)}}function zs(e,t,r){return t&&nn(e.prototype,t),r&&nn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qs(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zs(e){var t=Qs(e,"string");return typeof t=="symbol"?t:String(t)}var eo=/\s/,to=/[a-zA-Z0-9\-]/,an="<!DOCTYPE html>",ro="<!--",sn="-->",no="</meta>",ao="</link>",io=["meta","link"],so={meta:no,link:ao},oo=(function(){function e(){Js(this,e),this.input="",this.len=0,this.cur=0}return zs(e,[{key:"eof",get:function(){return this.cur>=this.len}},{key:"peek",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.input[this.cur+r]}},{key:"sub",value:function(r,n){var a=n||this.cur;return this.input.substring(a,a+r)}},{key:"moveCur",value:function(r){this.cur+=r}},{key:"consumeChar",value:function(r){var n=this.peek();if(n===r)this.cur++;else throw new Error("Unexpected character: '".concat(n,"' should be '").concat(r,"'"));return n}},{key:"consumeSpace",value:function(){this.consumeWhile(eo)}},{key:"consumeWhile",value:function(r){var n=[];do{var a=this.peek();if(r.test(a))n.push(a),this.cur++;else break}while(!this.eof);return n.join("")}},{key:"noop",value:function(){}},{key:"pureInput",value:function(r){var n=r.trim();n.startsWith(an)&&(n=n.substring(an.length));var a=function i(s){var o=s.indexOf(ro),u=s.indexOf(sn);if(o>=0&&u>=0){var c=s.substring(0,o),f=s.substring(u+sn.length);return i("".concat(c).concat(f))}return s};return n=a(n),n}},{key:"parse",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r||"";return this.input=this.pureInput(a),this.len=a.length,this.onTagOpen=n.onTagOpen||this.noop(),this.onTagClose=n.onTagClose||this.noop(),this.cur=0,this.parseNodes()}},{key:"parseNodes",value:function(){var r=[];do{var n=void 0;if(this.peek()==="<"){if(this.peek(1)==="/")break;n=this.parseElement()}else n=this.parseTextNode();n!==" "&&r.push(n)}while(!this.eof);return r}},{key:"parseTextNode",value:function(){var r=this.consumeWhile(/[^<]/);return r.replace(/[\s\n]+/g," ")}},{key:"parseElement",value:function(){var r=this;this.consumeChar("<");var n=this.parseTag();this.onTagOpen(n),this.consumeSpace();var a=this.parseAttrs(),i=this.peek(),s=this.peek(-1),o=function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;r.parseTag(),r.consumeSpace(),r.consumeChar(">"),m&&r.moveCur(m);var g={tag:n,attrs:a,children:h};return r.onTagClose(n,g),g};if("".concat(s).concat(i)==="/>")return o([]);if(io.includes(n)&&i===">"){var u=so[n],c=u.length,f=this.sub(c,this.cur+1),p=f===u?c:0;return o([],p)}this.consumeChar(">");var v=this.parseNodes();return this.consumeChar("<"),this.consumeChar("/"),o(v)}},{key:"parseTag",value:function(){var r=this.consumeWhile(to);return r}},{key:"parseAttrs",value:function(){for(var r={};this.peek()!==">";){var n=this.parseTag();if(!n){this.consumeChar(this.peek());continue}if(this.peek()==="="){this.consumeChar("="),this.consumeChar('"');var a=this.consumeWhile(/[^"]/);this.consumeChar('"'),r[n]=a}else r[n]="";this.consumeSpace()}return r}}]),e})();function on(e,t){var r=new oo,n=r.parse(e,t);return n}var Cn="4.15.3";function Yt(e){var t=e.appGroupName,r=e.Comp,n=e.platform,a=e.lifecycle,i=e.appName,s=e.versionId;(0,l.appReady)(t,r,{lifecycle:a,platform:n,appName:i,versionId:s})}var w=function(){return w=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},w.apply(this,arguments)};function Ie(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function T(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function o(f){try{c(n.next(f))}catch(p){s(p)}}function u(f){try{c(n.throw(f))}catch(p){s(p)}}function c(f){f.done?i(f.value):a(f.value).then(o,u)}c((n=n.apply(e,t||[])).next())})}function P(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,a&&(i=c[0]&2?a.return:c[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,c[1])).done)return i;switch(a=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,a=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(f){c=[6,f],a=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var Ft={LS_CACHE_APP_PREFIX:"HelAppCache",DATABASE_NAME:"HelIndexedDB",STORE_NAME:"HelMetaData"},un={};function cn(){return{db:null,name:"",storeName:"",version:1}}function In(){var e=(0,l.getGlobalThis)();return"indexedDB"in e?e.indexedDB:(console.warn("The current browser is not support indexedDB!"),null)}var uo=(function(){function e(t){this.dbInfo=cn(),this.ready=null,this.initStorage(t)}return e.prototype.initStorage=function(t){var r=In();if(r){var n=null,a=null;this.ready=new Promise(function(d,h){n=d,a=h});var i=this.dbInfo;if(t){var s=t.name,o=t.storeName,u=t.version;Object.assign(i,l.commonUtil.purify({name:s,storeName:o,version:u}))}var c=un[i.name];c||(c=cn(),un[i.name]=c),i.db=c.db;var f=this.isUpgradeNeeded(i);if(i.db)if(f)i.db.close();else{n(i);return}var p=[i.name,void 0];f&&(p[1]=i.version);var v=r.open.apply(r,p);f&&(v.onupgradeneeded=function(d){c.db=v.result,i.db=v.result;try{i.db.createObjectStore(i.storeName)}catch(m){if(m.name==="ConstraintError"){var h=l.commonUtil.nbstr(`
|
|
10
|
+
The database "`.concat(i.name,`"
|
|
11
|
+
has been upgraded from version `).concat(d.oldVersion," to version ").concat(d.newVersion,`,
|
|
12
|
+
but the storage "`).concat(i.storeName,'" already exists.'));console.warn(h)}else throw m}}),v.onerror=function(){a(v.error)},v.onsuccess=function(){i.db=v.result,c.db=v.result,i.db.onversionchange=function(d){d.target.close()},n(i)}}},e.prototype.isUpgradeNeeded=function(t){if(!t.db)return!0;var r=!t.db.objectStoreNames.contains(t.storeName),n=t.version<t.db.version,a=t.version>t.db.version;if(n&&(console.warn('The database "'.concat(t.name,`" can't be downgraded from version `).concat(t.db.version," to version ").concat(t.version)),t.version=t.db.version),a||r){if(r){var i=t.db.version+1;i>t.version&&(t.version=i)}return!0}return!1},e.prototype.getObjectStore=function(t,r){var n=t.name,a=t.db,i=t.storeName;if(!a)throw new Error("get ".concat(i," objectStore failed in ").concat(n," database"));var s=a.transaction(i,r||"readonly").objectStore(i);return s},e.prototype.attachHandler=function(t,r,n){t.onsuccess=function(){r(t.result||null)},t.onerror=function(){n(t.error)}},e.prototype.getItem=function(t){return T(this,void 0,void 0,function(){var r,n,a,i=this;return P(this,function(s){switch(s.label){case 0:return[4,this.getDbInfo()];case 1:return r=s.sent(),n=this.getObjectStore(r),a=n.get(t),[2,new Promise(function(o,u){i.attachHandler(a,o,u)})]}})})},e.prototype.setItem=function(t,r){return T(this,void 0,void 0,function(){var n,a,i,s=this;return P(this,function(o){switch(o.label){case 0:return[4,this.getDbInfo()];case 1:return n=o.sent(),a=this.getObjectStore(n,"readwrite"),i=a.put(r,t),[2,new Promise(function(u,c){s.attachHandler(i,u,c)})]}})})},e.prototype.removeItem=function(t){return T(this,void 0,void 0,function(){var r,n,a,i=this;return P(this,function(s){switch(s.label){case 0:return[4,this.getDbInfo()];case 1:return r=s.sent(),n=this.getObjectStore(r,"readwrite"),a=n.delete(t),[2,new Promise(function(o,u){i.attachHandler(a,o,u)})]}})})},e.prototype.getDbInfo=function(){return this.ready?this.ready:Promise.reject("forget init")},e})();function Tn(e){return e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}function co(e,t){return t.startsWith(e)?"build":Tn(t)?"relative":"static"}function Wt(){if(!In())return null;try{var e=new uo({name:Ft.DATABASE_NAME,storeName:Ft.STORE_NAME});return{setItem:function(t,r){return e.setItem(t,r)},getItem:function(t){return e.getItem(t)},removeItem:function(t){return e.removeItem(t)}}}catch(t){return console.error("new IndexedDBStorage error: ".concat(t.message)),null}}function rt(){var e,t={getItem:function(){},setItem:function(){},removeItem:function(){}};try{var r=(e=(0,l.getGlobalThis)())===null||e===void 0?void 0:e.localStorage;return r||t}catch{return t}}function lo(e,t,r){var n=Object.prototype.hasOwnProperty.call(e,t);if(n)return e[t]||r}function ae(e){return e||(0,l.getPlatform)()}function Pt(e,t){try{rt().setItem(e,JSON.stringify(t))}catch(r){(0,l.log)("save localStorage failed: ".concat(r.message))}}function ln(e){if(!e)return e;var t=e.appInfo,r=e.appVersion;return t&&r?{app:t,version:r}:e}function nt(e,t){var r="".concat(Ft.LS_CACHE_APP_PREFIX,".").concat(ae(t),".").concat(e);return r}function qt(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f,p,v;return P(this,function(d){switch(d.label){case 0:r=t||{},n=r.platform,a=r.cacheKey,i=r.storageType,s=i===void 0?"indexedDB":i,o=a||nt(e,n),d.label=1;case 1:return d.trys.push([1,4,,5]),s!=="indexedDB"?[3,3]:(u=Wt(),u?[4,u.getItem(o)]:[3,3]);case 2:return c=d.sent(),[2,ln(c)];case 3:return f=rt().getItem(o),p=l.commonUtil.safeParse(f||"",null),[2,ln(p)];case 4:return v=d.sent(),console.error(v),[2,null];case 5:return[2]}})})}function Xt(e,t,r){var n=nt(e,r),a=t?.({appName:e,innerKey:n})||n;return a}function Pn(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return r=t.getCacheKey,n=t.storageType,a=t.platform,i=Xt(e,r,a),[4,qt(e,{platform:a,cacheKey:i,storageType:n})];case 1:return s=o.sent(),s?[2,{appInfo:s.app,appVersion:s.version}]:[2,null]}})})}function fo(e,t,r){var n=r==="indexedDB";if(!n)return Pt(e,t);var a=Wt();if(!a)return Pt(e,t);a.setItem(e,t).catch(function(i){(0,l.log)("save indexeddb failed, use localStorage instead, err: ".concat(i.message)),Pt(e,t)})}var Le={GET_APP_AND_VER:"getSubAppAndItsVersion",GET_APP_AND_FULL_VER:"getSubAppAndItsFullVersion",BATCH_GET_APP_AND_VER:"batchGetSubAppAndItsVersion",BATCH_GET_APP_AND_FULL_VER:"batchGetSubAppAndItsFullVersion",GET_APP_VER:"getSubAppVersion",GET_APP_FULL_VER:"getSubAppFullVersion"},Ne="get",Mn="Jsonp";function po(e){var t=e.userLsKey,r=rt().getItem(t)||"";if(r)return r;try{var n={};(0,l.getGlobalThis)().document.cookie.split(";").forEach(function(a){var i=a.split("="),s=i[0],o=i[1];n[s]=o}),r=n[t]||"",(0,l.log)("[[ getUserName ]] result:",r)}catch(a){(0,l.log)("[[ getUserName ]] err:",a)}return r}var vo=Object.freeze({__proto__:null,getUserName:po}),Mt=l.commonUtil.isNull;function tt(e,t,r){var n=(0,l.getPlatformConfig)(e),a=n.origin,i=n[t],s=a[t];return r||i||s}function Dn(e,t,r,n){var a=tt(e,t,n);if(a)return a(r);var i=vo[t]||(function(){return null});return i(r)}function se(e,t,r,n){var a=r||[],i=a[0],s=a[1];if(!Mt(i,n))return i;var o=(0,l.getPlatformConfig)(e),u=o[t];if(!Mt(u,n))return u;var c=o.origin,f=c[t];return Mt(f,n)?s:f}function Ot(e,t){var r,n=(0,l.getPlatformConfig)(e.platform),a=e.hook||{},i=n.origin,s=n.hook;return a[t]||s[t]||((r=i.hook)===null||r===void 0?void 0:r[t])}function xn(e,t){var r,n,a,i="";if(t&&(i=((r=t.getApiPrefix)===null||r===void 0?void 0:r.call(t))||t.apiPrefix),i)return i;var s=(0,l.getPlatformConfig)(e);if(i=((n=s.getApiPrefix)===null||n===void 0?void 0:n.call(s))||s.apiPrefix,i)return i;var o=s.origin;return i=((a=o.getApiPrefix)===null||a===void 0?void 0:a.call(o))||o.apiPrefix,i}var ho=11,_e={now:function(){return new Date().getTime()},rand:function(){return Math.random().toString().substring(6)},removeElem:function(e){var t=e.parentNode;t&&t.nodeType!==ho&&t.removeChild(e)},parseData:function(e){var t="";if(typeof e=="string")t=e;else if(typeof e=="object")for(var r in e)t+="".concat(t,"&").concat(r,"=").concat(encodeURIComponent(e[r]));return t+="&_t=".concat(_e.now()),t=t.substring(1),t},getJSON:function(e,t){return new Promise(function(r,n){var a="",i=e;i=i+(i.indexOf("?")===-1?"?":"&")+_e.parseData(t);var s=/callback=(\w+)/.exec(i);s?.[1]?a=s[1]:a="helJsonp_".concat(_e.now(),"_").concat(_e.rand()),i.includes("?")?i="".concat(i,"&callback=").concat(a):i="".concat(i,"?callback=").concat(a);var o=(0,l.getGlobalThis)(),u=o.document,c=u.createElement("script");c.type="text/javascript",c.src=i,c.id=a,c.onerror=n,c.addEventListener("error",n),o[a]=function(p){delete o[a];var v=u.getElementById(a);return v&&_e.removeElem(v),r(p)};var f=u.getElementsByTagName("head");f?.[0]&&f[0].appendChild(c)})}},mo=_e.getJSON;function go(){return"XMLHttpRequest"in(0,l.getGlobalThis)()?new XMLHttpRequest:null}function bo(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return r=t||{},n=r.method,a=Ie(r,["method"]),i=new Ao(a),[4,i.request(e,n)];case 1:return s=o.sent(),[2,s]}})})}var Ao=(function(){function e(t){this.req=null,this.resultPromise=Promise.resolve(null),this.init(t||{})}return e.prototype.init=function(t){var r=go();if(!r)throw new Error("current browser is not support XMLHttpRequest!");this.req=r;var n=t.responseType,a=t.timeout,i=a===void 0?1e4:a,s=t.withCredentials,o=t.headers;r.responseType=n||"json",r.timeout=i,r.withCredentials=!!s,o&&Object.keys(o).forEach(function(v){r.setRequestHeader(v,o[v])});var u=null,c=null;this.resultPromise=new Promise(function(v,d){u=v,c=d});var f=function(){var v=r.response,d=r.status,h=r.statusText,m=r.responseURL;u({data:v,status:d,statusText:h,url:m})},p=function(v){var d=r.status,h=r.statusText,m=r.responseURL;c({msg:v,status:d,statusText:h,url:m})};r.onload=function(){return f()},r.onerror=function(v){return p(v)},r.onabort=function(v){return p(v)},r.ontimeout=function(v){return p(v)},r.onprogress=function(){}},e.prototype.request=function(t,r){return T(this,void 0,Promise,function(){var n;return P(this,function(a){switch(a.label){case 0:if(!this.req)throw new Error("forget init");return this.req.open(r?r.toUpperCase():"GET",t),this.req.send(),[4,this.resultPromise];case 1:return n=a.sent(),[2,n]}})})},e})(),fn=0,yo="try_detect_latest_ver";function pn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Vn(e,t){var r="";return(0,l.allowLog)()&&(t&&(fn+=1,r="_".concat(fn)),console.time("".concat(e).concat(r))),r}function jt(e,t){(0,l.allowLog)()&&console.timeEnd("".concat(e).concat(t||""))}function So(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,Oe("".concat(t,"/").concat(e,"@latest/").concat(yo,"_").concat(Date.now()))];case 1:return r=o.sent().url,n=r.split("@"),a=n[n.length-1],i=a.split("/")[0],[2,i];case 2:return s=o.sent(),(0,l.log)("[[ getSemverLatestVer ]] returns ver(latest) due to error:",s.message),[2,"latest"];case 3:return[2]}})})}function _o(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return[4,(0,l.getGlobalThis)().fetch(e)];case 1:return r=o.sent(),n=r.status,a=r.url,[200,304].includes(n)?t?[4,r.json()]:[3,3]:[2,{url:a,reply:null,status:n}];case 2:return i=o.sent(),[2,{url:a,reply:i,status:n}];case 3:return[4,r.text()];case 4:return s=o.sent(),[2,{url:a,reply:s,status:n}]}})})}function Lo(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return[4,bo(e,{method:"GET",responseType:t?"json":"text"})];case 1:return r=o.sent(),n=r.status,a=r.data,i=r.url,s=i===void 0?"":i,n===400?[2,{url:s,reply:null,status:n}]:[2,{url:s,reply:a,status:n}]}})})}function Oe(e,t){return t===void 0&&(t=!0),T(this,void 0,void 0,function(){var r,n;return P(this,function(a){switch(a.label){case 0:return r=Lo,(0,l.getGlobalThis)().fetch&&(r=_o),[4,r(e,t)];case 1:return n=a.sent(),[2,n]}})})}function wn(e){var t=e.extraCssList,r=t===void 0?[]:t,n=e.custom;if(n){var a=n.extraCssList,i=a===void 0?[]:a,s=n.enable,o=s===void 0?!0:s;if(o){var u=l.commonUtil.merge2List(r,i);return u}}return r.slice()}var kt=l.commonUtil.safeParse,ne={handleSemverRet:function(e,t){var r=e||{},n,a=r.data||r;return t.onlyVersion&&(n=r.version||r.data,a=n),n=n||a.version,!t.isFullVersion&&n&&Reflect.deleteProperty(n,"html_content"),n?{data:a,code:"0",msg:""}:{data:null,code:"404",msg:"no version found"}},appendSearchKV:function(e,t,r){var n=e;return r&&(n+="&".concat(t,"=").concat(r)),n},appendSuffix:function(e,t){var r=e;return t&&(r+=t),r},getSemverApiVal:function(e){var t=e.semverApi;return t===void 0&&(t=!(e.customMetaUrl||e.customMetaJsonpUrl)),t}};function Jt(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u;return P(this,function(c){switch(c.label){case 0:r=null,n=t.semverApi,a=n===void 0?!0:n,i=a?Ne:t.apiMode,s="request ".concat(e),Vn(s),c.label=1;case 1:return c.trys.push([1,6,,7]),i!==Ne?[3,3]:[4,Oe(e)];case 2:return o=c.sent(),r=o.reply,[3,5];case 3:return[4,mo(e)];case 4:r=c.sent(),c.label=5;case 5:return jt(s),a?[2,ne.handleSemverRet(r,t)]:[2,r];case 6:return u=c.sent(),jt(s),[2,{data:null,code:"404",msg:u.message}];case 7:return[2]}})})}function Rn(e){var t=w({},e);return t.additional_scripts=kt(t.additional_scripts,[]),t.additional_body_scripts=kt(t.additional_body_scripts,[]),t}function zt(e){var t=w({},e);return t.src_map=kt(t.src_map,{htmlIndexSrc:"",webDirPath:"",headAssetList:[],bodyAssetList:[],chunkJsSrcList:[],chunkCssSrcList:[],staticJsSrcList:[],staticCssSrcList:[],relativeJsSrcList:[],relativeCssSrcList:[],otherSrcList:[]}),t}function Nn(e,t,r,n){return n===void 0&&(n=!1),T(this,void 0,void 0,function(){var a;return P(this,function(i){switch(i.label){case 0:return a=r,a?[3,3]:n?(a="latest",[3,3]):[3,1];case 1:return[4,So(t,e)];case 2:a=i.sent(),i.label=3;case 3:return[2,"".concat(e,"/").concat(t,"@").concat(a,"/hel_dist/hel-meta.json?_t=").concat(Date.now())]}})})}function Qt(e,t){var r=t.versionId,n=t.projectId,a=t.branchId,i=t.apiMode,s=t.isFullVersion,o=s===void 0?!1:s,u=t.versionIdList,c=u===void 0?[]:u,f=t.projectIdList,p=f===void 0?[]:f,v=t.branchIdList,d=v===void 0?[]:v,h=t.loadOptions,m=h===void 0?{}:h,g=ae(t.platform),b=e,y=b,S=r,A=n,C=a,M=!1;Array.isArray(e)&&(b=e[0],y=e.join(","),S=c.join(","),A=p.join(","),C=d.join(","),M=!0);var _=function(q,X){return se(g,q,[m[q],X])},x=function(q,X){return Dn(g,q,X,m[q])},O=_("userLsKey",l.helConsts.DEFAULT_USER_LS_KEY),j=x("getUserName",{platform:g,appName:b,userLsKey:O}),F=x("shouldUseGray",{appName:b}),k=_("apiSuffix"),H="";typeof F=="boolean"&&(H=F?"1":"0");var R=i!==Ne,V="",D="",E=!1;if(M)D=o?Le.BATCH_GET_APP_AND_FULL_VER:Le.BATCH_GET_APP_AND_VER;else{var I=_("customMetaUrl",""),N=_("customMetaJsonpUrl","");I?V=S?"".concat(I,"/").concat(b,"@").concat(S,"?"):"".concat(I,"/").concat(b,"?"):R&&N&&(V=S?"".concat(N,"/").concat(b,"@").concat(S,"?"):"".concat(N,"/").concat(b,"?")),V?E=!0:D=o?Le.GET_APP_AND_FULL_VER:Le.GET_APP_AND_VER}if(!E){var B=_("apiPathOfApp",l.helConsts.DEFAULT_API_URL),Y=xn(g,m),Q=R?Mn:"",W="".concat(D).concat(Q);V="".concat(Y).concat(B,"/").concat(W,"?name=").concat(y),V=ne.appendSearchKV(V,"version",S)}return V=ne.appendSearchKV(V,"userName",j),V=ne.appendSearchKV(V,"projId",A),V=ne.appendSearchKV(V,"branch",C),V=ne.appendSearchKV(V,"gray",H),V=ne.appendSuffix(V,k),V.endsWith("?")&&(V=V.substring(0,V.length-1)),{url:V,userName:j}}function Eo(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return r=t.versionId,n=t.platform,a=t.loadOptions,i=xn(n,a),[4,Nn(i,e,r||"",a?.skip404Sniff)];case 1:return s=o.sent(),[2,s]}})})}function Co(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o;return P(this,function(u){switch(u.label){case 0:return r=t.loadOptions,n=r===void 0?{}:r,a="",i="",s=ne.getSemverApiVal(n),s?[4,Eo(e,t)]:[3,2];case 1:return i=u.sent(),[3,3];case 2:o=Qt(e,t),i=o.url,a=o.userName,u.label=3;case 3:return[2,{url:i,userName:a}]}})})}function Io(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C;return P(this,function(M){switch(M.label){case 0:return r=t.apiMode,n=t.appName,a=t.isFullVersion,i=a===void 0?!1:a,s=t.semverApi,o=t.customMetaUrl,u=t.apiPrefix,c=u===void 0?"":u,f=t.getUrl,p=ae(t.platform),v=c||se(p,"apiPrefix"),d=se(p,"apiSuffix"),h=se(p,"apiPathOfApp"),m=se(p,"apiPathOfAppVersion"),g="",b=!!o,b?(g="".concat(o,"/").concat(n).concat(e?"@".concat(e):""),[3,4]):[3,1];case 1:return s?[4,Nn(v,n,e)]:[3,3];case 2:return g=M.sent(),[3,4];case 3:y=r===Ne?"":Mn,S=i?Le.GET_APP_FULL_VER:Le.GET_APP_VER,A="".concat(S).concat(y),C=m||h||l.helConsts.DEFAULT_API_URL,g="".concat(v).concat(C,"/").concat(A,"?ver=").concat(e),g=ne.appendSearchKV(g,"name",n),g=ne.appendSuffix(g,d),M.label=4;case 4:return g=f?.(g)||g,[2,g]}})})}function vn(e,t){var r=t;if(pn(r,"app")&&pn(r,"version")&&(r={code:0,data:{app:r.app,version:r.version}}),!r||Number(r.code)!==0)throw new Error(r?.msg||"getSubAppAndItsVersion err`");var n=r.data||{},a=n.app,i=n.version;if(!a)throw new Error("no app for ".concat(e));if(!i)throw new Error("no version for ".concat(e));return{app:Rn(a),version:zt(i)}}function Zt(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C,M=this;return P(this,function(_){switch(_.label){case 0:return r=t.versionId,n=t.branchId,a=t.projectId,i=t.platform,s=t.apiMode,o=t.loadOptions,u=o===void 0?{}:o,c="getSubAppAndItsVersionFn",f="getMeta",p=f,v=tt(i,f,u.getMeta),v||(v=tt(i,c,u.getSubAppAndItsVersionFn),p=c),[4,Co(e,t)];case 1:return d=_.sent(),h=d.url,m=d.userName,g=function(x,O){return T(M,void 0,void 0,function(){var j,F,k,H;return P(this,function(R){switch(R.label){case 0:return j=x||h,F=ne.getSemverApiVal(u),[4,Jt(j,{apiMode:O||s,semverApi:F})];case 1:return k=R.sent(),H=vn(e,k),[2,H]}})})},v?(b=Dn(i,"shouldUseGray",{appName:e},u.shouldUseGray),y={platform:i,appName:e,userName:m,versionId:r,branchId:n,projectId:a,url:h,needGrayVer:b,innerRequest:g},(0,l.log)("[[ ".concat(p," ]] fnParams:"),y),[4,Promise.resolve(v(y))]):[3,3];case 2:return S=_.sent(),A=vn(e,S),[2,A];case 3:return[4,g()];case 4:return C=_.sent(),[2,C]}})})}function To(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u,c,f,p,v,d;return P(this,function(h){switch(h.label){case 0:return r=t.apiMode,n=t.isFullVersion,a=n===void 0?!1:n,i=t.semverApi,s=t.customMetaUrl,[4,Io(e,t)];case 1:return o=h.sent(),u=s?!1:i,[4,Jt(o,{apiMode:r,isFullVersion:a,semverApi:u,onlyVersion:!0})];case 2:if(c=h.sent(),f=c.data,p=c.code,v=c.msg,parseInt(p,10)!==0||!f)throw new Error(v||"ver not found");return d=zt(f),[2,d]}})})}function Po(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u,c,f=this;return P(this,function(p){switch(p.label){case 0:return e.length?(r=t.apiMode,n=t.batchGetFn,a=t.semverApi,i=ae(t.platform),[4,Qt(e,t)]):[2,[]];case 1:return s=p.sent().url,o=function(){return T(f,void 0,void 0,function(){var v,d,h,m,g;return P(this,function(b){switch(b.label){case 0:return[4,Jt(s,{apiMode:r,semverApi:a})];case 1:if(v=b.sent(),d=v.data,h=v.code,m=v.msg,parseInt(h,10)!==0||!d)throw new Error(m||"batch get failed");return g=d.map(function(y){return{app:Rn(y.app),version:zt(y.version)}}),[2,g]}})})},u=[],n?(c={url:s,platform:i,innerRequest:o},[4,Promise.resolve(n(c))]):[3,3];case 2:return u=p.sent(),[3,5];case 3:return[4,o()];case 4:u=p.sent(),p.label=5;case 5:return[2,u]}})})}var Ut=l.commonUtil.noop,Fn=l.commonUtil.okeys;function Mo(){var e=(0,l.getGlobalThis)();e.__HEL_LOAD_ASSETS_FLAG__=1}function On(e){var t;try{var r=(t=(0,l.getGlobalThis)())===null||t===void 0?void 0:t.document,n=r.querySelector(e);return!!n}catch{return!1}}function jn(e,t){var r=e["data-helex"]||"",n=e["data-helappend"],a=(0,l.getGlobalThis)();if(n==="0")return!1;if(r){var i=r.split(",");if(t==="script"&&i.every(function(o){return!!a[o]}))return!1;var s=On("".concat(t,'[data-helex="').concat(r,'"]'));return!s}return!0}function er(e,t,r){var n=(0,l.getGlobalThis)().document;Fn(t).forEach(function(a){return e.setAttribute(a,t[a])}),r?n.body.appendChild(e):n.head.appendChild(e)}function Do(e,t){e.textContent===""?e.textContent=t:e.innerText=t}function tr(e){var t=e.attrs,r=e.innerText,n=e.appendToBody,a=n===void 0?!0:n,i=e.onloadCb,s=i===void 0?Ut:i,o=e.onerrorCb,u=o===void 0?Ut:o,c=t.src,f=Ie(t,["src"]),p=f,v=function(m){return s(m),m};if(!c&&!r)return v(!1);var d=(0,l.getGlobalThis)().document;if(c&&On('script[src="'.concat(c,'"]'))||!jn(p,"script"))return v(!1);var h=d.createElement("script");return c&&h.setAttribute("src",c),Fn(p).forEach(function(m){return h.setAttribute(m,p[m])}),h.onload=s,h.onerror=u,r&&Do(h,r),er(h,p,a),!0}function Ht(e){var t=e.appendToBody,r=t===void 0?!1:t,n=e.innerText,a=e.attrs,i=a.href,s=a.rel,o=Ie(a,["href","rel"]),u=o,c=(0,l.getGlobalThis)().document;if(!(!i&&!n)){if(!jn(u,"link"))return!1;var f=c.createElement("link");i?(f.setAttribute("href",i),f.setAttribute("rel",s||"stylesheet")):s&&f.setAttribute("rel",s),n&&(f.innerText=n),er(f,u,r)}}function xo(e){var t=e.appendToBody,r=t===void 0?!1:t,n=e.innerText,a=n===void 0?"":n,i=e.attrs,s=(0,l.getGlobalThis)().document,o=s.createElement("style");o.innerText=a,er(o,i,r)}function kn(e){return["link","staticLink","relativeLink"].includes(e.tag)}function Un(e,t){return Ut(t),["script","staticScript","relativeScript"].includes(e)}function dn(e){return e==="staticScript"}function Hn(e,t){var r=e.attrs,n=e.innerText,a=n===void 0?"":n,i=t.appendToBody,s=t.appendCss,o=t.webDirPath,u=t.cssAppendTypes,c=t.excludeCssList,f={appendToBody:i,attrs:r,innerText:a},p=r.href;if(!(p.endsWith(".ico")&&e.append!==!0)){if(p.endsWith(".css")){s&&u.includes(co(o,p))&&!c.includes(p)&&Ht(f);return}Ht(f)}}function Je(e,t){var r=t.appendToBody;e.forEach(function(n){var a=n.tag,i=n.attrs,s=n.append,o=s===void 0?!0:s,u=n.innerText,c=u===void 0?"":u;if(o){if(kn(n)){Hn(n,t);return}if(Un(a,i)){tr({appendToBody:r,attrs:i,innerText:c});return}a==="style"&&xo({appendToBody:r,attrs:i,innerText:c})}})}function Dt(e,t){return T(this,void 0,void 0,function(){var r,n;return P(this,function(a){switch(a.label){case 0:return r=t.appendToBody,n=function(i){return new Promise(function(s,o){var u=i.tag,c=i.attrs,f=i.append,p=f===void 0?!0:f,v=i.innerText,d=v===void 0?"":v;if(!p)return s(!0);if(kn(i))return Hn(i,t),s(!0);if(Un(u,c)){var h=function(){return s(!0)},m=function(g,b,y,S,A){console.error(g,b,y,S,A);var C=A instanceof Error?A:new Error(String(g));o(C)};return tr({appendToBody:r,attrs:c,innerText:d,onloadCb:h,onerrorCb:m})}s(!0)})},[4,Promise.all(e.map(n))];case 1:return a.sent(),[2]}})})}function Vo(e){var t=e.assetUrlList,r=e.appendCss,n=e.excludeCssList,a=e.appendToBody;if(t)for(var i=0,s=t;i<s.length;i++){var o=s[i];o.endsWith(".css")?r&&!n.includes(o)&&Ht({appendToBody:a,attrs:{href:o}}):tr({appendToBody:a,attrs:{src:o}})}}function wo(e,t,r){return T(this,void 0,void 0,function(){var n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C,M,_,x,O,j,F,k,H,R,V,D;return P(this,function(E){switch(E.label){case 0:return Mo(),n=e.additional_scripts,a=n===void 0?[]:n,i=e.additional_body_scripts,s=i===void 0?[]:i,o=t.src_map,u=o.headAssetList,c=u===void 0?[]:u,f=o.bodyAssetList,p=f===void 0?[]:f,v=o.webDirPath,d=o.chunkCssSrcList,h=d===void 0?[]:d,m=r.useAdditionalScript,g=m===void 0?!1:m,b=r.appendCss,y=b===void 0?!0:b,S=r.cssAppendTypes,A=S===void 0?["build","static","relative"]:S,C=r.getExcludeCssList,M=wn(r),_=l.commonUtil.merge2List(M,h),x=C?.(_,{version:t})||[],O={excludeCssList:x,webDirPath:v,appendCss:y,cssAppendTypes:A,appendToBody:!1},j={excludeCssList:x,webDirPath:v,appendCss:y,cssAppendTypes:A,appendToBody:!0},g?(F=function(I){return I.endsWith(".css")?{tag:"staticLink",attrs:{href:I}}:{tag:"staticScript",attrs:{src:I}}},k=a.map(F),H=s.map(F),[4,Dt(k,O)]):[3,3];case 1:return E.sent(),[4,Dt(H,j)];case 2:E.sent(),E.label=3;case 3:return M.length&&Vo({assetUrlList:M,excludeCssList:x,appendToBody:!1}),R=[],V=[],D=[],c.forEach(function(I){dn(I.tag)?R.push(I):V.push(I)}),p.forEach(function(I){dn(I.tag)?R.push(I):D.push(I)}),R.length?[4,Dt(R,O)]:[3,5];case 4:return E.sent(),Je(V,O),Je(D,j),[2];case 5:return Je(V,O),Je(D,j),[2]}})})}var Ae={SHADOW:!0,SET_STYLE_AS_STRING:!0,ENABLE_DISK_CACHE:!1,ENABLE_DISK_CACHE_FOR_ERR:!0,ENABLE_SYNC_META:!0,STORAGE_TYPE:"localStorage",ENABLE_APPEND_CSS:!0,API_MODE:"get",EXTRA_DATA_PREFIX:"HelExtraData"},xt="[[ isEmitVerMatchInputVer ]]";function rr(e,t){var r,n=t.branchId,a=t.platform,i=t.emitVer,s=t.inputVer,o=t.projectId,u=se(a,"strictMatchVer",[t.strictMatchVer]),c=(0,l.getAppMeta)(e,a);if(u===!1)return(0,l.log)("".concat(xt," set strictMatchVer false for app (").concat(e,"), trust emitVer (").concat(i,") is the target version")),!0;if(!i)return(0,l.log)("".concat(xt," emitVer should not be null")),!0;if(!s&&c){if(n)return(0,l.log)("".concat(xt," found branchId ").concat(n)),!0;var f=c.online_version,p=c.build_version;if(o){var v=((r=c.proj_ver)===null||r===void 0?void 0:r.map)||{},d=v[o];if(d)return i===d.b||i===p||i===d.o}return i===f||i===p}return i===s}function Ro(e){var t=(0,l.getGlobalThis)();!l.commonUtil.isServer()&&!t.HelMicro&&((0,l.log)("auto bind hel-micro to global.HelMicro"),t.HelMicro=e)}var Vt=l.helConsts.DEFAULT_ONLINE_VER,hn="http://localhost",mn="http://127.0.0.1",Bt=["script","link","style"];function No(e){var t=(0,l.getGlobalThis)().DOMParser,r=new t().parseFromString(e,"text/html"),n=[],a=function(i,s,o){i.querySelectorAll(o).forEach(function(u){var c=u.getAttributeNames(),f={};c.forEach(function(p){var v=u.getAttribute(p);v!==null&&(f[p]=v)}),n.push({head:s,tag:o,attrs:f,innerText:u.innerText})})};return Bt.forEach(function(i){return a(r.head,!0,i)}),Bt.forEach(function(i){return a(r.body,!1,i)}),n}var be={isSrcMatchHost:function(e,t){return t.startsWith(hn)||t.startsWith(mn)?e.startsWith(hn)||e.startsWith(mn):e.startsWith(t)},parseHtml:function(e){if((0,l.getGlobalThis)().DOMParser)return No(e);var t=!0,r=[],n=function(a){return Bt.includes(a)};return on(e,{onTagOpen:function(a){n(a)&&r.push({tag:a,attrs:{},innerText:"",head:t})},onTagClose:function(a,i){if(a==="head"&&(t=!1),!!n(a)){var s=r[r.length-1];if(s){var o=i.children[0]||"";typeof o=="string"&&(s.innerText=o),s.attrs=i.attrs}}}}),r},convertToAssetList:function(e,t){var r=[],n=[],a=[],i=[],s=[],o=[];return e.forEach(function(u){var c=u.head,f=u.attrs,p=u.innerText,v=u.tag,d=c?r:n,h=f.src,m=f.href,g=f["data-helex"],b=f.rel,y=lo(f,"data-helappend","1");if(v==="style")d.push({tag:v,attrs:f,innerText:p,append:!0});else{var S=h||m||"",A=S.endsWith(".css"),C=v==="link";if(!S)return;var M=!0,_=be.isSrcMatchHost(S,t);(b==="icon"||!_&&y!=="1"&&!g)&&(M=!1);var x=v;_||(Tn(S)?(x=C?"relativeLink":"relativeScript",A?s.push(S):o.push(S)):(x=C?"staticLink":"staticScript",A?a.push(S):i.push(S)));var O={tag:x,attrs:f,innerText:p,append:M};d.push(O)}}),{headAssetList:r,bodyAssetList:n,staticCssSrcList:a,staticJsSrcList:i,relativeCssSrcList:s,relativeJsSrcList:o}},getChunkList:function(e){var t=[],r=[];return e.forEach(function(n){var a=n.attrs,i=a.href,s=a.src,o=i||s||"";o&&(o.endsWith(".css")?t.push(o):r.push(o))}),{chunkCssSrcList:t,chunkJsSrcList:r}},extactHelMeta:function(e){var t=e.code,r=e.data,n=e.msg;if(t&&r){if(t!=="0")throw new Error(n||"server error occurred");return r}return e},getHelMeta:function(e,t,r){return T(this,void 0,void 0,function(){var n,a,i,s;return P(this,function(o){switch(o.label){case 0:n=function(u){return u===void 0&&(u=""),"fetch ".concat(e," helmeta by url ").concat(t," failed in custom mode! ").concat(u)},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Oe(t)];case 2:if(a=o.sent().reply,i=be.extactHelMeta(a),i&&i.app&&i.version)return i.app.__fromCust=!0,[2,i];if(r)throw new Error(n());return(0,l.log)("[[ getCustomMeta ]] 404 is a expected behavior for custom mode, user can ignore it"),[2,null];case 3:if(s=o.sent(),r)throw new Error(n(s.messgae));return l.commonUtil.noop("json parse fail or other error"),[3,4];case 4:return[2]}})})}};function Bn(e){if(e){var t=e.enable,r=t===void 0?!0:t,n=e.host;return!!(n&&r)}return!1}function Fo(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f,v,p,v,d,h,m,g,b,y,S,A,C,M,_;return P(this,function(x){switch(x.label){case 0:return r=t.host,n=t.appGroupName,a=t.skipFetchHelMeta,i=a===void 0?!1:a,s=t.isApiUrl,o=t.parseHtml,u=t.attachHostSuffix,c=u===void 0?!0:u,f=Date.now(),s?[4,be.getHelMeta(e,r,!0)]:[3,2];case 1:return v=x.sent(),[2,v];case 2:return i?[3,4]:(p=r.endsWith("hel-meta.json")?r:"".concat(r,"/hel-meta.json?_t=").concat(f),[4,be.getHelMeta(e,p)]);case 3:if(v=x.sent(),v)return[2,v];x.label=4;case 4:d="",x.label=5;case 5:return x.trys.push([5,7,,8]),h=c?"".concat(r,"/index.html?_t=").concat(f):r,[4,Oe(h,!1)];case 6:if(m=x.sent(),d=m.reply||"",![200,304].includes(m.status))throw new Error("status ".concat(m.status));return[3,8];case 7:throw g=x.sent(),new Error("".concat(g.message," from ").concat(r));case 8:return b=o||be.parseHtml,y=b(d),S=be.convertToAssetList(y,r),A=S.headAssetList,C=S.bodyAssetList,M=Ie(S,["headAssetList","bodyAssetList"]),_=be.getChunkList(A.concat(C)),[2,{app:{__fromCust:!0,name:e,app_group_name:n||e,online_version:Vt,build_version:Vt},version:{sub_app_name:e,sub_app_version:Vt,src_map:w(w({webDirPath:r,headAssetList:A,bodyAssetList:C},_),M)}}]}})})}var Gn=l.commonUtil,Oo=l.helConsts,et=l.log,gn=Oo.KEY_ASSET_CTX,bn={recordAssetCtx:function(e,t,r){var n=e.name,a=e.app_group_name,i=t.src_map,s=t.version_tag||t.sub_app_version,o=i.chunkCssSrcList,u=o===void 0?[]:o,c=i.chunkJsSrcList,f=c===void 0?[]:c,p=Ot(r,"beforeAppendAssetNode"),v=u.concat(f),d=r.platform;v.forEach(function(h){var m=(0,l.getCommonData)(gn,h)||{};m.marked||(Object.assign(m,{marked:!0,platform:d,groupName:a,name:n,ver:s,beforeAppend:p}),(0,l.setCommonData)(gn,h,m))})},tryTriggerOnFetchMetaSuccess:function(e,t,r){var n=r.loadOptions,a=r.fromFallback,i=Ot(n,"onFetchMetaSuccess");i?.({app:e,version:t,fromFallback:a})}};function Kn(e){var t=tt(e.platform,"onFetchMetaFailed",e.onFetchMetaFailed),r=Ot(e,"onFetchMetaFailed");return r||t}function jo(e,t){var r=(0,l.getPlatformConfig)(e).apiMode;return t||r}function $n(e,t){var r=ae(e),n=jo(r,t);return{platform:r,apiMode:n}}function An(e,t,r){return T(this,void 0,void 0,function(){var n,a;return P(this,function(i){switch(i.label){case 0:return n=Wt(),a=Xt(e,t,r),n?[4,n.removeItem(a)]:[3,2];case 1:i.sent(),i.label=2;case 2:return rt().removeItem(a),[2]}})})}function Yn(e,t,r){return T(this,void 0,void 0,function(){var n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C,M,_,x,O,j,F,k,H,R,V,D,E,I,N,B,Y,Q=this;return P(this,function(W){switch(W.label){case 0:return n=t.enableDiskCache,a=n===void 0?Ae.ENABLE_DISK_CACHE:n,i=t.enableSyncMeta,s=i===void 0?Ae.ENABLE_SYNC_META:i,o=t.versionId,u=o===void 0?"":o,c=t.projectId,f=c===void 0?"":c,p=t.branchId,v=t.isFullVersion,d=v===void 0?!1:v,h=t.custom,m=t.strictMatchVer,g=t.semverApi,b=(r||{}).callRemote,y=b===void 0?!0:b,S=$n(t.platform,t.apiMode),A=S.platform,C=S.apiMode,Bn(h)?[4,Fo(e,h)]:[3,2];case 1:return M=W.sent(),_=M.app,x=M.version,Fe(_,{appVersion:x,platform:A,toDisk:!1,loadOptions:t}),(0,l.setAppPlatform)(_.app_group_name,A),(0,l.setAppPlatformByAppName)(e,A),[2,{appInfo:_,appVersion:x}];case 2:return O=(0,l.getAppMeta)(e,A),j=(0,l.getVersion)(e,{platform:A,versionId:u}),F=!g&&!p,F&&O&&j&&(k=j.version_tag||j.sub_app_version,rr(e,{platform:A,projectId:f,emitVer:k,inputVer:u,strictMatchVer:m}))?[2,{appInfo:O,appVersion:j}]:(H={platform:A,apiMode:C,versionId:u,projectId:f,branchId:p,isFullVersion:d,loadOptions:t},R=null,V=function(q){return T(Q,void 0,void 0,function(){var X;return P(this,function(te){switch(te.label){case 0:return q?[4,Ho(e,H)]:[3,2];case 1:return X=te.sent(),[2,X];case 2:return[2,null]}})})},a?[4,Pn(e,t)]:[3,9]);case 3:return R=W.sent(),R?[3,5]:(et("[[ getAppFromRemoteOrLocal ]] get meta from disk but failed!"),[4,V(y)]);case 4:return R=W.sent(),[3,8];case 5:return D=R.appInfo,E=R.appVersion,et("[[ getAppFromRemoteOrLocal ]] disk meta:",R),I=E.version_tag||E.sub_app_version,u&&I!==u?[4,V(y)]:[3,7];case 6:return R=W.sent(),et("[[ getAppFromRemoteOrLocal ]] remote meta:",R),[3,8];case 7:Fe(D,{appVersion:E,platform:A,toDisk:!1,loadOptions:t}),V(s).catch(function(q){return Gn.noop(q)}),W.label=8;case 8:return[3,11];case 9:return[4,V(y)];case 10:R=W.sent(),W.label=11;case 11:return R&&(N=R.appInfo,B=N.app_group_name,Y=N.name,(0,l.setAppPlatform)(B,A),(0,l.setAppPlatformByAppName)(Y,A)),[2,R]}})})}function ko(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,o,s,o;return P(this,function(u){switch(u.label){case 0:r=t.isFirstCall,n=r===void 0?!0:r,a=t.enableDiskCacheForErr,i=a===void 0?Ae.ENABLE_DISK_CACHE_FOR_ERR:a,u.label=1;case 1:return u.trys.push([1,3,,6]),[4,Yn(e,t)];case 2:return o=u.sent(),[2,{data:o,err:""}];case 3:if(s=u.sent(),n)throw s;return Kn(t)?[2,{data:null,err:s.message}]:(o=null,i?[4,Pn(e,t)]:[3,5]);case 4:if(o=u.sent(),!o)throw s;Gn.nbalert(`
|
|
13
|
+
[Dev mode alert err only]: `.concat(s.message,`, hel-micro will try use cached data to keep your app works well,
|
|
14
|
+
please check your network if this behavior is not as you expected! you can also set enableDiskCacheForErr = false
|
|
15
|
+
to skip reusing cached data.
|
|
16
|
+
`)),u.label=5;case 5:return[2,{data:o,err:s}];case 6:return[2]}})})}function Uo(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u;return P(this,function(c){switch(c.label){case 0:return r=$n(t.platform,t.apiMode),n=r.platform,a=r.apiMode,i=w(w({},t),{platform:n,apiMode:a}),[4,Zt(e,i)];case 1:if(s=c.sent(),o=s.app,u=s.version,et("[[ getAppAndVersion ]] result:",{app:o,version:u}),!u)throw new Error("no version found or builded");return[2,{appInfo:o,appVersion:u}]}})})}function Fe(e,t){var r=t.appVersion,n=t.platform,a=t.toDisk,i=a===void 0?!0:a,s=t.loadOptions;if(!(!e||!r)){var o=e,u=o.name;if(i){var c=Xt(u,s.getCacheKey),f={app:e,version:r};fo(c,f,s.storageType)}if(s.semverApi){var p=(0,l.getAppMeta)(u,n);p?.__setByLatest!==!0&&(o=s.versionId?o:w(w({},o),{__setByLatest:!0}),(0,l.setAppMeta)(o,n))}else(0,l.setAppMeta)(e,n);(0,l.setVersion)(u,r,{platform:n});var v=wn(s),d=r.version_tag||r.sub_app_version;(0,l.setVerExtraCssList)(u,v,{platform:n,versionId:d})}}function Ho(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s;return P(this,function(o){switch(o.label){case 0:return r=t.platform,n=t.loadOptions,[4,Uo(e,t)];case 1:return a=o.sent(),i=a.appInfo,s=a.appVersion,Fe(i,{appVersion:s,platform:r,loadOptions:n}),[2,a]}})})}function Wn(e,t){return t===void 0&&(t={}),T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C,M=this;return P(this,function(_){switch(_.label){case 0:r=t.isFirstCall,n=r===void 0?!0:r,a=t.controlLoadAssets,i=a===void 0?!1:a,s=t.platform,o=t.versionId,u=o===void 0?"":o,_.label=1;case 1:return _.trys.push([1,6,,9]),[4,ko(e,t)];case 2:return c=_.sent(),f=c.data,p=c.err,v=f||{},d=v.appInfo,h=v.appVersion,m=!d||!h,g=!1,m&&!n?(b=Kn(t),b?[4,Promise.resolve(b({platform:s,appName:e,versionId:u}))]:[3,4]):[3,4];case 3:y=_.sent(),y&&(d=y.app,h=y.version,g=!0,Fe(d,{appVersion:h,platform:ae(s),toDisk:!1,loadOptions:t})),_.label=4;case 4:if(!d)throw new Error(p||"app[".concat(e,"] not exist"));if(!h)throw new Error(p||"app[".concat(e,"]'s version[").concat(u,"] not exist"));return bn.tryTriggerOnFetchMetaSuccess(d,h,{loadOptions:t,fromFallback:g}),bn.recordAssetCtx(d,h,t),S=function(){return T(M,void 0,void 0,function(){return P(this,function(x){switch(x.label){case 0:return[4,wo(d,h,t)];case 1:return x.sent(),[2]}})})},i?[2,S]:[4,S()];case 5:return _.sent(),[2,null];case 6:return A=_.sent(),n?(console.error("loadApp err and try one more time: ",A),[4,Wn(e,w(w({},t),{isFirstCall:!1}))]):[3,8];case 7:return C=_.sent(),[2,C];case 8:throw new Error("loadApp [".concat(e,"] err (").concat(A.message,"), recommend config onFetchMetaFailed hook"));case 9:return[2]}})})}function Bo(e,t){return T(this,void 0,Promise,function(){var r;return P(this,function(n){switch(n.label){case 0:return[4,To(e,t)];case 1:return r=n.sent(),[2,r]}})})}function Go(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f,p;return P(this,function(v){switch(v.label){case 0:return r=t||{},n=r.versionId,a=r.projectId,i=r.branchId,s=r.platform,o=r.reuseCache,u=o===void 0?!0:o,u&&!n&&!a&&!i&&(f=(0,l.getAppMeta)(e,s),p=(0,l.getVersion)(e,{platform:s}),f&&p&&(c={app:f,version:p})),c?[3,2]:[4,Zt(e,t||{})];case 1:c=v.sent(),v.label=2;case 2:return[2,c]}})})}function Ko(e,t){var r=t||{},n=r.versionId,a=r.platform,i=r.apiMode,s=i===void 0?Ne:i,o=r.protocol,u=o===void 0?"http":o,c=r.projectId,f=r.branchId,p=r.semverApi,v=p===void 0?!0:p,d=Qt(e,{platform:a,versionId:n,branchId:f,apiMode:s,projectId:c,semverApi:v}).url;return u==="http"&&(d=d.replace("https:","http:")),d}function $o(e,t,r){return T(this,void 0,void 0,function(){var n;return P(this,function(a){switch(a.label){case 0:return Array.isArray(e)?(n=[],e.forEach(function(i){return n.push(An(i,t,r))}),[4,Promise.all(n)]):[3,2];case 1:return a.sent(),[3,4];case 2:return[4,An(e,t,r)];case 3:a.sent(),a.label=4;case 4:return[2]}})})}var qn=Object.freeze({__proto__:null,getSubAppVersion:Bo,getSubAppMeta:Go,getMetaDataUrl:Ko,clearDiskCachedApp:$o});function Xn(e,t){var r=(0,l.getVersion)(e,t);return r?.src_map.webDirPath||""}function Ee(e,t){var r=t||{},n=ae(r.platform),a=r.versionId||"";if(!a){var i=(0,l.getVersion)(e,{platform:n});if(i)a=i.version_tag||i.sub_app_version;else{var s=(0,l.getAppMeta)(e,n);a=s?.online_version||s?.build_version||""}}return{platform:n,versionId:a}}function Yo(e,t){var r={static:[],build:[]},n=(0,l.getVersion)(e,t);if(n){var a=n.src_map,i=a.webDirPath,s=a.chunkCssSrcList;s.forEach(function(o){o.startsWith(i)?r.build.push(o):r.static.push(o)})}return r}var Wo=Xn,Jn=Object.freeze({__proto__:null,getPlatAndVer:Ee,getGroupedStyleList:Yo,getWebDirPath:Wo}),yn=l.helConsts.KEY_CSS_STR,nr=l.helLoadStatus,zn=nr.LOADED,Sn=nr.LOADING,qo=nr.NOT_LOAD,ze=l.commonUtil.merge2List,wt=(0,l.getHelEventBus)(),Rt=l.helEvents.STYLE_STR_FETCHED,ce={isStyleStatusMatch:function(e,t,r){var n=Ee(e,r),a=n.platform,i=n.versionId,s=(0,l.getVerStyleStrStatus)(e,{platform:a,versionId:i});return s===t},getSelfCssList:function(e,t){var r=Ee(e,t),n=(0,l.getVersion)(e,r),a=(0,l.getVerExtraCssList)(e,r),i=[],s=[];if(n){var o=n.src_map||{},u=o.chunkCssSrcList,c=u===void 0?[]:u,f=o.headAssetList,p=f===void 0?[]:f,v=o.bodyAssetList,d=v===void 0?[]:v;i=c;var h=function(g){var b=[];return g.forEach(function(y){var S=y.append,A=S===void 0?!0:S,C=y.attrs.href||"";C.endsWith(".css")&&A&&b.push(C)}),b},m=ze(h(p),h(d));s=ze(m,i)}return s=ze(s,a),{buildCssList:i,initExtraCssList:a,appCssList:s}},fetchStyleStr:function(e){return T(this,void 0,void 0,function(){var t,r,n,a,i,s,o;return P(this,function(u){switch(u.label){case 0:t="",r=0,n=e.length,u.label=1;case 1:if(!(r<n))return[3,7];if(a=e[r],!a.endsWith(".css"))return[3,6];if(i=(0,l.getCommonData)(yn,a),i)return[3,5];u.label=2;case 2:return u.trys.push([2,4,,5]),[4,Oe(a,!1)];case 3:return s=u.sent(),i=s.reply,(0,l.setCommonData)(yn,a,i),[3,5];case 4:return o=u.sent(),console.error(o),[3,5];case 5:t+=i,u.label=6;case 6:return r++,[3,1];case 7:return[2,t]}})})},waitStyleReady:function(e,t){return T(this,void 0,void 0,function(){var r;return P(this,function(n){switch(n.label){case 0:return r=null,[4,new Promise(function(a){r=function(i){var s=i.appName,o=i.platform,u=i.versionId,c=t.branchId,f=t.versionId,p=t.platform,v=t.strictMatchVer;s!==e||o!==p||!rr(e,{branchId:c,platform:p,emitVer:u,inputVer:f,strictMatchVer:v})||a(!0)},wt.on(Rt,r)})];case 1:return n.sent(),r&&wt.off(Rt,r),[2]}})})},computeStyleData:function(e,t){var r=Ee(e,t),n=ce.getSelfCssList(e,t),a=n.appCssList,i=n.buildCssList,s=n.initExtraCssList,o=t.extraCssList,u=o===void 0?[]:o,c=t.getExcludeCssList,f=ze(a,u),p=c?.(f,{version:(0,l.getVersion)(e,r)})||[],v=!p.length&&!u.length,d=f;return p.length&&(d=f.filter(function(h){return!p.includes(h)})),{validCssList:d,onlyUseAppCssList:v,buildCssList:i,initExtraCssList:s,appCssList:a}},fetchStyleData:function(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S;return P(this,function(A){switch(A.label){case 0:return r=Ee(e,t),n=t.extraStyleStr,a=n===void 0?"":n,i=t.cssListToStr,s=t.extraCssList,o=s===void 0?[]:s,u=t.strictMatchVer,c=t.branchId,f=ce.computeStyleData(e,t),p=f.validCssList,v=f.onlyUseAppCssList,d=f.buildCssList,h=f.initExtraCssList,m=f.appCssList,g={validCssList:p,buildCssList:d,initExtraCssList:h,appCssList:m,extraCssList:o,extraStyleStr:a,renderStyleStr:""},i?v?(b=(0,l.getVerStyleStrStatus)(e,r),y="",b!==Sn?[3,2]:[4,ce.waitStyleReady(e,w(w({},r),{strictMatchVer:u,branchId:c}))]):[3,6]:[2,g];case 1:return A.sent(),y=(0,l.getAppStyleStr)(e,r)||"",[3,5];case 2:return b!==qo?[3,4]:((0,l.setVerStyleStrStatus)(e,Sn,r),[4,ce.fetchStyleStr(m)]);case 3:return y=A.sent(),(0,l.setAppStyleStr)(e,y,r),(0,l.setVerStyleStrStatus)(e,zn,r),wt.emit(Rt,w({appName:e},r)),[3,5];case 4:y=(0,l.getAppStyleStr)(e,r)||"",A.label=5;case 5:return g.renderStyleStr="".concat(y).concat(a),[3,8];case 6:return[4,ce.fetchStyleStr(p)];case 7:S=A.sent(),g.renderStyleStr="".concat(S).concat(a),A.label=8;case 8:return[2,g]}})})}};function Xo(e,t){return T(this,void 0,Promise,function(){var r;return P(this,function(n){switch(n.label){case 0:return[4,ce.fetchStyleData(e,t||{})];case 1:return r=n.sent(),[2,r]}})})}function Jo(e,t){var r=Ee(e,t),n=(0,l.getAppStyleStr)(e,r);return n}function zo(e,t){var r=ce.getSelfCssList(e,t||{});return r}function Qo(e){return T(this,void 0,void 0,function(){var t;return P(this,function(r){switch(r.label){case 0:return[4,ce.fetchStyleStr(e)];case 1:return t=r.sent(),[2,t]}})})}function Zo(e,t){return ce.isStyleStatusMatch(e,zn,t||{})}function eu(e){var t=(0,l.getGlobalThis)();if(t.document){var r=t.document.querySelectorAll('style[data-gname="'.concat(e,'"]'));r.forEach(l.commonUtil.disableNode)}}function tu(e){var t=l.commonDataUtil.getStyleTagText(e);return t}function ru(e,t){var r=ar(e,t),n=l.commonDataUtil.getIgnoreCssPrefixCssUrlList(r)||[];return n}function ar(e,t){var r=(t||{}).custom||{},n="",a=r.host,i=r.enable,s=i===void 0?!0:i;if(a&&s)if(a.endsWith(".json")||a.endsWith(".html")){var o=a.split("/"),u=o.length;o.splice(u-1,u),n=o.join("/")}else n=a;else n=Xn(e,t);return n}var Qn=Object.freeze({__proto__:null,fetchAppStyleData:Xo,getAppStyleStr:Jo,getAppCssList:zo,fetchStyleByUrlList:Qo,isStyleFetched:Zo,disableStyleTags:eu,getStyleTagText:tu,getIgnoredCssUrlList:ru,getSuitableCssPrefix:ar});function Zn(e,t,r){var n=r.platform,a=(0,l.getAppMeta)(t,n);if(!a){var i=(0,l.getAppMeta)(e,n),s=(0,l.getVersion)(e,r);if(i&&s){(0,l.setAppMeta)(w(w({},i),{name:t,__addedByTrust:!0}),n),(0,l.setVersion)(t,w(w({},s),{sub_app_name:t,__addedByTrust:!0}),{platform:n});var o=(0,l.getVerExtraCssList)(e,r);(0,l.setVerExtraCssList)(t,o,r)}}}function nu(e,t,r){var n=r.platform,a=r.emitPlatform,i=r.versionId,s=r.emitVer,o=(0,l.getVerLib)(e,r);if(!o){Zn(e,t,r);var u=(0,l.getVerLib)(t,{platform:n,versionId:i});if(!u&&a&&(u=(0,l.getVerLib)(t,{platform:a,versionId:s,strictMatchVer:!1})),!u)throw new Error("seems plat ".concat(a," emit null lib for ").concat(t));return(0,l.libReady)(t,u,{platform:n,appName:e,versionId:i}),!1}return!0}function au(e,t,r){var n=r.platform,a=r.emitPlatform,i=r.versionId,s=r.emitVer,o=(0,l.getVerApp)(e,r);if(!o){Zn(e,t,r);var u=(0,l.getVerApp)(t,{platform:n,versionId:i});if(!u&&a&&(u=(0,l.getVerApp)(t,{platform:a,versionId:s,strictMatchVer:!1})),!u)throw new Error("seems plat ".concat(a," emit null app for ").concat(t));return Yt(w(w({},u),{platform:n,appGroupName:t,appName:e,versionId:i})),!1}return!0}function ir(e,t){var r=t.versionId,n=r===void 0?"":r,a=t.isLib,i=ae(t.platform),s=se(i,"strictMatchVer",[t.strictMatchVer]),o=w(w({},t),{strictMatchVer:s}),u=e,c=t.custom;Bn(c)&&(u=c.appGroupName||e,o.strictMatchVer=!1);var f=(0,l.getAppMeta)(u,i);if(t.semverApi&&!n&&f&&f.__setByLatest!==!0)return null;if(a){var p=(0,l.getVerLib)(u,o),v={appName:u,appGroupName:f?.app_group_name||"",platform:i,appProperties:p,isLib:!0,versionId:n,Comp:null,lifecycle:void 0};return p?v:null}var d=(0,l.getVerApp)(u,o);return d||null}function ea(e,t,r){var n="[[ judgeAppReady ]]",a=t.versionId,i=a===void 0?"":a,s=t.projectId,o=t.appName,u=t.platform,c=t.next,f=t.error,p=t.isLib,v=t.strictMatchVer;(0,l.log)("".concat(n," receive emit app and judge (emitAppInfo, judgeOptions):"),e,{inputVer:i,projectId:s,appName:o,platform:u,isLib:p,strictMatchVer:v});var d=ae(u),h=e.appName,m=e.appGroupName,g=e.platform,b=g===void 0?d:g,y=e.versionId,S="".concat(u,"/").concat(o,"/").concat(i),A=(0,l.getAppMeta)(o,u),C=r.branchId,M=r.custom,_=r.trust,x=function(Y){try{var Q=p?nu(o,m,Y):au(o,m,Y);return Q}catch(W){return f(W),!1}};if(M){var O=M.enable,j=O===void 0?!0:O,F=M.host,k=M.appGroupName,H=M.trust,R=H===void 0?!1:H,V=function(){return m&&(m===o||m===k)};if(j&&F){(0,l.log)("".concat(n," judge for custom:"),M);var D=function(Y){(0,l.log)("".concat(n," custom conf ").concat(Y?"":"mis","match current emit app!")),Y&&c()};if(!R)return D(V());var E=x({versionId:i,platform:d,emitPlatform:b,emitVer:y});return D(E)}}if(v===!1&&m&&A?.app_group_name===m&&d===b)return(0,l.log)("".concat(n," treat emitApp as wanted when strictMatchVer is false (appInfo):"),e),c();var I=function(){return(0,l.log)("".concat(n," still wait ").concat(S," to be emitted (emitAppInfo,toMatch):"),e,N)},N={branchId:C,platform:u,emitVer:y,inputVer:i,projectId:s,strictMatchVer:v};if(o!==h||!rr(o,N))return I();var B=se(d,"trustAppNames",[null,[]],{emptyArrIsNull:!1});if(d!==b&&(_||B.includes(o))){var E=x({versionId:i,platform:d,emitPlatform:b,emitVer:y});if(!E)return(0,l.log)("".concat(n," transfer ").concat(b," app [").concat(o,"] to ").concat(d," plat due to being in trustAppNames")),I()}c()}var ta=Object.freeze({__proto__:null,getLibOrApp:ir,judgeAppReady:ea});function ra(e){var t=e.platform,r=Ie(e,["platform"]);(0,l.initPlatformConfig)(r,t)}function na(){return(0,l.isSubApp)()}function Gt(e){if(e&&!e.default)try{e.default=e}catch{}return e}function at(e){var t=(0,l.getGlobalThis)();Object.keys(e).forEach(function(r){var n=e[r];n&&(t[r]=n)})}function aa(e){var t=Gt(e.React),r=Gt(e.ReactDOM),n=e.ReactIs||null,a=e.ReactReconciler||null,i={LEAH_React:t,LEAH_ReactDOM:r,LEAH_ReactIs:n,LEAH_ReactReconciler:a,React:t,ReactDOM:r,ReactIs:n,ReactReconciler:a};at(i)}function ia(e){var t=Gt(e.Vue),r={LEAH_Vue:t,Vue:t};at(r)}function sa(e){return"".concat(Ae.EXTRA_DATA_PREFIX,".").concat(e)}function oa(e,t){var r,n,a=t??!1,i=(n=(r=(0,l.getGlobalThis)().localStorage)===null||r===void 0?void 0:r.getItem(sa(e)))!==null&&n!==void 0?n:null;return i?a?JSON.parse(i):i:null}function ua(e,t,r){var n,a=r??!1,i=a?JSON.stringify(t):t;(n=(0,l.getGlobalThis)().localStorage)===null||n===void 0||n.setItem(sa(e),i)}function _n(e){var t;return typeof e=="string"?(t=(0,l.getGlobalThis)())===null||t===void 0?void 0:t.document.getElementById(e):e}function ca(e,t){return{name:e,platform:t?.platform||(0,l.getAppPlatform)(e),versionId:t?.versionId||"",getShadowAppRoot:_n,getShadowBodyRoot:_n}}var Nt=l.commonUtil.getObjsVal,iu=l.commonUtil.purify,su=Ae.ENABLE_DISK_CACHE,ou=Ae.ENABLE_SYNC_META,uu=Ae.STORAGE_TYPE,Kt="preFetchLib",cu="preFetchApp",Ce="preFetch";function la(e,t){var r=typeof t=="string"?{versionId:t}:w({},t||{});r.platform=ae(r.platform),r.isLib=e;var n=r.platform;return r.strictMatchVer=se(n,"strictMatchVer",[r.strictMatchVer]),r.storageType=r.storageType||"indexedDB",r.semverApi=se(n,"semverApi",[r.semverApi]),r}function lu(e,t,r){if(r.shadow){if(!t)return;var n=ar(e,r);l.commonDataUtil.setIgnoreCssPrefix(n),l.commonDataUtil.setIgnoreStyleTagKey(e),l.commonDataUtil.setIgnoreStyleTagKey(t),l.commonDataUtil.setIgnoreCssPrefixKey(n,t)}}function Ln(e,t,r){return T(this,void 0,void 0,function(){var n,a,i,s,o,u,c,f,p,v;return P(this,function(d){switch(d.label){case 0:return n=(0,l.getHelEventBus)(),a=t.platform,i=t.isLib,s=i===void 0?!1:i,o=t.versionId,u=t.projectId,c=t.strictMatchVer,f=s?l.helEvents.SUB_LIB_LOADED:l.helEvents.SUB_APP_LOADED,p=null,[4,new Promise(function(h,m){if(p=function(b){ea(b,{appName:e,platform:a,versionId:o,projectId:u,isLib:s,next:h,error:m,strictMatchVer:c},t)},n.on(f,p),r){var g=(0,l.getAppMeta)(e,a);g&&lu(e,g.app_group_name,t),r().catch(m)}})];case 1:return d.sent(),p&&n.off(f,p),v=ir(e,t),[2,v]}})})}function fa(e,t){return T(this,void 0,void 0,function(){var r,n,a,i,s,o,u;return P(this,function(c){switch(c.label){case 0:r=null,n=t.versionId,a=t.isLib,i=a?Kt:cu,c.label=1;case 1:return c.trys.push([1,7,,8]),r=ir(e,t),r&&(!n||n&&r.versionId===n)?((0,l.log)("[[ ".concat(i," ]] return cached app:"),e,t),[2,{emitApp:r,msg:""}]):(s=null,o=(0,l.getVerLoadStatus)(e,t),o!==l.helLoadStatus.LOADED?[3,3]:[4,Ln(e,t)]);case 2:return r=c.sent(),(0,l.log)("[[ ".concat(i," ]] return emit app:"),e,t,r),[2,{emitApp:r,msg:""}];case 3:return o===l.helLoadStatus.LOADING?[3,5]:((0,l.setVerLoadStatus)(e,l.helLoadStatus.LOADING,t),[4,Wn(e,w(w({},t),{controlLoadAssets:!0}))]);case 4:s=c.sent(),(0,l.perfPeek)(Ce,"loadApp"),c.label=5;case 5:return[4,Ln(e,t,s)];case 6:return r=c.sent(),(0,l.perfPeek)(Ce,"waitAppEmit"),(0,l.log)("[[ ".concat(i," ]] return fetch&emit app:"),e,t,r),[2,{emitApp:r,msg:""}];case 7:return u=c.sent(),console.error(u),(0,l.setVerLoadStatus)(e,l.helLoadStatus.NOT_LOAD,t),[2,{emitApp:r,msg:u.message}];case 8:return[2]}})})}function sr(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f;return P(this,function(p){switch(p.label){case 0:return(0,l.perfMark)(Ce),r="".concat(Kt,"(").concat(e,")"),n=Vn(r,!0),a=la(!0,t),[4,fa(e,a)];case 1:if(i=p.sent(),s=i.emitApp,o=i.msg,u=s?.appProperties,!u&&a.onLibNull&&(c=a.onLibNull(e,{versionId:a.versionId}),c&&(u=c)),jt(r,n),(0,l.perfPeek)(Ce,"end",!0),!u)throw f=o?" details : ".concat(o):"",new Error("".concat(Kt," ").concat(e," fail from ").concat(a.platform,", it may be an invalid module!").concat(f));return[2,u]}})})}function pa(e,t){return T(this,void 0,void 0,function(){var r,n;return P(this,function(a){switch(a.label){case 0:return(0,l.perfMark)(Ce),r=la(!1,t),[4,fa(e,r)];case 1:return n=a.sent(),(0,l.perfPeek)(Ce,"end",!0),[2,n?.emitApp||null]}})})}function va(e,t){return T(this,void 0,Promise,function(){var r,n,a,i,s,o,u,c,f,p,v,d,h,m,g,b,y,S,A,C,M,_,x,O,j;return P(this,function(F){switch(F.label){case 0:if(r=t?.preFetchConfigs||{},n=w({semverApi:!1},t?.common||{}),a=ae(n.platform),i=n.versionIdList,s=i===void 0?[]:i,o=n.projectIdList,u=o===void 0?[]:o,c=n.branchIdList,f=c===void 0?[]:c,p=[],v=[],d=[],e.length>8)throw new Error("only support 8 appName at most!");h=[],m=[],g={},b=[];for(y in e)b.push(y);S=0,F.label=1;case 1:return S<b.length?(A=b[S],C=e[A],M=r[C],_={platform:a,versionId:s[A]||"",projectId:u[A]||"",branchId:f[A]||""},typeof M=="string"&&M?_.versionId=M:typeof M=="object"&&M&&(_=w(w({},_),iu(M)),_.platform=a),g[C]=_,_.enableDiskCache=Nt([_,n],"enableDiskCache",su),_.enableSyncMeta=Nt([_,n],"enableSyncMeta",ou),_.storageType=Nt([_,n],"storageType",uu),[4,Yn(C,_,{callRemote:!1})]):[3,4];case 2:x=F.sent(),x||(m.push(C),p[A]=_.versionId||"",v[A]=_.projectId||"",d[A]=_.branchId||""),F.label=3;case 3:return S++,[3,1];case 4:return n.versionIdList=p,n.projectIdList=v,n.branchIdList=d,n.semverApi?[4,Promise.all(m.map(function(k){return Zt(k,g[k])}))]:[3,6];case 5:return h=F.sent(),[3,8];case 6:return[4,Po(m,n)];case 7:h=F.sent(),F.label=8;case 8:return h.forEach(function(k){var H=k.app,R=k.version,V=g[H.name]||{};Fe(H,{appVersion:R,platform:a,toDisk:V.enableDiskCache,loadOptions:V})}),O=e.map(function(k){return sr(k,g[k])}),[4,Promise.all(O)];case 9:return j=F.sent(),[2,j]}})})}var fu=Object.freeze({__proto__:null,core:$t,VER:Cn,emitApp:Yt,getAppCacheKey:nt,getCachedAppMeta:qt,appMetaSrv:qn,appParamSrv:Jn,appStyleSrv:Qn,logicSrv:ta,init:ra,isSubApp:na,bindExternals:at,bindReactRuntime:aa,bindVueRuntime:ia,getExtraData:oa,setExtraData:ua,getFakeHelContext:ca,batchPreFetchLib:va,preFetchApp:pa,preFetchLib:sr}),Qe=l.commonUtil.purify,pu=(0,l.getUserEventBus)(),vu=["eventBus","getExtraData","setExtraData","bindExternals","bindVueRuntime","bindReactRuntime","isSubApp"],Ze={ignoreFns:["tryGetAppName","log","commonUtil","getCommonData","setCommonData","setGlobalThis"],arg1PlatFns:["getPlatformConfig","getSharedCache"],arg2PlatFns:["initPlatformConfig","getAppMeta","setAppMeta","tryGetVersion","setAppPlatform"],arg2PlatObjFns:[]},du=["preFetchLib","preFetchApp"],hu=["getSubAppMeta","getMetaDataUrl"],mu=["emitApp","init"],gu=["getAppCacheKey"];function bu(e,t){var r=this,n=t.fnName,a=t.fn,i=t.isCore,s=t.preFetchOptions;return function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var c=function(y){return w({platform:e},Qe(y||{}))},f=o[0],p=o[1],v=o[2];if(i){if(n==="getPlatform")return e;Ze.arg1PlatFns.includes(n)?o[0]=f||e:Ze.arg2PlatFns.includes(n)?o[1]=p||e:Ze.arg2PlatObjFns.includes(n)?o[1]=c(p):Ze.ignoreFns.includes(n)||(n.startsWith("set")?o[2]=c(v):o[1]=c(p))}else if(n==="batchPreFetchLib"){var d=p||{},h=c(d.common);o[1]=w(w({},d),{common:h})}else if(du.includes(n)){var m=Qe(typeof p=="string"?{versionId:p}:p||{});s&&(m=Qe(w(w({},s),m))),o[1]=w({platform:e},m)}else if(hu.includes(n)){var g=(s||{}).semverApi,b=g===void 0?!0:g;o[1]=c(w({semverApi:b},Qe(p||{})))}else mu.includes(n)?o[0]=c(f):gu.includes(n)?o[1]=p||e:o[1]=c(p);return a.apply(r,o)}}function da(e,t,r){var n=r.preFetchOptions,a=r.isCore,i={};return Object.keys(t).forEach(function(s){var o=t[s];if(vu.includes(s)){i[s]=o;return}var u=typeof o;if(u==="function"){var c={fnName:s,fn:o,isCore:a,preFetchOptions:n};i[s]=bu(e,c);return}if(o&&u==="object"){var f=w(w({},r),{isCore:s==="core"});i[s]=da(e,o,f);return}i[s]=o}),i}function or(e,t){var r=da(e,fu,{preFetchOptions:t});return r.createInstance=or,r.createOriginInstance=ha,r.resetGlobalThis=l.resetGlobalThis,r.eventBus=pu,r.default=r,r}function ha(e,t){var r=t||{},n=r.trustAppNames,a=Ie(r,["trustAppNames"]);return(0,l.originInit)(e,t),or(e,a)}var ma=Cn,Au=sr,yu=pa,Su=va,_u=Qn,Lu=Jn,Eu=qn,Cu=ta,Iu=Yt,Tu=ra,Pu=na,Mu=nt,Du=qt,xu=ca,Vu=oa,wu=ua,Ru=at,Nu=ia,ga=aa,Fu=$t,Ou=l.resetGlobalThis,ju=or,ku=ha,Uu=(0,l.getUserEventBus)();Fu.log("hel-micro ver ".concat(ma));var ba={VER:ma,preFetchLib:Au,preFetchApp:yu,batchPreFetchLib:Su,appStyleSrv:_u,appParamSrv:Lu,appMetaSrv:Eu,logicSrv:Cu,emitApp:Iu,eventBus:Uu,init:Tu,isSubApp:Pu,getAppCacheKey:Mu,getCachedAppMeta:Du,getFakeHelContext:xu,getExtraData:Vu,setExtraData:wu,bindExternals:Ru,bindVueRuntime:Nu,bindReactRuntime:ga,resetGlobalThis:Ou,core:$t,createInstance:ju,createOriginInstance:ku};Ro(ba);l.commonUtil.noop(En.default);var ur=ba;var je=ke(Sa(),1),{preFetchLib:Gu}=ur,{HEL_BASES:nc}=je.default;function cr(e){try{return je.default.packageRef(e)}catch(t){throw ee(t.message)}}var pe=class extends Error{constructor({moduleName:t,host:r,phase:n,message:a,missingExports:i=[],cause:s}){super(a,{cause:s}),this.name="HelLoadError",this.moduleName=t,this.host=r,this.phase=n,this.missingExports=i,this.cause=s}};function ee(e,t="",r=""){return new pe({moduleName:t,host:r,phase:"config",message:"[hel-loader] "+e})}function lr(e){let t;try{t=new URL(e)}catch{throw ee("\u9700\u8981\u7EDD\u5BF9 HTTP(S) \u5730\u5740\uFF1A"+e)}if(!/^https?:$/.test(t.protocol))throw ee("\u4E0D\u652F\u6301\u7684\u5730\u5740\u534F\u8BAE\uFF1A"+e);return t}function La(e){return/\/hel-meta\.json$/i.test(lr(e.trim()).pathname)}function vr(e,t={}){if(e&&typeof e=="object"){if(typeof e.name!="string"||!e.name.trim()||typeof e.host!="string")throw ee("\u663E\u5F0F\u4F9D\u8D56\u9700\u8981 name \u548C host");return lr(e.host),{...e,name:e.name.trim()}}if(typeof e!="string"||!e.trim())throw ee("\u4F9D\u8D56\u5FC5\u987B\u662F\u5305\u5F15\u7528\u3001URL \u6216\u663E\u5F0F\u4F9D\u8D56\u5BF9\u8C61");let r=e.trim(),n=t.type||"unpkg";if(!["custom","unpkg","github"].includes(n))throw ee("\u672A\u77E5\u52A0\u8F7D\u7C7B\u578B\uFF1A"+n);let a,i;if(/^https?:\/\//i.test(r)){a=lr(r);let o=a.pathname.replace(/\/+$/,"").replace(/\/(?:(?:hel_dist|dist)(?:\/(?:hel-meta\.json|index\.html))?|hel-meta\.json|index\.html)$/i,"");i=cr(decodeURIComponent(o.split("/").pop()||""))}else{i=cr(r.replace(/^\//,""));try{a=je.default.packageUrl(i,{...t,type:n})}catch(o){throw ee(o.message)}}let s=a.pathname.replace(/\/+$/,"");if(a.pathname=s,!/\/(?:hel-meta\.json|index\.html)$/i.test(s)){let o=/\/(hel_dist|dist)$/i.exec(s),u=o?o[1].toLowerCase():/^(?:tpl|demo)-/.test(i.name)?"dist":"hel_dist";a.pathname=s+(o?"":"/"+u)+(u==="dist"?"/index.html":"/hel-meta.json")}return{name:i.name,host:a.href}}function _a(e){let t=e.name.split("/").pop();return t.startsWith("libs-")?0:t.startsWith("comps-")?1:2}function Ku(e){if(!e||!Array.isArray(e.deps))throw ee("\u9884\u52A0\u8F7D\u9700\u8981 deps \u6570\u7EC4");let t=e.deps.map(n=>vr(n,e)),r=new Map;for(let n of t){let a=Ea(n),i=Ca(n);if(r.has(a)&&r.get(a)!==i)throw ee("\u540C\u4E00\u6A21\u5757\u4E0D\u80FD\u914D\u7F6E\u591A\u4E2A\u5730\u5740\u6216\u7248\u672C\uFF1A"+n.name,n.name,n.host);r.set(a,i)}return t.sort((n,a)=>_a(n)-_a(a))}function fr(e,t,r,n=[]){if(!r||typeof r!="object"&&typeof r!="function")throw new pe({moduleName:e,host:t,phase:"ready",message:"[hel-loader] "+e+" \u672A\u8FD4\u56DE\u8FDC\u7A0B\u6A21\u5757\u5BF9\u8C61"});let a=n.filter(i=>!(i in r)||r[i]==null);if(a.length)throw new pe({moduleName:e,host:t,phase:"exports",missingExports:a,message:"[hel-loader] "+e+" \u7F3A\u5C11\u5BFC\u51FA\uFF1A"+a.join(", ")})}function $u(e,t){let r=e&&e.version&&e.version.src_map;if(!r||!La(t))return;let n=new URL(".",t).href,a=String(r.webDirPath||"").replace(/\/+$/,""),i=s=>{if(typeof s!="string"||!s||/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(s))return s;let o=a&&s.startsWith(a+"/")?new URL(s.slice(a.length+1),n).href:new URL(a?s:s.replace(/^\/+/,""),n).href;if(typeof document<"u"&&document.baseURI){let u=ur.core,c=new URL(s,document.baseURI).href;u.setCommonData(u.helConsts.KEY_ASSET_CTX,c,{marked:!0,beforeAppend:({setAssetUrl:f})=>{f(o)}})}return o};for(let[s,o]of Object.entries(r))if(s==="headAssetList"||s==="bodyAssetList")for(let u of o||[])for(let c of["src","href"])u.attrs&&u.attrs[c]&&(u.attrs[c]=i(u.attrs[c]));else s.endsWith("List")&&Array.isArray(o)?r[s]=o.map(i):s!=="webDirPath"&&/(?:Path|Src|Index)$/.test(s)&&(r[s]=i(o));/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(a)||(r.webDirPath=n.replace(/\/$/,""))}function dr(e){return{...e.platform?{platform:e.platform}:{},hook:{onFetchMetaSuccess:t=>$u(t,e.host)},custom:{skipFetchHelMeta:!La(e.host),enable:!0,trust:!0,...e.custom||{},host:e.host,appGroupName:e.appGroupName||e.custom&&e.custom.appGroupName||e.name}}}function Ea(e){let t=dr(e);return JSON.stringify([e.platform||"",t.custom.appGroupName||e.name])}function pr(e){return Array.isArray(e)?e.map(pr):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,pr(e[t])])):e}function Ca(e){return JSON.stringify(pr([e.name,dr(e)]))}function Yu(e=Gu){let t=new Map,r=Promise.resolve();function n(s,o={}){let u,c,f;try{u=vr(s,o),c=Ea(u),f=Ca(u)}catch(d){return Promise.reject(d)}let p=t.get(c);if(p&&p.key!==f)return Promise.reject(ee("\u6A21\u5757\u5DF2\u4F7F\u7528\u53E6\u4E00\u5730\u5740\u6216\u7248\u672C\u52A0\u8F7D\uFF1A"+u.name,u.name,u.host));let v=p&&p.promise;return v||(v=r.then(async()=>{try{let d=await e(u.name,dr(u));return fr(u.name,u.host,d),d}catch(d){throw d instanceof pe?d:new pe({moduleName:u.name,host:u.host,phase:"assets",cause:d,message:"[hel-loader] "+u.name+" \u52A0\u8F7D\u5931\u8D25\uFF1A"+(d instanceof Error?d.message:String(d))})}}),t.set(c,{key:f,promise:v}),r=v.then(()=>{},()=>{t.delete(c)})),v.then(d=>(fr(u.name,u.host,d,u.requiredExports),d))}async function a(s){let o=[];for(let u of s)o.push(await n(u));return o}async function i(s){let o=Object.create(null);for(let u of Ku(s))o[u.name]=await n(u);return o}return{loadHelLib:n,loadHelLibsSerial:a,preloadHelLibs:i}}var Wu=Yu(),{loadHelLib:qu,loadHelLibsSerial:ac,preloadHelLibs:ic}=Wu;async function Xu(e){let t=e.dep?vr(e.dep,e):null,r=t?t.name:"remote",n=t?t.host:"";if(!e.exportName||typeof e.exportName!="string")throw ee("\u7EC4\u4EF6\u9700\u8981 exportName");if(!t&&typeof e.loader!="function")throw ee("\u7EC4\u4EF6\u9700\u8981 dep \u6216 loader");let a=e.loader?await e.loader():await qu(t);fr(r,n,a,[e.exportName]);let i=a[e.exportName];if(typeof i!="object"&&typeof i!="function")throw new pe({moduleName:r,host:n,phase:"exports",missingExports:[e.exportName],message:"[hel-loader] "+e.exportName+" \u4E0D\u662F\u53EF\u7528\u7684\u7EC4\u4EF6\u5BFC\u51FA"});return i}function sc(e,t=()=>{}){let r=0,n=!1,a={status:"loading",component:null,error:null},i=u=>{a=u,t(u)};function s(u){n||(r++,i({status:"error",component:null,error:u}),e.onError&&e.onError(u))}async function o(){if(n)return;let u=++r;i({status:"loading",component:null,error:null});try{let c=await Xu(e);!n&&u===r&&i({status:"ready",component:c,error:null})}catch(c){!n&&u===r&&s(c)}}return{getState:()=>a,load:o,retry:o,fail:s,dispose:()=>{n=!0,r++}}}function oc({packageName:e,target:t,version:r="",projectName:n,baseUrl:a=""}){let i=cr(e);i.version=r;let s=je.default.packageUrl(i,{type:t==="sftp"?"custom":t,base:a,projectName:t==="unpkg"?void 0:n,versioned:t==="unpkg"});return s.pathname+="/hel_dist/hel-meta.json",s.href}export{nc as HEL_BASES,pe as HelLoadError,fr as assertHelExports,ga as bindReactRuntime,sc as createHelComponentResource,Yu as createHelLoader,La as isHelMetaHost,Xu as loadHelComponent,qu as loadHelLib,ac as loadHelLibsSerial,ic as preloadHelLibs,vr as resolveHelDep,Ku as resolveHelDeps,oc as resolveHelHost};
|
|
17
|
+
/*! Bundled license information:
|
|
18
|
+
|
|
19
|
+
hel-lib-proxy/dist/hel-lib-proxy.min.js:
|
|
20
|
+
(*! *****************************************************************************
|
|
21
|
+
Copyright (c) Microsoft Corporation.
|
|
22
|
+
|
|
23
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
24
|
+
purpose with or without fee is hereby granted.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
27
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
28
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
29
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
30
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
31
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
33
|
+
***************************************************************************** *)
|
|
34
|
+
|
|
35
|
+
hel-micro/es/index.js:
|
|
36
|
+
(*! *****************************************************************************
|
|
37
|
+
Copyright (c) Microsoft Corporation.
|
|
38
|
+
|
|
39
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
40
|
+
purpose with or without fee is hereby granted.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
43
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
44
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
45
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
46
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
47
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
48
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
49
|
+
***************************************************************************** *)
|
|
50
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melt-js/libs-core",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/remote.mjs",
|
|
6
6
|
"module": "src/remote.mjs",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"doctrine": "3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"esbuild": "0.25.12",
|
|
26
27
|
"typescript": "5.9.3"
|
|
27
28
|
},
|
|
28
29
|
"exports": {
|
|
@@ -33,13 +34,23 @@
|
|
|
33
34
|
"./src/*": "./src/*",
|
|
34
35
|
"./scripts/*": "./scripts/*",
|
|
35
36
|
"./package.json": "./package.json",
|
|
36
|
-
"./vdoc-parser": "./scripts/vdoc-parser/index.mjs"
|
|
37
|
+
"./vdoc-parser": "./scripts/vdoc-parser/index.mjs",
|
|
38
|
+
"./browser": {
|
|
39
|
+
"types": "./src/browser.d.mts",
|
|
40
|
+
"default": "./dist/browser.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./demo": {
|
|
43
|
+
"types": "./src/demo/index.d.mts",
|
|
44
|
+
"default": "./src/demo/index.mjs"
|
|
45
|
+
}
|
|
37
46
|
},
|
|
38
47
|
"files": [
|
|
39
48
|
"src",
|
|
40
49
|
"scripts",
|
|
41
50
|
"tsconfig.json",
|
|
42
|
-
"README.md"
|
|
51
|
+
"README.md",
|
|
52
|
+
"dist",
|
|
53
|
+
"demo"
|
|
43
54
|
],
|
|
44
55
|
"bin": {
|
|
45
56
|
"hel-publish-stage": "./scripts/publish-stage.mjs",
|
|
@@ -48,6 +59,7 @@
|
|
|
48
59
|
"scripts": {
|
|
49
60
|
"typecheck": "tsc --noEmit",
|
|
50
61
|
"test": "node --test tests/*.test.mjs",
|
|
51
|
-
"publish:stage": "node scripts/publish-stage.mjs"
|
|
62
|
+
"publish:stage": "node scripts/publish-stage.mjs",
|
|
63
|
+
"build": "node scripts/build-browser.mjs"
|
|
52
64
|
}
|
|
53
65
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { build } from 'esbuild'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
await build({
|
|
5
|
+
entryPoints: [fileURLToPath(new URL('../src/browser.mjs', import.meta.url))],
|
|
6
|
+
outfile: fileURLToPath(new URL('../dist/browser.mjs', import.meta.url)),
|
|
7
|
+
bundle: true,
|
|
8
|
+
format: 'esm',
|
|
9
|
+
platform: 'browser',
|
|
10
|
+
target: 'es2020',
|
|
11
|
+
minify: true,
|
|
12
|
+
legalComments: 'eof',
|
|
13
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import { parse } from '@babel/parser'
|
|
3
|
+
|
|
4
|
+
/** Supplement props schemas with Vue event declarations; no component evaluation. */
|
|
5
|
+
export function parseComponentEvents(file) {
|
|
6
|
+
const source = fs.readFileSync(file, 'utf8')
|
|
7
|
+
const events = new Map()
|
|
8
|
+
const add = (name, type = '', description = '') => {
|
|
9
|
+
if (!name || typeof name !== 'string') return
|
|
10
|
+
const previous = events.get(name)
|
|
11
|
+
events.set(name, { name, type: type || previous?.type || '', description: description || previous?.description || '', default: '', required: false, version: '', isEvent: true, bindable: false })
|
|
12
|
+
}
|
|
13
|
+
for (const match of source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
14
|
+
const code = match[1]
|
|
15
|
+
const ast = parse(code, { sourceType: 'module', plugins: ['typescript', 'jsx', 'decorators-legacy'] })
|
|
16
|
+
const text = node => node ? code.slice(node.start, node.end) : ''
|
|
17
|
+
const nameOf = node => node?.name || node?.value
|
|
18
|
+
const description = node => (node.leadingComments || []).map(comment => comment.value.replace(/\*/g, '').trim()).join(' ').replace(/^@description\s*/, '')
|
|
19
|
+
function walk(node) {
|
|
20
|
+
if (!node || typeof node !== 'object') return
|
|
21
|
+
if (node.type === 'CallExpression') {
|
|
22
|
+
const callee = node.callee
|
|
23
|
+
if (callee.type === 'Identifier' && callee.name === 'defineEmits') {
|
|
24
|
+
const declaration = node.typeParameters?.params?.[0] || node.typeArguments?.params?.[0]
|
|
25
|
+
if (declaration?.type === 'TSTypeLiteral') {
|
|
26
|
+
for (const member of declaration.members) {
|
|
27
|
+
if (member.type === 'TSPropertySignature') add(nameOf(member.key), text(member.typeAnnotation?.typeAnnotation), description(member))
|
|
28
|
+
if (member.type === 'TSCallSignatureDeclaration') {
|
|
29
|
+
const parameters = member.parameters || []
|
|
30
|
+
const eventType = parameters[0]?.typeAnnotation?.typeAnnotation
|
|
31
|
+
const names = eventType?.type === 'TSUnionType' ? eventType.types : [eventType]
|
|
32
|
+
for (const item of names) if (item?.type === 'TSLiteralType') add(item.literal.value, parameters.slice(1).map(text).join(', ') || '无参数', description(member))
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const runtime = node.arguments[0]
|
|
37
|
+
if (runtime?.type === 'ArrayExpression') for (const item of runtime.elements) add(item?.value)
|
|
38
|
+
if (runtime?.type === 'ObjectExpression') for (const item of runtime.properties) add(nameOf(item.key), '', description(item))
|
|
39
|
+
}
|
|
40
|
+
if ((callee.type === 'Identifier' && callee.name === 'emit') || (callee.type === 'MemberExpression' && nameOf(callee.property) === '$emit')) {
|
|
41
|
+
if (node.arguments[0]?.type === 'StringLiteral') add(node.arguments[0].value)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (node.type === 'ObjectProperty' && nameOf(node.key) === 'emits') {
|
|
45
|
+
if (node.value.type === 'ArrayExpression') for (const item of node.value.elements) add(item?.value)
|
|
46
|
+
if (node.value.type === 'ObjectExpression') for (const item of node.value.properties) add(nameOf(item.key), '', description(item))
|
|
47
|
+
}
|
|
48
|
+
for (const [key, child] of Object.entries(node)) {
|
|
49
|
+
if (['loc', 'comments', 'tokens', 'leadingComments', 'trailingComments'].includes(key)) continue
|
|
50
|
+
if (Array.isArray(child)) child.forEach(walk)
|
|
51
|
+
else if (child && typeof child === 'object') walk(child)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
walk(ast.program)
|
|
55
|
+
}
|
|
56
|
+
return [...events.values()]
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const fs = require('node:fs')
|
|
2
|
+
const path = require('node:path')
|
|
3
|
+
|
|
4
|
+
function normalizeAssetUrl(value) {
|
|
5
|
+
if (typeof value !== 'string') return value
|
|
6
|
+
const origin = value.match(/^(?:https?:)?\/\/[^/\\]+/i)?.[0] || ''
|
|
7
|
+
return origin + value.slice(origin.length).replace(/\\/g, '/').replace(/\/{2,}/g, '/')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function normalizeSrcMap(srcMap) {
|
|
11
|
+
for (const [key, value] of Object.entries(srcMap)) {
|
|
12
|
+
if (key.endsWith('List') && Array.isArray(value)) {
|
|
13
|
+
if (key === 'headAssetList' || key === 'bodyAssetList') {
|
|
14
|
+
for (const asset of value) {
|
|
15
|
+
for (const attr of ['src', 'href']) {
|
|
16
|
+
if (asset.attrs?.[attr]) asset.attrs[attr] = normalizeAssetUrl(asset.attrs[attr])
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
} else srcMap[key] = [...new Set(value.map(normalizeAssetUrl))]
|
|
20
|
+
} else if (typeof value === 'string' && /(?:Path|Src|Index)$/.test(key)) srcMap[key] = normalizeAssetUrl(value)
|
|
21
|
+
}
|
|
22
|
+
// hel-dev-utils trims the trailing slash, turning the root homePage into an empty string.
|
|
23
|
+
if (!srcMap.webDirPath && srcMap.htmlIndexSrc === '/index.html') srcMap.webDirPath = '/'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Accept the caller's directly declared hel-dev-utils dependency; no cross-package lookup.
|
|
27
|
+
module.exports = function withHelBuildPaths(helDevUtils) {
|
|
28
|
+
const adapted = { ...helDevUtils }
|
|
29
|
+
for (const factory of ['createVueSubApp', 'createReactSubApp', 'createLibSubApp']) {
|
|
30
|
+
adapted[factory] = (...args) => {
|
|
31
|
+
const appInfo = helDevUtils[factory](...args)
|
|
32
|
+
if (process.env.HEL_RELATIVE_PATH === '1' && process.env.HEL_APP_HOME_PAGE === '/' && appInfo.homePage === '/') {
|
|
33
|
+
appInfo.getPublicPathOrUrl = () => '/'
|
|
34
|
+
}
|
|
35
|
+
return appInfo
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
adapted.extractHelMetaJson = async options => {
|
|
39
|
+
if (process.env.HEL_RELATIVE_PATH !== '1') return helDevUtils.extractHelMetaJson(options)
|
|
40
|
+
const meta = await helDevUtils.extractHelMetaJson({ ...options, writeMetaJsonToDist: false })
|
|
41
|
+
normalizeSrcMap(meta.version.src_map)
|
|
42
|
+
if (options.writeMetaJsonToDist !== false) {
|
|
43
|
+
fs.writeFileSync(path.join(options.buildDirFullPath, 'hel-meta.json'), JSON.stringify(meta, null, 2))
|
|
44
|
+
}
|
|
45
|
+
return meta
|
|
46
|
+
}
|
|
47
|
+
return adapted
|
|
48
|
+
}
|
package/scripts/package-env.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const { expand } = require('dotenv-expand')
|
|
|
6
6
|
const { packageRef, packageUrl } = require('../src/remote-address.cjs')
|
|
7
7
|
|
|
8
8
|
const PUBLIC_ENV_KEYS = ['SFTP_PUBLIC_URL', 'GITHUB_PUBLIC_URL', 'UNPKG_PUBLIC_URL']
|
|
9
|
+
const WORKSPACE_ENV_KEYS = [...PUBLIC_ENV_KEYS, 'HEL_RELATIVE_PATH']
|
|
9
10
|
const TARGETS = ['local', 'sftp', 'github', 'unpkg']
|
|
10
11
|
const trim = value => String(value || '').trim().replace(/\/+$/, '')
|
|
11
12
|
|
|
@@ -85,6 +86,13 @@ function assertSameOrigin(url, base, slot) {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
// Keep the deployment directory while allowing the same static files on another origin.
|
|
90
|
+
function resolveBuildHomePage(env, homePage = env.HEL_APP_HOME_PAGE) {
|
|
91
|
+
if (env.HEL_RELATIVE_PATH !== '1') return homePage
|
|
92
|
+
if (/^(?:https?:)?\/\//i.test(homePage || '')) return new URL(homePage, 'https://hel.invalid').pathname
|
|
93
|
+
return homePage || '/'
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
function loadPackageEnv({ cwd = process.cwd(), mode = 'development', env = process.env, target, localBuild = false } = {}) {
|
|
89
97
|
const inherited = { ...env }
|
|
90
98
|
// Recompute our own defaults on reload, but preserve values changed by cross-env.
|
|
@@ -151,9 +159,14 @@ function loadPackageEnv({ cwd = process.cwd(), mode = 'development', env = proce
|
|
|
151
159
|
put(`VUE_APP_${slot}_LOCAL_URL`, values[`${slot}_LOCAL_URL`])
|
|
152
160
|
}
|
|
153
161
|
if (localBuild && values.VITE_DEV_ORIGIN) put('HEL_APP_HOME_PAGE', values.VITE_DEV_ORIGIN)
|
|
162
|
+
if (runtimeMode === 'production' && !localBuild) {
|
|
163
|
+
const homePage = resolveBuildHomePage(values)
|
|
164
|
+
if (homePage) values.HEL_APP_HOME_PAGE = homePage
|
|
165
|
+
}
|
|
154
166
|
if (deployTarget) put('VUE_APP_PUBLISH_MODE', deployTarget)
|
|
155
167
|
values.HEL_ENV_PACKAGE = path.resolve(cwd)
|
|
156
|
-
const computed = Object.fromEntries(Object.entries(values).filter(([key, value]) =>
|
|
168
|
+
const computed = Object.fromEntries(Object.entries(values).filter(([key, value]) =>
|
|
169
|
+
!key.startsWith('HEL_ENV_') && inherited[key] !== value && !(key === 'HEL_APP_HOME_PAGE' && inherited[key])))
|
|
157
170
|
values.HEL_ENV_DERIVED_KEYS = Object.keys(computed).join(',')
|
|
158
171
|
values.HEL_ENV_GENERATED = JSON.stringify(computed)
|
|
159
172
|
return values
|
|
@@ -177,4 +190,4 @@ function applyPackageEnv({ cwd = process.cwd(), mode = inferMode() } = {}) {
|
|
|
177
190
|
return values
|
|
178
191
|
}
|
|
179
192
|
|
|
180
|
-
module.exports = { applyPackageEnv, inferMode, PUBLIC_ENV_KEYS, readEnvFile, readPackageFiles, remoteSlots, resolveTarget, resolveRemoteUrl, loadPackageEnv }
|
|
193
|
+
module.exports = { applyPackageEnv, inferMode, PUBLIC_ENV_KEYS, WORKSPACE_ENV_KEYS, readEnvFile, readPackageFiles, remoteSlots, resolveTarget, resolveRemoteUrl, resolveBuildHomePage, loadPackageEnv }
|
package/src/browser.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface DocumentationEvent { name: string; type?: string; description?: string }
|
|
2
|
+
export interface ComponentDocumentation {
|
|
3
|
+
description?: string
|
|
4
|
+
requirements?: string[]
|
|
5
|
+
events?: Array<DocumentationEvent | string>
|
|
6
|
+
code?: string
|
|
7
|
+
}
|
|
8
|
+
export interface DocumentationSchema { name: string; type?: string; default?: unknown; required?: boolean | string; description?: string; isEvent?: boolean }
|
|
9
|
+
export interface DocumentationOptions extends ComponentDocumentation {
|
|
10
|
+
name?: string
|
|
11
|
+
schema?: DocumentationSchema[]
|
|
12
|
+
values?: Record<string, unknown>
|
|
13
|
+
framework?: 'vue2' | 'vue3' | 'react'
|
|
14
|
+
slotHtml?: Record<string, string>
|
|
15
|
+
models?: Array<{ prop: string; event: string }>
|
|
16
|
+
}
|
|
17
|
+
export function buildComponentDocs(options?: DocumentationOptions): {
|
|
18
|
+
name: string
|
|
19
|
+
props: Array<{ name: string; type: string; default: string; required: boolean; description: string }>
|
|
20
|
+
events: Array<{ name: string; type: string; description: string }>
|
|
21
|
+
description: string
|
|
22
|
+
requirements: string[]
|
|
23
|
+
code: string
|
|
24
|
+
}
|
|
25
|
+
export function componentEvents(component: unknown, listeners?: Record<string, unknown>): string[]
|