@wdslib/go-utils 0.3.93 → 0.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import e from"axios";import t,{uniq as o}from"lodash";import r from"crypto-js";import{setOptionColorByTheme as i}from"@anov/ui/lib/utils/option-theme.js";function a(e,t,o,r){return new(o||(o=Promise))((function(i,a){function n(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(n,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const n=3e4,s=3e4,l=(t="",o)=>{let r=e.create({baseURL:t,timeout:n,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});return r.interceptors.request.use((function(e){return sessionStorage.getItem("anov-go-token")&&"null"!=sessionStorage.getItem("anov-go-token")&&(e.headers["X-ANOV-ACCESS-TOKEN"]=sessionStorage.getItem("anov-go-token")),sessionStorage.getItem("unify-access-token")&&"null"!=sessionStorage.getItem("unify-access-token")&&(e.headers["X-UNIFY-ACCESS-TOKEN"]=sessionStorage.getItem("unify-access-token")),sessionStorage.getItem("dgcc_authorization")&&"null"!=sessionStorage.getItem("dgcc_authorization")&&(e.headers.dgcc_authorization=sessionStorage.getItem("dgcc_authorization")),"post"===e.method?(e.headers["Content-Type"]="application/json;",e):"get"===e.method?e:"put"===e.method?(e.headers["Content-Type"]="application/json; charset=UTF-8",e):"delete"===e.method?e:void 0}),(function(e){return Promise.reject(e)})),r.interceptors.response.use((function(e){return 200===e.status||e.data.code,o&&o(e),e.data}),(function(e){return o&&o(null==e?void 0:e.response),Promise.reject(e.response)})),r},d=function(e){return a(this,void 0,void 0,(function*(){try{let{fontUrl:t,fontName:o}=e;const r="__custom_font__";let i=document.getElementById(r);if(!i){i=document.createElement("style"),i.id=r;const e=document.head||document.getElementsByTagName("head")[0];yield e.appendChild(i)}i.innerText+=`@font-face{font-family:'${o}';src:url(${t});}`}catch(e){console.warn(e)}}))},c=(e,...t)=>a(void 0,[e,...t],void 0,(function*(e,t="jspaths",o){const r="csspaths"===t?"link":"script",i=document.createElement(r);"jspaths"===t?i.defer=!0:i.rel="stylesheet",i.className=t,i.src=e;(o||document.head||document.getElementsByTagName("head")[0]).appendChild(i),yield new Promise(((e,t)=>{i.addEventListener("load",e),i.addEventListener("error",e)}))})),u=(e,...t)=>a(void 0,[e,...t],void 0,(function*(e,t="jspaths"){const o="fonts"===t?d:c;yield Promise.all(e.map((e=>o(e))))})),h=e=>a(void 0,void 0,void 0,(function*(){e.fonts&&e.fonts.length&&(yield u(e.fonts,"fonts"))})),p=e=>a(void 0,[e],void 0,(function*({jspaths:e=[],csspaths:o=[],fonts:r=[]}){const i=t.uniqBy(r,"fontName");yield Promise.all([u(e,"jspaths"),u(o,"csspaths"),u(i,"fonts")])})),m=()=>{var e;(null==(e=document.getElementById("__custom_font__"))?void 0:e.parentNode)&&e.parentNode.removeChild(e),Array.from(document.getElementsByTagName("script")).filter((e=>"jspaths"==e.className)).forEach((e=>{!function(e){for(var t,o=Array.from(document.getElementsByTagName("script")),r=0;r<o.length;r++)o[r]&&o[r].src&&-1!=o[r].src.indexOf(e)&&(null===(t=o[r])||void 0===t?void 0:t.parentNode)&&o[r].parentNode.removeChild(o[r])}(e.src)})),Array.from(document.getElementsByTagName("link")).filter((e=>"csspaths"==e.className)).forEach((e=>{!function(e){for(var t,o=Array.from(document.getElementsByTagName("link")),r=0;r<o.length;r++)o[r].href,o[r]&&o[r].href&&-1!=o[r].href.indexOf(e)&&(null===(t=o[r])||void 0===t?void 0:t.parentNode)&&o[r].parentNode.removeChild(o[r])}(e.href)}))};const f=(e,t,o)=>{const r=document.createElement("link");switch(r.rel="preload",r.href=e,r.crossorigin="anonymous",t){case"video":r.as="video";break;case"script":r.as="script";break;case"image":r.as="image"}r.onload=()=>{console.log(`success to preload ${e}`),o&&o()},r.onerror=()=>{console.error(`Failed to preload ${e}`)},document.head.appendChild(r)},g=(e,t)=>{try{let o=t||window.location.href;if(-1!=o.indexOf("?")){let t={};return o.slice(o.indexOf("?")+1).split("&").forEach((e=>{let o=e.split("=");t[o[0]]=o[1]})),e?t[e]?t[e]:null:t}return console.log("没有参数"),null}catch(e){console.error(e)}};function v(e,t=!1){try{return t?y(e)?e:JSON.stringify(e):y(e)?JSON.parse(e):e}catch(t){return console.log("转化JSON 发生错我!",e),e}}const y=e=>{if("string"==typeof e)try{const t=JSON.parse(e);return"object"==typeof t&&null!==t}catch(e){return!1}return!1},b=(e,t)=>{try{const o=JSON.stringify(t);sessionStorage.setItem(e,o)}catch(t){console.error(`Error setting session data for key ${e}:`,t)}},w=e=>{const t=sessionStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.error(`Error parsing session data for key ${e}:`,t)}return null},D=e=>{for(const t of e)t.code&&(t.code=t.code.replace(/&gt;/g,">").replace(/&lt;/g,"<"))},N=(e,t)=>{e instanceof Map?e.forEach((e=>{t([e])})):Array.isArray(e)&&e.forEach((e=>{t(e.children)}))},k=(e,t)=>{const o=e=>{var r,i,a;if(e)for(const n of e){const e=null===(a=null===(i=null===(r=null==n?void 0:n.tmpData)||void 0===r?void 0:r.source)||void 0===i?void 0:i.converse)||void 0===a?void 0:a.data;(null==e?void 0:e.length)&&D(e),t(n),n.children?o(n.children):n.dynamicChildren?N(n.dynamicChildren,o):n.stateChildren&&o(n.stateChildren)}};o(e)},S=(e,t,o,r)=>{const i=e.match(/({{[\w]*}})|((@)[\w]*)/gm);if(i){const e=i.map((e=>e.replace(/{{|}}|@/gm,"")));for(const i of e)if(i&&t&&!(t.findIndex((e=>e.mapField===i))<0))return o&&r&&x(r,i,o.cid),!0}return!1},x=(e,t,o)=>{if(!e)throw new Error("Share variable tree is not defined");if("string"!=typeof t)throw new Error("Variable name should be a string");if(!o)throw new Error("ID is required");Array.isArray(e[t])||(e[t]=[]),e[t].includes(o)||e[t].push(o)},C=(e,t,o)=>{var r;let i=!1;const a=null==t?void 0:t.converse;if(a&&a.use&&a.data.length)for(const t of a.data)if((null==t?void 0:t.dependVars)&&t.dependVars.includes(e))return!0;const n=null==t?void 0:t[null==t?void 0:t.type];return((null==n?void 0:n.inputSql)||(null==n?void 0:n.url)||(null==n?void 0:n.headers)||(null==n?void 0:n.params))&&(i=S(n.inputSql||n.url||(null===(r=n.headers)||void 0===r?void 0:r.value)||n.params,o)),i},A=(e,o,r=!1)=>{let i=null;const a=e=>{for(const n of e){if(n.cid===o){i=n,r&&t.remove(e,(e=>e.cid===o));break}if(n.children&&a(n.children),n.dynamicChildren&&Array.isArray(n.dynamicChildren))for(const[,e]of Array.from(n.dynamicChildren))a(e);n.stateChildren&&a(n.stateChildren)}};return a(e),i},O=(e,o,r)=>{let i=!1;const a=e=>{for(let n=0;n<e.length;n++){if(e[n].cid==o){i=e[n],r&&t.remove(e,(e=>e.cid==o));break}if(e[n].children)a(e[n].children);else if(e[n].dynamicChildren){if(e[n].dynamicChildren instanceof Map){let t=Array.from(e[n].dynamicChildren);for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let o=t[e][1];a(o)}}else if(e[n].dynamicChildren instanceof Array){let t=e[n].dynamicChildren;for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let o=t[e][1];a(o)}}}else e[n].stateChildren&&a(e[n].stateChildren)}};return a(e),i||!1};function I(e,t,o){const r={};o&&o.forEach((e=>{(null==e?void 0:e.name)&&(r[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(t,r)}catch(e){return console.error(e),t}}function T(e,o,r){let i=t.cloneDeep(o);const a={};r&&r.forEach((e=>{(null==e?void 0:e.name)&&(a[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(i,a)}catch(e){return console.error(e),i}}const V=e=>{let t=window.goFetchList;return t||(window.goFetchList={},t=window.goFetchList),t[e]?!t[e]&&void 0:(t[e]={id:e,time:(new Date).getTime()},!0)},F=e=>{let t=window.goFetchList;t&&t[e]&&delete t[e]};function E(e){const t=e.match(/\.([^\/\\]+)$/);return t?t[1].toLowerCase():void 0}const j=e=>{const t=[];let o=function(e){return e.endsWith("/")?e.slice(0,-1):e}(window.baseUrl);return k(e,(e=>{var r,i,a,n,s,l,d,c,u;if("AnDeckHeader3"==e.viewComName&&(null===(a=null===(i=null===(r=null==e?void 0:e.tmpData)||void 0===r?void 0:r.option)||void 0===i?void 0:i.bgImage)||void 0===a?void 0:a.path)){let r=E(e.tmpData.option.bgImage.path);t.push({type:r,url:o+e.tmpData.option.bgImage.path})}if("AnVideoNormal"==e.viewComName&&(null===(s=null===(n=null==e?void 0:e.tmpData)||void 0===n?void 0:n.option)||void 0===s?void 0:s.dynamicUrl)){let r=E(null===(d=null===(l=null==e?void 0:e.tmpData)||void 0===l?void 0:l.option)||void 0===d?void 0:d.dynamicUrl);t.push({type:r,url:o+(null===(u=null===(c=null==e?void 0:e.tmpData)||void 0===c?void 0:c.option)||void 0===u?void 0:u.dynamicUrl)})}})),t},P="anov@2019:helloX",$="anov@2020:helloX";function R(e){let t=r.enc.Utf8.parse(P),o=r.enc.Utf8.parse($);return r.AES.encrypt(e,t,{iv:o,mode:r.mode.CBC,padding:r.pad.Pkcs7}).toString()}function M(e,t){if(0===e.length)throw new Error("Array is empty.");if(!t)return e[Math.floor(Math.random()*e.length)];if(t.length!==e.length)throw new Error("Length of probabilities array must match length of array.");const o=t.reduce(((e,t)=>e+t),0),r=Math.random()*o;let i=0;for(let o=0;o<e.length;o++)if(i+=t[o],r<i)return e[o];return e[0]}const U=new Blob(["\nfunction proxyObj(originObj) {\n const exposeObj = new Proxy(originObj, {\n has: (target, key) => {\n if (['fetch', 'XMLHttpRequest', 'postMessage'].indexOf(key) >= 0) {\n throw new Error('Illegal operation for key'+key)\n } else {\n return target[key]\n }\n },\n })\n return exposeObj\n}\nfunction compileCode(src) {\n src = 'with (exposeObj) {'+src+'}'\n //console.log(src)\n return new Function('exposeObj', src)\n}\nfunction run(code) {\n let proxy = proxyObj({})\n let result = compileCode(code)(proxy)\n return result\n}\n\nonmessage = (e) => {\n try {\n let result = run(e.data.code)\n postMessage({\n code: 1,\n result,\n })\n } catch (err) {\n postMessage({\n code: -1,\n err,\n })\n }\n}\n"]),B=URL.createObjectURL(U);function q(e,t){return a(this,arguments,void 0,(function*(e,t,o={},r="worker"){try{if("window"==r){let[r,i]=[["data"],[t]];"object"==typeof o&&Object.keys(o).forEach((e=>{r.push(e),i.push(o[e])}));const a=new Function(...r,e);return{success:!0,data:a(...i)}}{let[r,i,n]=[t,o,""];"object"==typeof r&&(r=JSON.stringify(t)),"object"==typeof o&&(i=JSON.stringify(o)),Object.keys(o).forEach((e=>n+=`${e},`));let s=`let data=eval(${r}); \n             let app=${JSON.stringify({})};`;s+=n?`let {${n}} = eval(${i}); `:"",s+=`${e}`;let l=yield function(e){return a(this,arguments,void 0,(function*(e,t=5e3){let o=new Worker(B);return new Promise(((r,i)=>{const a=()=>{clearTimeout(s),o.removeEventListener("message",n),o.terminate(),o=null},n=e=>{let{code:t,result:o,err:n}=e.data;a(),1===t?r(o):i(n)};o.postMessage({code:e}),o.addEventListener("message",n);let s=setTimeout((()=>{a(),i("timeout")}),t)}))}))}(s);return{success:!0,data:l}}}catch(e){return{success:!1,error:e,data:t}}}))}var L,H,z,G;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(L||(L={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(H||(H={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(z||(z={}));class J{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return J.instance||(J.instance=new J(e)),J.instance}init(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const o=indexedDB.open(this.dbName,1);o.onerror=e=>{t(e.target.error)},o.onupgradeneeded=e=>{this.db=e.target.result,this.db.objectStoreNames.contains(this.tableName)||this.db.createObjectStore(this.tableName,{keyPath:this.keyPath})},o.onsuccess=t=>{this.db=t.target.result,e()}}))}))}addRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).add(e);r.onsuccess=()=>{t()},r.onerror=e=>{o(e.target.error)}}))}))}deleteRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);r.onsuccess=()=>{t()},r.onerror=e=>{o(e.target.error)}}))}))}updateRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(e);r.onsuccess=()=>{t()},r.onerror=e=>{o(e.target.error)}}))}))}getRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);r.onsuccess=()=>{t(r.result)},r.onerror=e=>{o(e.target.error)}}))}))}getAllRecords(){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((e,t)=>{const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAll();o.onsuccess=()=>{e(o.result)},o.onerror=e=>{t(e.target.error)}}))}))}}J.instance=null,function(e){e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE"}(G||(G={}));const _={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class W{constructor(){this.logLevel=G.INFO,this.indexedDBInstance=J.getInstance(_);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return W.instance||(W.instance=new W),W.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case G.FATAL:return"";case G.ERROR:return"";case G.WARN:return"";case G.INFO:return"";case G.DEBUG:return"";case G.TRACE:return"";default:return""}}log(e,t){if(t<=this.logLevel){const o=(new Date).toISOString(),r=`[${o}] [${G[t]}]`,i=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${i}${r} ${e}`);else{let t=w("anov-go-userInfo"),a=w("anov-go-proid"),n=` [操作人:${null==t?void 0:t.userName} 项目ID:${a}] `;const s={time:o,value:`${e}`};try{this.indexedDBInstance.addRecord(s)}catch(e){console.error("添加记录时出错:",e)}console.log(`${i}${r} ${n} ${e}`)}}}fatal(e){this.log(e,G.FATAL)}error(e){this.log(e,G.ERROR)}warn(e){this.log(e,G.WARN)}info(e){this.log(e,G.INFO)}debug(e){this.log(e,G.DEBUG)}trace(e){this.log(e,G.TRACE)}}const X=W.getInstance(),K=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):l(e,t),Q=l();let Y=l();function Z(e){return a(this,arguments,void 0,(function*(e,o="get",r={},i={},n){try{const l={method:z[o],url:e,headers:i,timeout:s};["post","put"].includes(o.toLowerCase())?l.data=t.cloneDeep(r):l.params=t.cloneDeep(r),n&&(l.headers.sponsor=n);return/.json$/.test(e)?function(e){return a(this,void 0,void 0,(function*(){try{return yield Q({method:"get",url:e})}catch(e){throw console.error("JSON 数据请求:",e),e}}))}(e):function(e){return a(this,void 0,void 0,(function*(){try{return{code:2e4,data:(yield Q(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(l)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function ee(e,t,o,r,i){return a(this,void 0,void 0,(function*(){try{const a=window.anUrl||"",n=a+(window.agentPath||"/ds/v1/api-proxy/v1/query"),s=v(o,!0);return yield Q({url:n,method:"post",headers:{"Content-Type":"application/json;charset=UTF-8",sponsor:i||""},data:{body:"post"===e?s:void 0,headers:y(r)?v(r,!0):r,method:e,url:t}})}catch(e){throw console.error("代理请求数据:Error12:",e),e}}))}function te(e,t,o,r,i,n){return a(this,void 0,void 0,(function*(){return i?ee(t,e,o,r,n):Z(e,t,o,r,n)}))}function oe(e,t="",o){var r,i,a,s;const l=`${null!==(i=null===(r=null===window||void 0===window?void 0:window.BaseUrl)||void 0===r?void 0:r.replace("/management",""))&&void 0!==i?i:""}/ds/data-engine/v1/${e}/zb-query?${`token=${(null===(a=me("YZH_EXCHANGE_TOKEN"))||void 0===a?void 0:a.YZH_EXCHANGE_TOKEN)||(null===(s=null===window||void 0===window?void 0:window.yzhAuth)||void 0===s?void 0:s.getToken())}&passid=${null===window||void 0===window?void 0:window.gdPassid}`}${(null===window||void 0===window?void 0:window.BASE_RELEASE)?"&preview=1":""}`;let d={};try{d=t?JSON.parse(t):{}}catch(e){d=t||{}}return Q({method:"POST",url:l,data:{headers:o,param:d},timeout:n})}function re(e="",t){const o=`${null===window||void 0===window?void 0:window.BaseUrl}/ds/v1/data-views/query`;let r={};try{r=e?JSON.parse(e):{}}catch(t){r=e||{}}return Q({method:"POST",url:o,data:{headers:t,param:r},timeout:n})}const ie=(e,t)=>a(void 0,void 0,void 0,(function*(){const o=window.BaseUrl,{dateType:r="",endPeriod:i="",metricsName:a=e,startPeriod:s=""}=t;return Y({method:"GET",url:`${o}ds/v1/metrics/v1/data-alarm?dateType=${r}&endPeriod=${i}&metricsName=${a}&startPeriod=${s}`,timeout:n})})),ae=(e,t,o)=>a(void 0,void 0,void 0,(function*(){var r;const i=(null===(r=window.BaseUrl)||void 0===r?void 0:r.replace("/management",""))||"";t.newEncryption=!0;const a={staticFile:{method:"get",params:t,url:`${i}/ds/v1/file/v1/${e}/query`},datasource:{method:"post",url:`${i}/ds/v1/database/v1/${e}/query`,data:Object.assign({},t)}}[o];if(!a)throw new Error("Invalid data type provided");return Q(Object.assign({timeout:n},a))})),ne=e=>new Promise(((t,o)=>{let r;r=e.originData&&Object.keys(e.originData).length?e.originData:e.data,void 0!==r?t({data:r}):o("Failed to retrieve cdata")})),se=(e,t,o)=>{try{let r;switch(t){case"api":{let t=ve(e,o);return{requestType:t.requestType,url:t.url,params:t.params,headers:t.headers,agency:t.agency}}case"static":return{data:e};case"datasource":{const t=ge(e.inputSql,o);return{dsName:e.dsName,dsType:"1",sql:R(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return r=ye(e,o),{zbId:e.zbId,params:ge(r.params,o),headers:ge(r.headers,o)};case"dataSet":return{params:ge(e.params,o),headers:ge(e.headers,o)};case"indicatorCQ":return{zbName:e.zbName,params:ge(e.params,o)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},le=(e,t,o)=>a(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield te(e.url,e.requestType,e.params,e.headers,e.agency,o);case"static":return yield ne(e.data);case"datasource":return yield ae(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield ae(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield oe(e.zbId,e.params,e.headers);case"dataSet":return yield re(e.params,e.headers);case"indicatorCQ":return yield ie(e.zbName,e.params);case"packData":return{};default:throw new Error("Invalid type")}}catch(e){return console.warn(e,"执行请求并获取数据发生错误"),yield new Promise(((e,t)=>{e({error:!0})}))}})),de=(e,t,o,...r)=>a(void 0,[e,t,o,...r],void 0,(function*(e,t,o,r=[],i=!1){const a=t||e.tmpData.source.dataType;if(!a)return console.warn(`fetdata error on fetchDataByType', dataType is ${a}`),new Promise(((e,t)=>{e({error:!0,data:null,msg:`dataType is ${a}`})}));const n=e.tmpData.source["indicatorCQ"==a?"indicator":a];if("globalData"===a){const e=r.find((e=>e.key===n.id||e.key===n.key)),t=w(n.id);if(t&&!i)return t.data;if(e){let t=yield ce(e,o),r={key:n.id,data:t};return b(n.id,r),t}return}const s=se(n,a,o),l=yield le(s,a,e.cid?e.cid:"");return(null==l?void 0:l.data)?l.data:l})),ce=(e,t)=>a(void 0,void 0,void 0,(function*(){let o=Object.assign({},{tmpData:{source:e.value}});const r=o.tmpData.source.type,i=o.tmpData.source[r],a=se(i,r,t),n=yield le(a,r);return yield ue(n.data,o,!0,t)})),ue=(e,o,...r)=>a(void 0,[e,o,...r],void 0,(function*(e,o,r=!0,i){try{const{converse:n,mapFields:s}=o.tmpData.source;return n&&n.use&&r?yield new Promise(((o,r)=>{const s=function(e,o,r,i,n){return a(this,void 0,void 0,(function*(){let r,a=e,{use:n,data:s}=t.cloneDeep(o);if(n)for(let e=0;e<s.length;e++)if(s[e].use){let o=s[e].dependVars,n={};i&&n&&o&&o.length&&o.map((e=>{let o=t.cloneDeep(i).filter((t=>{let o=t.mapField==e;return o&&(n[e]=t.value),o}));o&&0!=o.length||(n[e]="")})),r=yield q(s[e].code,a,n,s[e].mode?s[e].mode:"worker"),a=r.data}return a}))}(t.cloneDeep(e),n,0,i);o(s)})):yield new Promise(((t,o)=>{t(e)}))}catch(t){return console.error("执行过滤器发生错误:"+t),yield new Promise(((t,o)=>{t(e)}))}})),he=(e,t,o)=>{const{source:r}=e.tmpData,i=r.type;o?("static"===i&&r[i]&&(r[i].originData=o),"indicatorCQ"===i?r.indicator.data=t:r[i].data=t):"indicatorCQ"===i?r.indicator.data=t:r[i].data=t,e.source=t},pe=(e,t,...o)=>a(void 0,[e,t,...o],void 0,(function*(e,t,o=[],r,i,a){try{let n=e.tmpData.source.type,s=yield de(e,n,o,r,a||!1);if(null==s||!s)return i&&i({error:!0}),Promise.resolve({error:!0});let l=yield ue(s,e,t,o);return he(e,l),i&&i(l),(null==e?void 0:e.cid)&&F(e.cid),Promise.resolve(l)}catch(t){return i&&i(t),X.error("Error in updateComData"),console.error("Error in updateComData:",t,e),Promise.reject(t)}})),me=e=>{const t={};if(e&&e.includes("?")){const o=e.split("?")[1].split("&");for(let e of o){const[o,r]=e.split("=").map(decodeURIComponent);t[o]=r}}return t},fe=e=>{try{return(null==e?void 0:e.value)&&"string"==typeof e.value?JSON.parse(e.value):"string"==typeof e?JSON.parse(e):e}catch(t){return e}},ge=(e,t)=>{if(!t)return fe(e);if("string"==typeof e){if(""===e.trim())return"";try{if("string"!=typeof JSON.parse(e))return"number"==typeof JSON.parse(e)?e:ge(JSON.parse(e),t);{let o=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,r)=>{const i=o||r,a=t.find((e=>e.mapField===i));return a?a.value||a.originalValue||"":e}));return fe(o)}}catch(o){let r=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,r)=>{const i=o||r,a=t.find((e=>e.mapField===i));return a?a.value:e}));return fe(r)}}else{if(Array.isArray(e))return e.map((e=>ge(e,t)));if("object"==typeof e&&null!==e){const o={};for(let r in e)o[r]=ge(e[r],t);return fe(o)}}return fe(e)},ve=(e,t)=>{const o=e.agency,r=e,{url:i=null,headers:a,params:n,requestType:s}=r,l=i?ge(i,t):void 0,d=a&&a.use?ge(a.value,t):{};return{url:l,requestType:s,params:n?ge(n,t):{},headers:d,agency:o}},ye=(e,t)=>{const{headers:o,params:r}=e,i=o&&o.use?ge(o.value,t):{};return{params:r?ge(r,t):{},headers:i}},be=(e,t,o,r,i)=>a(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const a of e){C(t,a.value,o)&&(yield pe({tmpData:{source:{type:"globalData",globalData:{id:a.key}}}},!0,o,e,(e=>{console.log("数据更新成功-变量改变全局数据跟新")}),!0),k(r,(t=>{var r,n,s;if("globalData"===(null===(n=null===(r=null==t?void 0:t.tmpData)||void 0===r?void 0:r.source)||void 0===n?void 0:n.type)){(null===(s=null==t?void 0:t.tmpData)||void 0===s?void 0:s.source.globalData).id===a.key&&pe(t,!0,o,e,(e=>{i(t,e)}),!1)}})))}})),we=(e,t,o,r,i)=>a(void 0,void 0,void 0,(function*(){e&&(yield pe({tmpData:{source:{type:"globalData",globalData:{id:e.key}}}},!0,t,o,(e=>{console.log("数据更新成功")}),!0),k(r,(r=>{var a,n,s;if("globalData"===(null===(n=null===(a=null==r?void 0:r.tmpData)||void 0===a?void 0:a.source)||void 0===n?void 0:n.type)){(null===(s=null==r?void 0:r.tmpData)||void 0===s?void 0:s.source.globalData).id===e.key&&pe(r,!0,t,o,(e=>{i(r,e)}),!1)}})))}));class De{constructor(e,t){this.isUpdating=!1,this.des=e.des,this.field=e.field,this.id=e.id,this.key=e.key,this.mapping=e.mapping,this.mapField=e.mapField,this.type=e.type,this.originalValue=e.originalValue,this.model=(null==e?void 0:e.model)||0==(null==e?void 0:e.model)?null==e?void 0:e.model:1,this.converter=e.converter,this.converterCode=e.converterCode,this.fork=e.fork,this.delayUpdate=!!(null==e?void 0:e.delayUpdate),t&&(this.globalVariables=t),e.fork&&(this.model=5,this.forkValue=e.forkValue,this.originalValue=this.getForkedValue())}get value(){if(this.fork&&(this.originalValue=this.getForkedValue()),this.converter&&this.converterCode){let e=[];return T(this.converterCode,this.originalValue,e)}return this.originalValue}togglePropertyState(e){let t=Object.prototype.hasOwnProperty.call(this,e);this[e]=!t||!e}getForkedValue(){if(this.forkValue&&Array.isArray(this.forkValue))return this.forkValue.map((e=>{const t=this.globalVariables.get(e);return t?t.value:null}));if(this.forkValue){const e=this.globalVariables.get(this.forkValue);return e?e.value:null}return null}updateValue(e,t){var r;const i=Object.assign({},this,e);this.des=i.des,this.field=i.field,this.mapping=i.mapping,this.type=i.type,this.originalValue=i.originalValue,this.converter=i.converter,this.converterCode=i.converterCode,this.fork=i.fork,this.delayUpdate=null==i?void 0:i.delayUpdate,this.model=null==i?void 0:i.model,e.id&&(this.id?"string"==typeof this.id?e.id instanceof Array?this.id=o([this.id,...e.id]):this.id=[this.id,e.id]:this.id instanceof Array&&(e.id instanceof Array?this.id=o([...this.id,...e.id]):this.id=o([...this.id,e.id])):this.id=e.id),e.fork&&(this.model=5,this.forkValue=null!==(r=e.forkValue)&&void 0!==r?r:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}updateWidthOriginalValue(e,t){var o;this.originalValue=e,this.fork&&(this.forkValue=null!==(o=this.forkValue)&&void 0!==o?o:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}renew(e){e&&e(this)}static create(e,t){return new De(e,t)}}class Ne{constructor(){this.variables=new Map,this.globalObservers=[],this.url=window.location.search,this.list=[]}clearVars(){this.list=[],this.variables.clear()}togglePropertyState(e,t,o){try{let r=this.getVariable(e);if(!r)throw new Error("没有找到相应的变量!");r.togglePropertyState(t),this.addToObjectArray(this.list,r),o&&o()}catch(e){console.error(e)}}static getInstance(){return Ne.instance||(Ne.instance=new Ne),Ne.instance}getFullUrl(){this.url=window.location.search}getAllUrlParams(){const e=new URLSearchParams(window.location.search),t={};for(const[o,r]of e.entries())t[o]=r;return t}delVariable(e,t){this.variables.delete(e),this.list=this.list.filter((t=>t.mapField!=e)),t&&t()}addUrlParamsToGlobalVars(){this.getFullUrl();let e=this.getAllUrlParams(),t=Object.keys(e),o=[];for(const r of t)o.push({mapField:r,originalValue:e[r],model:4});if(o.length)for(const e of o)this.addVariable(e)}addVariables(e,t){if(Array.isArray(e)?e.map(((e,t)=>{this.addVariable(e)})):this.addVariable(e),t&&"coms"==t)for(let t of this.variables.values())0==t.model&&(e.some((e=>e.mapField==t.mapField))||this.delVariable(t.mapField));this.addUrlParamsToGlobalVars()}addVariable(e,t){if(!e||!(null==e?void 0:e.mapField))return console.error(e+"参数不合法!"),!1;if(this.isVariableNameExist(e.mapField)){let o=this.getVariable(e.mapField);return this.sameValue(o,e)?o:(this.editVariable(e,t),!1)}const o=De.create(e,this.variables);return this.variables.set(o.mapField,o),this.addToObjectArray(this.list,o),t&&t(o),this.notifyGlobalObservers(o),o}toJSON(e){try{return!!e&&JSON.stringify(e)}catch(e){return!1}}sameValue(e,t){if(e.mapfield!==t.mapfield)return!1;for(const o in t)if(!(["mapfield","field","key","value","name","globalVariables"].includes(o)||o in e&&e[o]==t[o]))return!1;return!0}creatVarJson(e){const{des:t,field:o,id:r,key:i,mapping:a,mapField:n,type:s,value:l,originalValue:d,model:c,converter:u,converterCode:h,fork:p,forkValue:m,update:f,delayUpdate:g}=e,v={};return void 0!==t&&(v.des=t),void 0!==o&&(v.field=o),void 0!==r&&(v.id=r),void 0!==i&&(v.key=i),void 0!==a&&(v.mapping=a),void 0!==n&&(v.mapField=n),void 0!==s&&(v.type=s),void 0!==l&&(v.value=l),void 0!==d&&(v.originalValue=d),void 0!==c&&(v.model=c),void 0!==u&&(v.converter=u),void 0!==h&&(v.converterCode=h),void 0!==p&&(v.fork=p),void 0!==m&&(v.forkValue=m),void 0!==f&&(v.update=f),void 0!==g&&(v.delayUpdate=g),v}addToObjectArray(e,t){let o=!1;for(let r=0;r<e.length;r++)if(e[r].mapField==t.mapField){e[r]=this.creatVarJson(t),o=!0;break}o||e.push(t)}editVariable(e,t){const o=this.getVariable(e.mapField);if(o&&this.isVariableNameExist(e.mapField)){if(this.sameValue(o,e))return}const r=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),t&&t(e),e.isUpdating=!1}};o?o.updateValue(e,r):this.addVariable(e,r)}getForkList(e){let t=this.isMapFieldInForkValues(e);return t||[]}editVariableForValue(e,t,o){const r=this.getVariable(e),i=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),o&&o(e),e.isUpdating=!1}};r&&r.updateWidthOriginalValue(t,i)}isMapFieldInForkValues(e){return this.getAllVariables().filter((e=>e.fork&&e.forkValue)).filter((t=>t.forkValue==e||Array.from(t.forkValue).includes(e)))}isVariableNameExist(e){return this.variables.has(e)}checkExist(e,t){if("string"==typeof e&&this.isVariableNameExist(e)){let o=this.getVariable(e);return t==o.id&&!o.id.includes(t)&&[{key:e}]}if(Array.isArray(e)){const o=e.filter((e=>{let o=this.getVariable(e);return this.isVariableNameExist(e)&&t!=o.id&&!(o.id&&o.id.includes(t))})).map((e=>({key:e})));return!!o.length&&o}return!1}getVariable(e){return this.variables.get(e)}getVariableForId(e){var o;let r=[];for(const[,t]of this.variables)(t.id===e||(null===(o=t.id)||void 0===o?void 0:o.includes(e)))&&r.push(t);return t.uniq(r)}getAllVariables(e=!1){return this.addUrlParamsToGlobalVars(),e?(this.list=Array.from(this.variables.values()),this.list):[...this.list]}restoreVariables(e){e.forEach((e=>{this.addVariable(e)}))}registerGlobalObserver(e){this.globalObservers.push(e)}notifyGlobalObservers(e){this.globalObservers.forEach((t=>{t.update(e)}))}}Ne.instance=null;const ke=Ne.getInstance(),Se=(e,t)=>Array.isArray(t)?t.some((t=>e&&(void 0!==e[t]||e.hasOwnProperty(t)))):"string"==typeof t&&(e&&(void 0!==e[t]||e.hasOwnProperty(t))),xe=(e,t,o,r)=>{const i=((e,t,o,r)=>{var i;let a;if(Se(e,null==t?void 0:t.field)||Se(e,null==t?void 0:t.forkValue))a=e[null==t?void 0:t.field]||0==e[null==t?void 0:t.field]?e[null==t?void 0:t.field]:"";else if(Se(e.data,null==t?void 0:t.field)||Se(e.data,null==t?void 0:t.forkValue))a=e.data[null==t?void 0:t.field]||0==e.data[null==t?void 0:t.field]?e.data[null==t?void 0:t.field]:"";else{const e=A(o,r),n=(null===(i=null==e?void 0:e.tmpData)||void 0===i?void 0:i.actions)||[];for(const e of n){const o=e.vars.find((e=>(null==e?void 0:e.mapField)===(null==t?void 0:t.mapField)));if(o){a=o.value;break}}}return a})(e,t,o,r);return void 0!==i?i:t.value},Ce=(e,t,o,r,i,a,n,s,l)=>{var d;switch(e.type){case"link":let c=ge(e.link,a);window.open(c,e.target);break;case"page":if(null===(d=null==e?void 0:e.params)||void 0===d?void 0:d.length)for(let t=0;t<e.params.length;t++){const o=e.params[t],r=a.find((e=>e.mapField==o.mapField));r&&(o.value=r.value)}l&&l(e);break;case"dynamic":((e,t,o,r,i)=>{const a=e.dynamic||[];for(const n of a){if(e.id!==t.cid)continue;const a=A(o,n.pid);a&&(a.activeDynamic=n.name,a.isShow=n.visible||!r||e.index===t.index-1,i({cid:a.cid,flag:n.visible}))}})(e,t,o,r,i);break;case"toggle":((e,t,o,r,i)=>{const a=e.children||[];for(const o of a){const a=o.visible&&(!r||e.index===t.index-1);i({cid:o.cid,flag:a})}})(e,t,0,r,i);break;case"update":((e,t,o,r,i)=>{const a=e.children||[];for(const e of a){const a=A(t,e.cid);a&&pe(a,!0,o,r,(e=>{i({cid:a.cid,data:e})}))}})(e,o,a,n,s)}},Ae=(e,o,r,i,a,n,s,l,d,c)=>{const{cid:u,actions:h,index:p}=a,{eventName:m,mode:f}=h,g=2===f;((e,o,r,i,a,n)=>{let s=ke.getVariableForId(o.cid);if(null==s?void 0:s.length)for(const l of s)if(l.type==e){let e=xe(o,l,r,i);ke.editVariableForValue(l.mapField,e,(()=>{let e=a[l.mapField]||[],o=ke.getForkList(l.mapField);if(o)for(const r of o){let o=a[r.mapField];e=t.concat(e,o)}n&&n(l,t.uniq(e))}))}})(m,a,i,u,r,((e,t)=>{if(be(d,e.mapFile,ke.getAllVariables(),i,((e,t)=>{s({cid:e.cid,data:t})})),null==t?void 0:t.length)for(const o of t){e.eventSourceId=o;const t=A(i,o);!(null==e?void 0:e.delayUpdate)&&t&&pe(t,!0,ke.getAllVariables(),d,(e=>{s({cid:t.cid,data:e})}))}}));const v=((e,t,o,r,i)=>e.filter((e=>e.id===t&&e.eventType===o&&(!i||parseInt(e.index||"0")+1===parseInt(r||"0")))))(e,u,m,p,g);for(const e of v)Ce(e,a,i,g,n,ke.getAllVariables(),d,s,l)};function Oe(e,t){const o={};for(const r in e)if(e.hasOwnProperty(r))if("object"!=typeof e[r]||null===e[r]||Array.isArray(e[r]))Array.isArray(e[r])?JSON.stringify(e[r])!==JSON.stringify(t[r])&&(o[r]=t[r]):e[r]!==t[r]&&(o[r]=t[r]);else{const i=Oe(e[r],t[r]);null!==i&&Object.keys(i).length>0&&(o[r]=i)}return Object.keys(o).length>0?o:null}function Ie(e,t){const o=Object.assign({},e);for(const e in t)t.hasOwnProperty(e)&&("object"!=typeof t[e]||null===t[e]||Array.isArray(t[e])?o[e]=t[e]:o[e]=Ie(o[e],t[e]));return o}const Te=(e,t={})=>{let o={},r={type:"static",converse:{use:!1,data:[]},static:{data:e},api:{requestType:"get",url:"",headers:{use:!1,value:""},params:"",agency:!1,cookie:!0,autoUpdate:{open:!1,time:10},data:""}};return Object.assign(o,r,t),o},Ve=(e,o)=>{let{option:r,actions:i,data:a,optionDes:n,actionsDes:s,source:l,theme:d}=((e,o)=>{let{option:r,actions:i,data:a,optionDes:n,actionsDes:s,source:l,theme:d}=t.cloneDeep(o[e]);return{option:r,actions:i,data:a,optionDes:n,actionsDes:s,source:l,theme:d}})(e,o);return{iconClass:null,isAssembly:null,source:a,cid:(Math.random().toString().substr(3,10)+Date.now()).toString(),isLock:!1,isShow:!0,tmpData:{option:r,source:Te(a,l),actions:i},baseData:Ee(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},Fe=(e,o,r)=>{let i=Ve(e,o);return r?t.merge(i,r):i},Ee=e=>{let t={left:0,top:0,width:100,height:100,angle:0,penetrate:0,opacity:100,perspective:100,rotateX:0,rotateY:0,rotateZ:0,transformOriginX:"center",transformOriginY:"center",transformSwitch:!1};return e?Object.assign(t,e):t};class je{constructor(e,t,o){this.theme=null,this.plant=null,this.list=[],this.titleHeqadeHeight=70,this.clearance=3,this.checkComponentIntersection=(e,t,o=10)=>{const r=e.left,i=e.left+e.width,a=e.top,n=e.top+e.height,s=t.left,l=t.left+t.width,d=t.top,c=t.top+t.height,u=r<l&&i>s&&a<c&&n>d,h=Math.abs(e.left+e.width/2-(t.left+t.width/2)),p=Math.abs(e.top+e.height/2-(t.top+t.height/2));return u||h<o&&p<o},this.calculateCombinedComponent=e=>{if(0===e.length)return{left:0,top:0,width:0,height:0};let t=e[0].left,o=e[0].top,r=e[0].left+e[0].width,i=e[0].top+e[0].height;for(let a=1;a<e.length;a++){const n=e[a];t=Math.min(t,n.left),o=Math.min(o,n.top),r=Math.max(r,n.left+n.width),i=Math.max(i,n.top+n.height)}return{left:t,top:o,width:r-t,height:i-o}},this.getAnTextNormaltText=e=>{var t,o;try{return null===(o=null===(t=null==e?void 0:e.tmpData)||void 0===t?void 0:t.option)||void 0===o?void 0:o.text}catch(e){return console.error("配置优化(ConfigOptimizer):",e),""}},this.initProp(e),this.upgradePlant(),this.staticComponentData=t,this.upgradeHeaderComponent(),o&&Object.assign(this,o)}isStringOrObject(e){return"string"==typeof e?"string":"object"==typeof e&&null!==e&&"object"}initProp(e){try{let t,o=this.isStringOrObject(e);if(o&&"string"===o)t=JSON.parse(e);else{if(!o||"object"!==o)throw new Error(`initProp fn error :-- 传入参数${e}不合法!`);t=e}if(t){this.originData=t;const{theme:e,plant:o,list:r}=t;this.theme=e,this.plant=o,this.list=r,this.filterFileGroup()}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradePlant(){this.plant&&(this.plant.option.bg={type:1,code:"70942ec525344c96aa32b81b2c9155f6",path:"/anov-prod/resources/page/png/bg22 科技星球背景.png",thumb:"/anov-prod/resources/page/thumbnail/1e48f8fb26ec4edfb1a0f499627e84fc.png"})}areComponentsIntersecting(e,t){let o=e.baseData,r=t.baseData;const i=Math.max(0,Math.min(o.left+o.width,r.left+r.width)-Math.max(o.left,r.left)),a=Math.max(0,Math.min(o.top+o.height,r.top+r.height)-Math.max(o.top,r.top));return i>0&&a>0}filterFileGroup(){this.list=t.cloneDeep(this.list).map((e=>{var t,o;if(1===(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)&&!(null===(o=null==e?void 0:e.children[0])||void 0===o?void 0:o.children)){const t=e.children[0],{left:o,top:r}=e.baseData;return t.baseData.left=o,t.baseData.top=r,t}return e}))}getText(e,t,o){const r=document.createElement("canvas").getContext("2d");if(!r)throw new Error("Failed to get 2D context from canvas.");r.font=`${o}px ${t}`;return r.measureText(e).width}calculateMaxWidths(e){const t=Math.min(...e.map((e=>e.width))),o=[];let r=[],i=e[0].width;for(const a of e){const e=a.width;Math.abs(e-i)<=t?r.push(e):(r.length>0&&o.push(r),r=[e]),i=e}r.length>0&&o.push(r);const a=[];for(const e of o){const t=Math.max(...e);a.push(t)}return a}findClosestValue(e,t){let o=t[0],r=Math.abs(e-o);for(const i of t){const t=Math.abs(e-i);t<r&&(r=t,o=i)}return o}adjustHeightAndTop(e,t){const o=t-e.height;return Object.assign(Object.assign({},e),{height:t,top:e.top-o/2})}findNearestComponent(e,o,r){let i=null,a=1/0;o.tmpData.option.textNormal.text;try{const n=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===o.cid||"AnTextNormal"===e.viewComName||r&&r.includes(e.cid)))),s=t.cloneDeep(o).baseData;s.top,s.height;for(const e of n){const t=e.baseData;t.top,t.height;if(s.left<t.left+t.width&&s.left+s.width>t.left){const o=t.top-s.top;o<a&&o<100&&(a=o,i=e)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return i}findNearestComponentForPoint(e,t,o){let r=null,i=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let o=this.getDistance(n.left,n.top+n.height,t.left,t.top);o<i&&o<n.width&&(i=o,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}findNearestComponentForTitlePoint(e,t,o){let r=null,i=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let o=this.getDistance(n.left,n.top+n.height,t.left,t.top);o<i&&o<n.width&&t.top-n.top>100&&(i=o,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}findNearestTitleForPoint(e,t,o){let r=null,i=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let o=t.top-n.top;o<i&&o<n.width&&t.top-n.top>100&&(i=o,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}getDistance(e,t,o,r){return Math.sqrt(Math.pow(o-e,2)+Math.pow(r-t,2))}findNearestComponent2(e,o,r){let i=null,a=1/0,n=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top));try{const e=n.filter((e=>!(e.cid===o.cid||"AnTextNormal"===e.viewComName||r&&r.includes(e.cid)))),s=t.cloneDeep(o).baseData,l=s.top+s.height;for(const t of e){const e=t.baseData,o=e.top+e.height;if(s.left<e.left+e.width&&s.left+s.width>e.left){const e=o-l;e>=0&&e<a&&(a=e,i=t)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return i}verticalDistance(e,t){e.left,e.width;const o=e.top+e.height,r=(t.left,t.width,t.top);return Math.abs(o-r)}extractAmount(e){const t=e.match(/(\d{1,3}(?:,\d{3})*)(\D+)/);if(t){const e=t[1].replace(/,/g,"");return[parseInt(e,10),t[2].trim()]}return[!1,!1]}getAnTextNormal(){return this.list.filter((e=>"AnTextNormal"==e.viewComName))}getAnDeckTitle3(){return this.list.filter((e=>"AnDeckTitle3"==e.viewComName)).sort(((e,t)=>e.baseData.left-t.baseData.left))}judgeAnOdometer(){let e=this.getAnTextNormal().sort(((e,t)=>e.baseData.left-t.baseData.left)),t=[],o=new Set;for(const r of e){if(o.has(r.cid))continue;let i=[];for(const t of e){if(!o.has(t.cid)&&r.cid!=t.cid){this.checkComponentIntersection(r.baseData,t.baseData)&&(o.add(t.cid),o.add(r.cid),i.push(t))}}t.push([r,...i])}let r=[];for(const e of t)for(const t of e){let o=this.getAnTextNormaltText(t);this.extractAmount(o).every((e=>e))&&r.push(e)}return r}createAnOdometer(){var e,o;let r=this.judgeAnOdometer();for(const i of r){let r,a,n,s=this.calculateCombinedComponent(i.map((e=>e.baseData)));for(const e of i){let o=this.getAnTextNormaltText(e),i=this.extractAmount(o);i.every((e=>!e))&&(r=o),i.every((e=>e))&&(a=i[0],n=i[1]),t.remove(this.list,(t=>t.cid==e.cid))}let l=Fe("AnIndicatorNormal",this.staticComponentData,t.cloneDeep({baseData:s}));(null===(o=null===(e=null==l?void 0:l.tmpData)||void 0===e?void 0:e.source)||void 0===o?void 0:o.static)&&(l.tmpData.source.static.data={text:r,num:a,unit:n},l.tmpData.source.static.originData={text:r,num:a,unit:n}),this.list.push(l)}}upgradeHeaderComponent(){for(let e=0;e<this.list.length;e++){const t=this.list[e];"AnDeckHeader3"==t.viewComName&&(t.baseData.left=0,t.baseData.top=0)}}upgradeTitleComponent(){let e=this.getAnDeckTitle3().map((e=>e.baseData)),t=this.calculateMaxWidths(e);for(let e=0;e<this.list.length;e++){const o=this.list[e];if("AnDeckTitle3"==o.viewComName){let e=this.findClosestValue(o.baseData.width,t);o.baseData.width=e>300?e:300,o.baseData=this.adjustHeightAndTop(o.baseData,this.titleHeqadeHeight)}}this.removeErroneousComponents()}containsFractionStructure(e){return/\b\d+\/\d+\b/.test(e)}removeErroneousComponents(){let e=this.getAnDeckTitle3(),t=[];for(let o=0;o<e.length;o++){const r=e[o];let i=r.tmpData.option.textNormal.text;if(this.containsFractionStructure(i))for(let o=0;o<e.length;o++){const i=e[o];if(r.cid!=i.cid){this.areComponentsIntersecting(r,i)&&t.push(r.cid)}}}this.list=this.list.filter((e=>!t.includes(e.cid)))}upgradeGroupComponent(){try{let e=this.getAnDeckTitle3(),t=this.list.filter((e=>"AnDeckTitle3"!=e.viewComName&&"AnDeckHeader3"!=e.viewComName&&"AnTextNormal"!=e.viewComName)),o=[],r=[];for(let i=0;i<e.length;i++){const a=e[i];let n=this.findNearestComponentForPoint(t,a,o);if(n&&n.cid&&o.push(n.cid),n){a.baseData.left=n.baseData.left;let t=this.upgradeComponentHeight(a,e,r);t&&t>=30&&(n.baseData=Object.assign({},n.baseData,{top:a.baseData.top+a.baseData.height+this.clearance}))}}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradeComponentHeight(e,o,r=[]){const i=e;let a=this.findNearestTitleForPoint(t.cloneDeep(o),i);return a?a.baseData.top-i.baseData.top-this.titleHeqadeHeight:1080-i.baseData.top-this.titleHeqadeHeight}getData(){return this.originData.list=this.list,this.originData.plant=this.plant,this.originData}}const Pe=new class{randomNum(e,t){return Math.floor(Math.random()*(t-e+1))+e}generateRandomIntArray(e,t,o,r){const i=[];for(let r=0;r<e;r++){const e=this.randomNum(t,o);i.push(e)}return r&&"asc"===r?i.sort(((e,t)=>e-t)):r&&"desc"===r?i.sort(((e,t)=>t-e)):i}randomString(e,t){const o="abcdefghijklmnopqrstuvwxyz",r=this.randomNum(e,t);let i="";for(let e=0;e<r;e++){const e=Math.floor(26*Math.random());i+=o.charAt(e)}return i}generateRandomNameArray(e,t,o){const r=[];for(let i=0;i<e;i++){const e=this.randomString(t,o);r.push(e)}return r}pick(e,t){const o=void 0!==t?e.filter((e=>e!==t)):e;return o[Math.floor(Math.random()*o.length)]}},$e=()=>{const e=[],t=Pe.pick([!0,!1]);let o=Pe.randomNum(3,20);const r=Pe.pick([null,null,null,{}]);let i=Pe.pick(["asc","desc",void 0,void 0,void 0]);for(let a=0;a<Pe.randomNum(1,9);a++)e.push({data:Pe.generateRandomIntArray(o,0,300,i),type:"line",smooth:t,symbolSize:Pe.randomNum(1,10),lineStyle:{width:Pe.randomNum(1,4)},areaStyle:r});return{xAxis:{type:"category",show:!1,boundaryGap:!1,data:Pe.generateRandomNameArray(o,3,6)},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},Re=(e,t)=>{let o={type:e,show:!1};return"category"===e&&(o.data=Pe.generateRandomNameArray(t,3,6)),o},Me=()=>{const e=[],t=Pe.pick([!0,!1]);let o=Pe.randomNum(3,20);const r=Pe.pick([null,null,null,{}]);let i=Pe.pick(["asc","desc",void 0,void 0,void 0]),a=Pe.randomNum(1,9),n=Pe.pick([!0,!1]);for(let s=0;s<a;s++){let a={data:Pe.generateRandomIntArray(o,0,300,i),type:"bar",smooth:t,stack:n,areaStyle:r};e.push(a)}let s=Pe.pick(["value","category"]),l=Pe.pick(["value","category"],s);return{xAxis:Re(s,o),grid:{left:0,top:0,bottom:0,right:0},yAxis:Re(l,o),series:e}},Ue=()=>{const e=[];let t=Pe.randomNum(3,20);Pe.pick([null,null,null,{}]);let o=Pe.pick(["asc","desc",void 0,void 0,void 0]),r=Pe.pick([1,2]),i=[Pe.pick(["10%","20%","30%","40%","50%","60%","70%","80%"]),Pe.pick(["90%","100%"])];return e.push({data:Pe.generateRandomIntArray(t,3,20,o),type:"pie",radius:1==r?"100%":i,roseType:1==r?Pe.pick(["area",null,null]):null,padAngle:1==r?0:Pe.randomNum(1,5),startAngle:1==r?Pe.pick([0,180]):0,endAngle:360,label:{show:!1},itemStyle:{borderRadius:3}}),{grid:{left:0,top:0,bottom:0,right:0},series:e}},Be=()=>{const e=[];Pe.pick([!0,!1]),Pe.randomNum(3,20),Pe.pick([null,null,null,{}]),Pe.pick(["asc","desc",void 0,void 0,void 0]);for(let t=0;t<Pe.randomNum(1,20);t++){let t=Pe.randomNum(3,Pe.randomNum(3,20)),o=[];for(let e=0;e<t;e++){let e=[];for(let t=0;t<2;t++)e.push(Pe.randomNum(1,30));o.push(e)}e.push({type:"scatter",symbolSize:Pe.randomNum(3,30),data:o})}return{xAxis:{show:!1},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},qe=()=>{const e=[],t=Pe.pick(["polygon","circle"]);let o=Pe.randomNum(1e4,99999),r=Pe.randomNum(3,10),i=[];for(let e=0;e<r;e++)i.push({name:Pe.randomString(4,8),max:o});for(let t=0;t<Pe.randomNum(2,10);t++)e.push({value:Pe.generateRandomIntArray(r,1e4,o),name:Pe.randomString(4,8)});return{radar:{shape:t,indicator:i,axisName:{show:!1},radius:"100%"},grid:{left:0,top:0,bottom:0,right:0},series:[{type:"radar",symbol:"none",lineStyle:{width:1},data:e}]}},Le=()=>{const e=[];for(let t=0;t<Pe.randomNum(4,15);t++)e.push({value:Pe.randomNum(1,100),name:Pe.randomString(4,8)});return{grid:{left:0,top:0,bottom:0,right:0},series:[{type:"funnel",left:"0%",top:0,bottom:0,width:"100%",min:0,minSize:"0%",maxSize:"100%",label:{show:!1,position:"inside"},sort:Pe.pick(["descending","ascending"]),gap:2,lineStyle:{width:1},data:e}]}};let He=Pe.randomNum(5,20);const ze={width:He};Pe.pick([!0,!1])&&(ze.color=[[.3,"#67e0e3"],[.7,"#37a2da"],[1,"#fd666d"]]);class Ge{constructor(){this.names=["line","bar","pie","scatter","radar","funnel","gauge"]}static getInstance(){return Ge.instance||(Ge.instance=new Ge),Ge.instance}createLine(){switch(Pe.pick(this.names)){case"line":return{type:"line",typeNum:1,option:$e()};case"bar":return{type:"bar",typeNum:2,option:Me()};case"pie":return{type:"pie",typeNum:3,option:Ue()};case"scatter":return{type:"scatter",typeNum:4,option:Be()};case"radar":return{type:"radar",typeNum:5,option:qe()};case"funnel":return{type:"funnel",typeNum:6,option:Le()};case"gauge":return{type:"gauge",typeNum:7,option:{grid:{left:0,top:0,bottom:0,right:0},series:[{type:"gauge",radius:"100%",detail:{formatter:"{value}"},progress:{show:Pe.pick([!0,!1]),width:He},axisLine:{lineStyle:ze},data:[{value:Pe.randomNum(1,100),name:"SCORE"}]}]}}}}}Ge.instance=null;const Je=Ge.getInstance();const _e=new class{constructor(){this.directions=["row","row"],this.direction="column",this.splitNumbers=24,this.margin=[0,0]}baseLayout(e){const t=(null==e?void 0:e.maRrows)?null==e?void 0:e.maRrows:this.splitNumbers,o=(null==e?void 0:e.colNum)?null==e?void 0:e.colNum:this.splitNumbers,r=e.wrapWidth/o,i=e.wrapHeight/t;let a=M(this.directions);a&&(this.direction=a);let n=[];if("row"===this.direction){let e=M([3,4]);n=this.simulateRandomSegments(24,4,12,e)}else{let e=M([2,3]);n=this.simulateRandomSegments(24,4,6,e)}let s=[],l=[];if("row"===this.direction){for(let e=0;e<n.length;e++)if(0==e)s.push({x:0,y:0,w:n[e],h:24,i:e,wStep:r,hStep:i});else{let t=s[e-1].x;s.push({x:n[e-1]+t,y:0,w:n[e],h:24,i:e,wStep:r,hStep:i})}let e=M([2,3]),t=this.simulateRandomSegments(24,6,12,e);for(let e=0;e<s.length;e++){const o=s[e];for(let a=0;a<t.length;a++){const n=t[a];l.push({x:o.x,y:n,w:o.w,h:n,i:10*e+a,wStep:r,hStep:i})}}}else{for(let e=0;e<n.length;e++)if(0==e)s.push({x:0,y:0,w:24,h:n[e],i:e,wStep:r,hStep:i});else{let t=s[e-1].y;s.push({x:0,y:n[e-1]+t,w:24,h:n[e],i:e,wStep:r,hStep:i})}for(let e=0;e<s.length;e++){const t=s[e];let o=M([1,2,3,4]),a=this.simulateRandomSegments(24,5,12,o),n=[];for(let o=0;o<a.length;o++){const s=a[o];if(0==o)n.push({x:0,y:t.y,w:s,h:t.h,i:10*e+o,wStep:r,hStep:i}),l.push({x:0,y:t.y,w:s,h:t.h,i:10*e+o,wStep:r,hStep:i});else{let d=n[o-1].x;n.push({x:a[o-1]+d,y:t.y,w:s,h:t.h,i:10*e+o,wStep:r,hStep:i}),l.push({x:a[o-1]+d,y:t.y,w:s,h:t.h,i:10*e+o,wStep:r,hStep:i})}}}}return{layouts:l.map((t=>{let{option:o,typeNum:r}=Je.createLine(),i=t.x*t.wStep+t.w*t.wStep/2,a=t.y*t.hStep+t.h*t.hStep/2,n=t.w*t.wStep,s=t.h*t.hStep;if(3==r||5==r||7==r){let e=Math.min(n,s);n=e,s=e}let l=e.wrapWidth,d=e.wrapHeight;return t.chartsOption=o,t.typeNum=r,t.txt=r+" "+i/l+" "+a/d+" "+n/l+" "+s/d,console.log(t.txt),t})),option:{colNum:o,margin:(null==e?void 0:e.margin)?null==e?void 0:e.margin:this.margin,isDraggable:!!(null==e?void 0:e.isDraggable)&&(null==e?void 0:e.isDraggable),isResizable:!!(null==e?void 0:e.isResizable)&&(null==e?void 0:e.isResizable),verticalCompact:!(null==e?void 0:e.verticalCompact)||(null==e?void 0:e.verticalCompact),useCssTransforms:!(null==e?void 0:e.useCssTransforms)||(null==e?void 0:e.useCssTransforms),rowHeight:e.wrapHeight/t,maRrows:t}}}simulateRandomSegments(e,t,o,r){const i=[];let a=e,n=r;for(;n>0;)if(1===n)i.push(a),n--;else{const e=Math.min(o,a-t*(n-1)),r=Math.floor(Math.random()*(e-t+1))+t;i.push(r),a-=r,n--}return i}simulateRandomSegments2(e,t,o,r){const i=[];let a=e,n=r;for(;n>0;)if(1==n){const t=e-i.reduce(((e,t)=>e+t),0);i.push(t),n--}else{let e=Math.floor(Math.random()*o),r=Math.max(t,e),s=a-t*n;const l=Math.min(r,s);i.push(l),a-=l,n--}return i}},We=e=>{try{return JSON.parse(e)}catch(t){return e}};const Xe=new class{constructor(){this.requested=new Set,this.dbName="go-db",this.storeName="store",this.init()}init(){return a(this,void 0,void 0,(function*(){const e=indexedDB.open(this.dbName,1);e.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName,{keyPath:"key"})},e.onsuccess=()=>{},e.onerror=e=>{var t;console.error("数据库错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}pushCaseIdToRequested(e){this.requested.add(e)}add(e,t){return a(this,void 0,void 0,(function*(){if(!(yield this.isExist(e))){t.caseDetailData&&(t.caseDetailData="string"==typeof t.caseDetailData?We(t.caseDetailData):t.caseDetailData),this.pushCaseIdToRequested(e);const o=(yield this.getDB()).transaction(this.storeName,"readwrite");o.objectStore(this.storeName).add({key:e,value:t}),o.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}))}bulkPut(e){return a(this,void 0,void 0,(function*(){const t=(yield this.getDB()).transaction(this.storeName,"readwrite"),o=t.objectStore(this.storeName);for(const t of e){const{caseId:e,id:r}=t,i=`${e}_${r}`;(yield this.isExist(i))||(t.caseDetailData&&(t.caseDetailData=We(t.caseDetailData)),this.pushCaseIdToRequested(i),o.put({key:i,value:t}))}t.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}get(e){return a(this,void 0,void 0,(function*(){if(!(yield this.isExist(e)))return null;const t=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((o,r)=>{const i=t.get(e);i.onsuccess=e=>{o(e.target.result?e.target.result.value:null)},i.onerror=e=>{var t;r("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}getAllData(){return a(this,void 0,void 0,(function*(){const e=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((t,o)=>{const r=e.getAll();r.onsuccess=e=>{t(e.target.result)},r.onerror=e=>{var t;o("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}update(e,t){return a(this,void 0,void 0,(function*(){if(yield this.isExist(e)){const o=yield this.get(e),r=We(t),i=(yield this.getDB()).transaction(this.storeName,"readwrite");i.objectStore(this.storeName).put({key:e,value:Object.assign(Object.assign({},o),{caseDetailData:r})}),i.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}else console.error("更新 IndexedDB 错误")}))}delete(e){this.requested.delete(e);indexedDB.open(this.dbName).onsuccess=t=>{const o=t.target.result.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(e),o.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}isExist(e){return a(this,void 0,void 0,(function*(){const t=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((o,r)=>{const i=t.count(e);i.onsuccess=e=>{o(e.target.result>0)},i.onerror=e=>{var t;r("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}reset(){this.requested.clear();indexedDB.open(this.dbName).onsuccess=e=>{const t=e.target.result.transaction(this.storeName,"readwrite");t.objectStore(this.storeName).clear(),t.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}clear(){return a(this,void 0,void 0,(function*(){const e=(yield this.getDB()).transaction(this.storeName,"readwrite");e.objectStore(this.storeName).clear(),e.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}isExistStore(){return a(this,void 0,void 0,(function*(){const e=indexedDB.open(this.dbName);return new Promise((t=>{e.onsuccess=()=>{t(!0)},e.onerror=()=>{t(!1)}}))}))}getDB(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const o=indexedDB.open(this.dbName);o.onsuccess=t=>{e(t.target.result)},o.onerror=e=>{var o;t("数据库错误: "+(null===(o=e.target.error)||void 0===o?void 0:o.message))}}))}))}};function Ke(e){!function(e,t){e.depends?i(e):Qe(e,t)}(e,!1)}function Qe(e,t=!0){let{theme:o,option:r,optionDes:i}=e;r&&i&&o&&Object.keys(i).forEach((a=>{"conditionSeries"!==i[a].type&&"tabs"!==i[a].type||!r[a]?i[a].theme?r.hasOwnProperty(a)&&function({theme:e,option:t,optionDes:o},r,i){let a;if("color"!=o[r].type||!i&&t[r]){if("bgcolor"==o[r].type&&(i||!t[r]||!t[r].style)){t[r]||(t[r]={});let{key:i,points:n,degree:s,type:l,opacity:d}=o[r].theme;if(n){s||(s=90),l||(l="linear");let o=`${l}-gradient(${s}deg`,i=100/(n.length-1),c=[];n.forEach(((t,r)=>{a=Ye(e,t),o+=`,${Ze(a,t.opacity)} ${i*r}%`;let{red:n,green:s,blue:l,alpha:u}=et(a,d);c.push({red:n,green:s,blue:l,alpha:u,left:i*r})})),o+=")",t[r].style=o,t[r].degree=s,t[r].flag=n.length?3:2,t[r].points=c,t[r].type=l}else i&&(a=Ye(e,o[r].theme),t[r]=Object.assign(Object.assign({},et(a,d)),{style:Ze(a,d)}))}}else{let{opacity:i}=o[r].theme;a=Ye(e,o[r].theme),t[r]=Ze(a,i)}}(e,a,t):i[a].hasOwnProperty("type")&&"slot"!=i[a].type&&"textStyle"!=i[a].type&&"sheet"!=i[a].type||i[a].constructor!=Object||Qe({option:r[a],optionDes:i[a],theme:o},t):function(e,t,o,r,i,a){let n=t.form,s=e;if(Array.isArray(n))for(let e=0;e<n.length;e++){let t,o=n[e];t=a?s[e].form:s[e],Qe({option:t,optionDes:o,theme:r},i)}else{let e=s.length;for(let t=0;t<e;t++){let e;e=a?s[t].form:s[t],Qe({option:e,optionDes:n,theme:r},i)}}}(r[a],i[a],0,o,t,"conditionSeries"===i[a].type)}))}function Ye(e,t){if(e[t.key])return e[t.key]||e.color;if(t.key.indexOf(".")>-1){return[e,...t.key.split(".")].reduce(((t,o)=>"object"==typeof t&&o in t?t[o]:(tt(`属性${o}不存在,获取主题颜色错误,将使用默认主题色`),e.color)))}return tt(`属性${t.key}不存在,获取主题颜色错误,将使用默认主题色`),e.color}function Ze(e,t){let{red:o,green:r,blue:i,alpha:a}=et(e,t);return`rgba(${o},${r},${i},${a})`}function et(e,t){return-1!=e.indexOf("#")&&(e=e.substr(1)),null==t&&(t=1),{red:parseInt("0x"+e.slice(0,2)),green:parseInt("0x"+e.slice(2,4)),blue:parseInt("0x"+e.slice(4,6)),alpha:t}}function tt(e){console.warn(e)}class ot{constructor(e){this.processedIds=new Set,this.validateAccessResolve=null,e?(e.caseId&&(this.caseId=e.caseId),e.pageId&&(this.pageId=e.pageId),e.mode&&(this.mode=e.mode),e.environment&&(this.environment=e.environment),e.xhr&&(this.xhr=e.xhr),e.staticComponentData&&(this.staticComponentData=e.staticComponentData),e.theme&&(this.theme=e.theme)):console.log("初始化错误!"),this.defaultTheme={name:"科技蓝",color:"#006aee",background:"#00000033",pageBackground:"#051836",text:"#F0F0F0",groups:["#006aee","#00eae9","#00a9ec","#00ec80","#edc700","#9913ee"]}}checkHardware(){return a(this,void 0,void 0,(function*(){return yield new Promise(((e,t)=>{e("Hardware is not available")}))}))}checkSecurity(e){return a(this,void 0,void 0,(function*(){return yield new Promise(((t,o)=>{"preview"==this.environment?t(0):this.getShareForRelease(e).then((e=>{2e4==e.code&&e.data?(e.data,e.data.loginLimitSwitch?t(1):e.data.hasAuth?t(2):t(3)):t(4)}))}))}))}validateAccess(e,t){return a(this,void 0,void 0,(function*(){return new Promise(((o,r)=>{this.validateAccessResolve=o,t&&t(e)}))}))}initBefore(){return new Promise(((e,t)=>{let o=g("secretFree");o?sessionStorage.setItem("secret-free",o):sessionStorage.setItem("secret-free",null),console.log("运行免登录设置完成!"),e(!0)}))}fetchCaseId(e,t){return a(this,void 0,void 0,(function*(){try{const o=yield this.getKey(e,t);return 2e4===(null==o?void 0:o.code)&&(null==o?void 0:o.data)?o.data:e}catch(t){return console.error("Error fetching caseId:",t),e}}))}getDataForrelease(){return new Promise(((e,t)=>{e("data")}))}onProjectLoaded(e){}authenticate(){return a(this,void 0,void 0,(function*(){this.environment}))}getShareForRelease(e){return this.xhr.get(`/go/v1/go-share/v1/${e}/config`)}findById(e,t="",o=0,r=""){return"release"===this.environment?this.xhr.get(`/go/v1/go-share/v1/${e}?pwd=${t}&mode=${o}&token=${r}`):this.xhr.get(`/go/v1/go-cases/v1/${e}?mode=${o}&token=${r}`)}getKey(e,t=0){return this.xhr.get(`/go/v1/go-cases/v1/key/${e}?caseMode=${t}`)}getPageData(e,t){return a(this,void 0,void 0,(function*(){const o=yield Xe.get(e+"_"+t);return o?{data:o}:"release"===this.environment?this.xhr.get(`/go/v1/go-share/v1/${e}/pages/${t}`):this.xhr.get(`/go/v1/go-cases/v1/${e}/pages/${t}`)}))}getPageId(e,t){if(null==t?void 0:t.length){if(t.find((t=>t.id==e)))return e;let o=t.find((t=>t.caseDetailPath==e||t.caseDetailName==e));return o?o.id:e}return e}fetchProjectForId(e){return a(this,arguments,void 0,(function*(e,t="",o=0,r=""){return yield this.findById(e,t,o,r)}))}updataPageData(e,t){return a(this,void 0,void 0,(function*(){var o;let r=yield this.getPageDataForID(e,t);if(null==r?void 0:r.data){let e=yield this.pageInit(r.data);console.log(e,"datadatadatadata"),null===(o=null==this?void 0:this.lifecycleHooks)||void 0===o||o.onPageDataReady(e)}else console.error("请求数据发生错误!")}))}getPageDataForID(e,t,o){return a(this,void 0,void 0,(function*(){const r=this.getPageId(t,this.projectInfo.details);if(this.processedIds.has(r)){console.log(`ID ${r} has already been processed.`);const t=yield Xe.get(e+"_"+r);if(t)return{data:t}}const i=this.getPageData(e,r);this.processedIds.add(r),o&&o.length&&o.map((t=>a(this,void 0,void 0,(function*(){try{if(this.processedIds.has(t))return void console.log(`ID ${r} has already been processed.`);const o=yield this.getPageData(e,t);Xe.add(e+"_"+t,o.data),this.processedIds.add(t)}catch(e){console.error(`Error processing ID ${t}: ${e}`)}}))));const n=yield i;return Xe.add(e+"_"+r,n.data),yield i}))}fetchPageDataForId(e){return a(this,arguments,void 0,(function*(e,t="",o=0,r=""){return yield this.findById(e,t,o,r)}))}setTheme(){console.log("设置主题")}setBackground(){console.log("设置背景信息")}updateVariables(){console.log("更新变量信息")}beforeRender(e){}renderComponents(){return a(this,void 0,void 0,(function*(){}))}setGlobalThemeVars(e){document.body.style.cssText=`\n --theme-background: ${e.background};\n --theme-color: ${e.color};\n --theme-pageBackground: ${e.pageBackground};\n --theme-text: ${e.text};\n ${e.groups.map(((e,t)=>`--theme-groups-${t}: ${e};`)).join("\n")}\n `}listenForRenderCompletion(){}showAnimation(){console.log("所有组件渲染完成,显示动画。")}setComTheme(e,t){var o,r;let i=null===(o=this.staticComponentData[t.viewComName])||void 0===o?void 0:o.optionDes,a=null===(r=this.staticComponentData[t.viewComName])||void 0===r?void 0:r.theme;return Ke({theme:e,option:t.tmpData.option,optionDes:i,depends:a}),t}getComData(e,t,o,r){return a(this,void 0,void 0,(function*(){return new Promise(((i,a)=>{if(e.tmpData&&e.tmpData.source){this.setComTheme(r,e);try{pe(e,!0,t,o).then((t=>{t&&(e.source=t)})),i(1)}catch(e){i(e)}}else i("")}))}))}processingData(e){return a(this,void 0,void 0,(function*(){try{let t=this.defaultTheme;return(null==e?void 0:e.theme)&&(t=e.theme),k(e.list,(o=>a(this,void 0,void 0,(function*(){yield this.getComData(o,e.globalVars,e.globalSource,t)})))),e}catch(t){return console.warn("页面初始化发生错误:",t),e}}))}pageInit(e){return a(this,void 0,void 0,(function*(){var o;try{let r=null==e?void 0:e.caseDetailData,i=this.defaultTheme;if((null==r?void 0:r.theme)&&(i=r.theme),this.setGlobalThemeVars(i),r.resource){let e=(null===(o=null===window||void 0===window?void 0:window.anovuiConfig)||void 0===o?void 0:o.fonts)||[],i=t.concat(r.resource.fonts,e),a=t.cloneDeep(r.resource);a.fonts=i,yield p(a)}ke.clearVars(),ke.addVariables(r.globalVars);let n=ke.getAllVariables();return k(r.list,(e=>a(this,void 0,void 0,(function*(){yield this.getComData(e,n,r.globalSource,i)})))),r}catch(t){return console.warn("页面初始化发生错误:",t),(null==e?void 0:e.data)?e.data:e}}))}validate(e,t,o){return a(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{const n=(e,o)=>a(this,void 0,void 0,(function*(){let i=yield this.validateAccess(e,o),a=(null==i?void 0:i.pwd)?i.pwd:"",s=(null==i?void 0:i.mode)?i.mode:0,l=(null==i?void 0:i.token)?i.token:"",d=yield this.fetchProjectForId(t,a,s,l);2e4==(null==d?void 0:d.code)&&(null==d?void 0:d.data)?(this.projectInfo=d.data,console.log("验证成功!"),this.lifecycleHooks.message("验证成功!"),r(!0)):(this.lifecycleHooks.validateError(d),this.lifecycleHooks.message(d.msg,"warning"),n(e,o))}));n(e,o)}))}))}init(e){return a(this,void 0,void 0,(function*(){var t;try{this.lifecycleHooks=e,yield this.checkHardware();let o=yield this.fetchCaseId(this.caseId,this.mode),r=yield this.checkSecurity(o),i=e.onValidateAccess||(()=>{});(yield this.validate(r,o,i))&&e.onCaseReady(this.projectInfo);let a=(null===(t=this.projectInfo)||void 0===t?void 0:t.details).map((e=>e.id)),n=this.getPageId(this.pageId,this.projectInfo.details);console.log(n,this.pageId,"this.pageId");let s=yield this.getPageDataForID(o,n||a[0],a);const l=yield this.pageInit(s.data);return e.onPageDataReady(l),{currentData:this.projectInfo,currentPageData:l}}catch(e){console.error("加载页面时出错:",e)}}))}}export{je as ConfigOptimizer,Ne as GlobalVariables,K as Http,X as Log,ot as PageLoader,f as addPreloadLink,ee as agentData,Ie as applyDiff,F as delFetchStatus,Oe as diffObjects,_e as displayGenerator,he as editItem,Ae as emitEvent,ce as fetchDataByGlobal,de as fetchDataByType,ue as filterData,A as findItemDeep,O as findItemDeep2,Z as getData,te as getDataForApi,re as getDataForDataSet,ae as getDataForSource,ne as getDataForStatic,oe as getDataForZb,ie as getDataForZbCQ,j as getResourceForComponent,w as getSessionData,v as getStandardData,S as getStringVars,g as getUrlParams,xe as getVarDefaultVal,ke as globalVars,C as hasVar,y as isJSON,h as loadFont,d as loadFontResource,c as loadScript,p as loadTag,k as recursion,m as removeTag,ge as replaceVariable,I as safeEval,T as safeEvalForCode,V as setFetchStatus,b as setSessionData,be as updataGlobalDataSourceForVar,pe as updateComData,we as updateGlobalDataSource};
1
+ import e from"axios";import t,{uniq as o}from"lodash";import i from"crypto-js";import{setOptionColorByTheme as r}from"@anov/ui/lib/utils/option-theme.js";import n from"gsap";function a(e,t,o,i){return new(o||(o=Promise))((function(r,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function s(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const s=3e4,l=3e4,d=(t="",o)=>{let i=e.create({baseURL:t,timeout:s,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});return i.interceptors.request.use((function(e){return sessionStorage.getItem("anov-go-token")&&"null"!=sessionStorage.getItem("anov-go-token")&&(e.headers["X-ANOV-ACCESS-TOKEN"]=sessionStorage.getItem("anov-go-token")),sessionStorage.getItem("unify-access-token")&&"null"!=sessionStorage.getItem("unify-access-token")&&(e.headers["X-UNIFY-ACCESS-TOKEN"]=sessionStorage.getItem("unify-access-token")),sessionStorage.getItem("dgcc_authorization")&&"null"!=sessionStorage.getItem("dgcc_authorization")&&(e.headers.dgcc_authorization=sessionStorage.getItem("dgcc_authorization")),"post"===e.method?(e.headers["Content-Type"]="application/json;",e):"get"===e.method?e:"put"===e.method?(e.headers["Content-Type"]="application/json; charset=UTF-8",e):"delete"===e.method?e:void 0}),(function(e){return Promise.reject(e)})),i.interceptors.response.use((function(e){return 200===e.status||e.data.code,o&&o(e),e.data}),(function(e){return o&&o(null==e?void 0:e.response),Promise.reject(e.response)})),i},c=function(e){return a(this,void 0,void 0,(function*(){try{let{fontUrl:t,fontName:o}=e;const i="__custom_font__";let r=document.getElementById(i);if(!r){r=document.createElement("style"),r.id=i;const e=document.head||document.getElementsByTagName("head")[0];yield e.appendChild(r)}r.innerText+=`@font-face{font-family:'${o}';src:url(${t});}`}catch(e){console.warn(e)}}))},u=(e,t="jspaths",o)=>a(void 0,void 0,void 0,(function*(){const i="csspaths"===t?"link":"script",r=document.createElement(i);"jspaths"===t?r.defer=!0:r.rel="stylesheet",r.className=t,r.src=e;(o||document.head||document.getElementsByTagName("head")[0]).appendChild(r),yield new Promise(((e,t)=>{r.addEventListener("load",e),r.addEventListener("error",e)}))})),h=(e,t="jspaths")=>a(void 0,void 0,void 0,(function*(){const o="fonts"===t?c:u;yield Promise.all(e.map((e=>o(e))))})),p=e=>a(void 0,void 0,void 0,(function*(){e.fonts&&e.fonts.length&&(yield h(e.fonts,"fonts"))})),m=({jspaths:e=[],csspaths:o=[],fonts:i=[]})=>a(void 0,void 0,void 0,(function*(){const r=t.uniqBy(i,"fontName");yield Promise.all([h(e,"jspaths"),h(o,"csspaths"),h(r,"fonts")])})),f=()=>{var e;(null==(e=document.getElementById("__custom_font__"))?void 0:e.parentNode)&&e.parentNode.removeChild(e),Array.from(document.getElementsByTagName("script")).filter((e=>"jspaths"==e.className)).forEach((e=>{!function(e){for(var t,o=Array.from(document.getElementsByTagName("script")),i=0;i<o.length;i++)o[i]&&o[i].src&&-1!=o[i].src.indexOf(e)&&(null===(t=o[i])||void 0===t?void 0:t.parentNode)&&o[i].parentNode.removeChild(o[i])}(e.src)})),Array.from(document.getElementsByTagName("link")).filter((e=>"csspaths"==e.className)).forEach((e=>{!function(e){for(var t,o=Array.from(document.getElementsByTagName("link")),i=0;i<o.length;i++)o[i].href,o[i]&&o[i].href&&-1!=o[i].href.indexOf(e)&&(null===(t=o[i])||void 0===t?void 0:t.parentNode)&&o[i].parentNode.removeChild(o[i])}(e.href)}))};const g=(e,t,o)=>{const i=document.createElement("link");switch(i.rel="preload",i.href=e,i.crossorigin="anonymous",t){case"video":i.as="video";break;case"script":i.as="script";break;case"image":i.as="image"}i.onload=()=>{console.log(`success to preload ${e}`),o&&o()},i.onerror=()=>{console.error(`Failed to preload ${e}`)},document.head.appendChild(i)},v=(e,t)=>{try{let o=t||window.location.href;if(-1!=o.indexOf("?")){let t={};return o.slice(o.indexOf("?")+1).split("&").forEach((e=>{let o=e.split("=");t[o[0]]=o[1]})),e?t[e]?t[e]:null:t}return console.log("没有参数"),null}catch(e){console.error(e)}};function y(e,t=!1){try{return t?b(e)?e:JSON.stringify(e):b(e)?JSON.parse(e):e}catch(t){return console.log("转化JSON 发生错我!",e),e}}const b=e=>{if("string"==typeof e)try{const t=JSON.parse(e);return"object"==typeof t&&null!==t}catch(e){return!1}return!1},w=(e,t)=>{try{const o=JSON.stringify(t);sessionStorage.setItem(e,o)}catch(t){console.error(`Error setting session data for key ${e}:`,t)}},D=e=>{const t=sessionStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.error(`Error parsing session data for key ${e}:`,t)}return null},N=e=>{for(const t of e)t.code&&(t.code=t.code.replace(/&gt;/g,">").replace(/&lt;/g,"<"))},k=(e,t)=>{e instanceof Map?e.forEach((e=>{t([e])})):Array.isArray(e)&&e.forEach((e=>{t(e.children)}))},C=(e,t)=>{const o=e=>{var i,r,n;if(e)for(const a of e){const e=null===(n=null===(r=null===(i=null==a?void 0:a.tmpData)||void 0===i?void 0:i.source)||void 0===r?void 0:r.converse)||void 0===n?void 0:n.data;(null==e?void 0:e.length)&&N(e),t(a),a.children?o(a.children):a.dynamicChildren?k(a.dynamicChildren,o):a.stateChildren&&o(a.stateChildren)}};o(e)},A=(e,t)=>a(void 0,void 0,void 0,(function*(){const o=e=>a(void 0,void 0,void 0,(function*(){var i,r,n;if(e)for(const a of e){const e=null===(n=null===(r=null===(i=null==a?void 0:a.tmpData)||void 0===i?void 0:i.source)||void 0===r?void 0:r.converse)||void 0===n?void 0:n.data;(null==e?void 0:e.length)&&(yield N(e)),yield t(a),a.children?yield o(a.children):a.dynamicChildren?yield k(a.dynamicChildren,o):a.stateChildren&&(yield o(a.stateChildren))}}));yield o(e)})),S=(e,t,o,i)=>{const r=e.match(/({{[\w]*}})|((@)[\w]*)/gm);if(r){const e=r.map((e=>e.replace(/{{|}}|@/gm,"")));for(const r of e)if(r&&t&&!(t.findIndex((e=>e.mapField===r))<0))return o&&i&&x(i,r,o.cid),!0}return!1},x=(e,t,o)=>{if(!e)throw new Error("Share variable tree is not defined");if("string"!=typeof t)throw new Error("Variable name should be a string");if(!o)throw new Error("ID is required");Array.isArray(e[t])||(e[t]=[]),e[t].includes(o)||e[t].push(o)},O=(e,t,o)=>{var i;let r=!1;const n=null==t?void 0:t.converse;if(n&&n.use&&n.data.length)for(const t of n.data)if((null==t?void 0:t.dependVars)&&t.dependVars.includes(e))return!0;const a=null==t?void 0:t[null==t?void 0:t.type];return((null==a?void 0:a.inputSql)||(null==a?void 0:a.url)||(null==a?void 0:a.headers)||(null==a?void 0:a.params))&&(r=S(a.inputSql||a.url||(null===(i=a.headers)||void 0===i?void 0:i.value)||a.params,o)),r},I=(e,o,i=!1)=>{let r=null;const n=e=>{for(const a of e){if(a.cid===o){r=a,i&&t.remove(e,(e=>e.cid===o));break}if(a.children&&n(a.children),a.dynamicChildren&&Array.isArray(a.dynamicChildren))for(const[,e]of Array.from(a.dynamicChildren))n(e);a.stateChildren&&n(a.stateChildren)}};return n(e),r},T=(e,o,i)=>{let r=!1;const n=e=>{for(let a=0;a<e.length;a++){if(e[a].cid==o){r=e[a],i&&t.remove(e,(e=>e.cid==o));break}if(e[a].children)n(e[a].children);else if(e[a].dynamicChildren){if(e[a].dynamicChildren instanceof Map){let t=Array.from(e[a].dynamicChildren);for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let o=t[e][1];n(o)}}else if(e[a].dynamicChildren instanceof Array){let t=e[a].dynamicChildren;for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let o=t[e][1];n(o)}}}else e[a].stateChildren&&n(e[a].stateChildren)}};return n(e),r||!1};function j(e,t,o){const i={};o&&o.forEach((e=>{(null==e?void 0:e.name)&&(i[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(t,i)}catch(e){return console.error(e),t}}function E(e,o,i){let r=t.cloneDeep(o);const n={};i&&i.forEach((e=>{(null==e?void 0:e.name)&&(n[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(r,n)}catch(e){return console.error(e),r}}const V=e=>{let t=window.goFetchList;return t||(window.goFetchList={},t=window.goFetchList),t[e]?!t[e]&&void 0:(t[e]={id:e,time:(new Date).getTime()},!0)},F=e=>{let t=window.goFetchList;t&&t[e]&&delete t[e]};function P(e){const t=e.match(/\.([^\/\\]+)$/);return t?t[1].toLowerCase():void 0}const $=e=>{const t=[];let o=function(e){return e.endsWith("/")?e.slice(0,-1):e}(window.baseUrl);return C(e,(e=>{var i,r,n,a,s,l,d,c,u;if("AnDeckHeader3"==e.viewComName&&(null===(n=null===(r=null===(i=null==e?void 0:e.tmpData)||void 0===i?void 0:i.option)||void 0===r?void 0:r.bgImage)||void 0===n?void 0:n.path)){let i=P(e.tmpData.option.bgImage.path);t.push({type:i,url:o+e.tmpData.option.bgImage.path})}if("AnVideoNormal"==e.viewComName&&(null===(s=null===(a=null==e?void 0:e.tmpData)||void 0===a?void 0:a.option)||void 0===s?void 0:s.dynamicUrl)){let i=P(null===(d=null===(l=null==e?void 0:e.tmpData)||void 0===l?void 0:l.option)||void 0===d?void 0:d.dynamicUrl);t.push({type:i,url:o+(null===(u=null===(c=null==e?void 0:e.tmpData)||void 0===c?void 0:c.option)||void 0===u?void 0:u.dynamicUrl)})}})),t},M="anov@2019:helloX",R="anov@2020:helloX";function B(e){let t=i.enc.Utf8.parse(M),o=i.enc.Utf8.parse(R);return i.AES.encrypt(e,t,{iv:o,mode:i.mode.CBC,padding:i.pad.Pkcs7}).toString()}function U(e,t){if(0===e.length)throw new Error("Array is empty.");if(!t)return e[Math.floor(Math.random()*e.length)];if(t.length!==e.length)throw new Error("Length of probabilities array must match length of array.");const o=t.reduce(((e,t)=>e+t),0),i=Math.random()*o;let r=0;for(let o=0;o<e.length;o++)if(r+=t[o],i<r)return e[o];return e[0]}const q=new Blob(["\nfunction proxyObj(originObj) {\n const exposeObj = new Proxy(originObj, {\n has: (target, key) => {\n if (['fetch', 'XMLHttpRequest', 'postMessage'].indexOf(key) >= 0) {\n throw new Error('Illegal operation for key'+key)\n } else {\n return target[key]\n }\n },\n })\n return exposeObj\n}\nfunction compileCode(src) {\n src = 'with (exposeObj) {'+src+'}'\n //console.log(src)\n return new Function('exposeObj', src)\n}\nfunction run(code) {\n let proxy = proxyObj({})\n let result = compileCode(code)(proxy)\n return result\n}\n\nonmessage = (e) => {\n try {\n let result = run(e.data.code)\n postMessage({\n code: 1,\n result,\n })\n } catch (err) {\n postMessage({\n code: -1,\n err,\n })\n }\n}\n"]),L=URL.createObjectURL(q);function H(e,t,o={},i="worker"){return a(this,void 0,void 0,(function*(){try{if("window"==i){let[i,r]=[["data"],[t]];"object"==typeof o&&Object.keys(o).forEach((e=>{i.push(e),r.push(o[e])}));const n=new Function(...i,e);return{success:!0,data:n(...r)}}{let[i,r,n]=[t,o,""];"object"==typeof i&&(i=JSON.stringify(t)),"object"==typeof o&&(r=JSON.stringify(o)),Object.keys(o).forEach((e=>n+=`${e},`));let s=`let data=eval(${i}); \n             let app=${JSON.stringify({})};`;s+=n?`let {${n}} = eval(${r}); `:"",s+=`${e}`;let l=yield function(e,t=5e3){return a(this,void 0,void 0,(function*(){let o=new Worker(L);return new Promise(((i,r)=>{const n=()=>{clearTimeout(s),o.removeEventListener("message",a),o.terminate(),o=null},a=e=>{let{code:t,result:o,err:a}=e.data;n(),1===t?i(o):r(a)};o.postMessage({code:e}),o.addEventListener("message",a);let s=setTimeout((()=>{n(),r("timeout")}),t)}))}))}(s);return{success:!0,data:l}}}catch(e){return{success:!1,error:e,data:t}}}))}var z,G,J,_;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(z||(z={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(G||(G={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(J||(J={}));class W{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return W.instance||(W.instance=new W(e)),W.instance}init(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const o=indexedDB.open(this.dbName,1);o.onerror=e=>{t(e.target.error)},o.onupgradeneeded=e=>{this.db=e.target.result,this.db.objectStoreNames.contains(this.tableName)||this.db.createObjectStore(this.tableName,{keyPath:this.keyPath})},o.onsuccess=t=>{this.db=t.target.result,e()}}))}))}addRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).add(e);i.onsuccess=()=>{t()},i.onerror=e=>{o(e.target.error)}}))}))}deleteRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);i.onsuccess=()=>{t()},i.onerror=e=>{o(e.target.error)}}))}))}updateRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(e);i.onsuccess=()=>{t()},i.onerror=e=>{o(e.target.error)}}))}))}getRecord(e){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,o)=>{const i=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);i.onsuccess=()=>{t(i.result)},i.onerror=e=>{o(e.target.error)}}))}))}getAllRecords(){return a(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((e,t)=>{const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAll();o.onsuccess=()=>{e(o.result)},o.onerror=e=>{t(e.target.error)}}))}))}}W.instance=null,function(e){e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE"}(_||(_={}));const X={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class K{constructor(){this.logLevel=_.INFO,this.indexedDBInstance=W.getInstance(X);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return K.instance||(K.instance=new K),K.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case _.FATAL:return"";case _.ERROR:return"";case _.WARN:return"";case _.INFO:return"";case _.DEBUG:return"";case _.TRACE:return"";default:return""}}log(e,t){if(t<=this.logLevel){const o=(new Date).toISOString(),i=`[${o}] [${_[t]}]`,r=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${r}${i} ${e}`);else{let t=D("anov-go-userInfo"),n=D("anov-go-proid"),a=` [操作人:${null==t?void 0:t.userName} 项目ID:${n}] `;const s={time:o,value:`${e}`};try{this.indexedDBInstance.addRecord(s)}catch(e){console.error("添加记录时出错:",e)}console.log(`${r}${i} ${a} ${e}`)}}}fatal(e){this.log(e,_.FATAL)}error(e){this.log(e,_.ERROR)}warn(e){this.log(e,_.WARN)}info(e){this.log(e,_.INFO)}debug(e){this.log(e,_.DEBUG)}trace(e){this.log(e,_.TRACE)}}const Q=K.getInstance(),Y=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):d(e,t),Z=d();let ee=d();function te(e,o="get",i={},r={},n){return a(this,void 0,void 0,(function*(){try{const s={method:J[o],url:e,headers:r,timeout:l};["post","put"].includes(o.toLowerCase())?s.data=t.cloneDeep(i):s.params=t.cloneDeep(i),n&&(s.headers.sponsor=n);return/.json$/.test(e)?function(e){return a(this,void 0,void 0,(function*(){try{return yield Z({method:"get",url:e})}catch(e){throw console.error("JSON 数据请求:",e),e}}))}(e):function(e){return a(this,void 0,void 0,(function*(){try{return{code:2e4,data:(yield Z(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(s)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function oe(e,t,o,i,r){return a(this,void 0,void 0,(function*(){try{const n=window.anUrl||"",a=n+(window.agentPath||"/ds/v1/api-proxy/v1/query"),s=y(o,!0);return yield Z({url:a,method:"post",headers:{"Content-Type":"application/json;charset=UTF-8",sponsor:r||""},data:{body:"post"===e?s:void 0,headers:b(i)?y(i,!0):i,method:e,url:t}})}catch(e){throw console.error("代理请求数据:Error12:",e),e}}))}function ie(e,t,o,i,r,n){return a(this,void 0,void 0,(function*(){return r?oe(t,e,o,i,n):te(e,t,o,i,n)}))}function re(e,t="",o){var i,r,n,a;const l=`${null!==(r=null===(i=null===window||void 0===window?void 0:window.BaseUrl)||void 0===i?void 0:i.replace("/management",""))&&void 0!==r?r:""}/ds/data-engine/v1/${e}/zb-query?${`token=${(null===(n=ge("YZH_EXCHANGE_TOKEN"))||void 0===n?void 0:n.YZH_EXCHANGE_TOKEN)||(null===(a=null===window||void 0===window?void 0:window.yzhAuth)||void 0===a?void 0:a.getToken())}&passid=${null===window||void 0===window?void 0:window.gdPassid}`}${(null===window||void 0===window?void 0:window.BASE_RELEASE)?"&preview=1":""}`;let d={};try{d=t?JSON.parse(t):{}}catch(e){d=t||{}}return Z({method:"POST",url:l,data:{headers:o,param:d},timeout:s})}function ne(e="",t,o){const i=`${null===window||void 0===window?void 0:window.BaseUrl}/ds/v1/data-views/query/v1/${o}`;let r={};try{r=e?JSON.parse(e):{}}catch(t){r=e||{}}return Z({method:"POST",url:i,data:{headers:t,param:r},timeout:s})}const ae=(e,t)=>a(void 0,void 0,void 0,(function*(){const o=window.BaseUrl,{dateType:i="",endPeriod:r="",metricsName:n=e,startPeriod:a=""}=t;return ee({method:"GET",url:`${o}ds/v1/metrics/v1/data-alarm?dateType=${i}&endPeriod=${r}&metricsName=${n}&startPeriod=${a}`,timeout:s})})),se=(e,t,o)=>a(void 0,void 0,void 0,(function*(){var i;const r=(null===(i=window.BaseUrl)||void 0===i?void 0:i.replace("/management",""))||"";t.newEncryption=!0;const n={staticFile:{method:"get",params:t,url:`${r}/ds/v1/file/v1/${e}/query`},datasource:{method:"post",url:`${r}/ds/v1/database/v1/${e}/query`,data:Object.assign({},t)}}[o];if(!n)throw new Error("Invalid data type provided");return Z(Object.assign({timeout:s},n))})),le=e=>new Promise(((t,o)=>{let i;i=e.originData&&Object.keys(e.originData).length?e.originData:e.data,void 0!==i?t({data:i}):o("Failed to retrieve cdata")})),de=(e,t,o)=>{try{let i;switch(t){case"api":{let t=be(e,o);return{requestType:t.requestType,url:t.url,params:t.params,headers:t.headers,agency:t.agency}}case"static":return{data:e};case"datasource":{const t=ye(e.inputSql,o);return{dsName:e.dsName,dsType:"1",sql:B(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return i=we(e,o),{zbId:e.zbId,params:ye(i.params,o),headers:ye(i.headers,o)};case"dataSet":return{params:ye(e.params,o),headers:ye(e.headers,o),value:e.value};case"indicatorCQ":return{zbName:e.zbName,params:ye(e.params,o)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},ce=(e,t,o)=>a(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield ie(e.url,e.requestType,e.params,e.headers,e.agency,o);case"static":return yield le(e.data);case"datasource":return yield se(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield se(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield re(e.zbId,e.params,e.headers);case"dataSet":return yield ne(e.params,e.headers,e.value);case"indicatorCQ":return yield ae(e.zbName,e.params);case"packData":return{};default:throw new Error("Invalid type")}}catch(e){return console.warn(e,"执行请求并获取数据发生错误"),yield new Promise(((e,t)=>{e({error:!0})}))}})),ue=(e,t,o,i=[],r=!1)=>a(void 0,void 0,void 0,(function*(){const n=t||e.tmpData.source.dataType;if(!n)return console.warn(`fetdata error on fetchDataByType', dataType is ${n}`),new Promise(((e,t)=>{e({error:!0,data:null,msg:`dataType is ${n}`})}));const a=e.tmpData.source["indicatorCQ"==n?"indicator":n];if("globalData"===n){const e=i.find((e=>e.key===a.id||e.key===a.key)),t=D(a.id);if(t&&!r)return t.data;if(e){let t=yield he(e,o),i={key:a.id,data:t};return w(a.id,i),t}return}const s=de(a,n,o),l=yield ce(s,n,e.cid?e.cid:"");return(null==l?void 0:l.data)?l.data:l})),he=(e,t)=>a(void 0,void 0,void 0,(function*(){let o=Object.assign({},{tmpData:{source:e.value}});const i=o.tmpData.source.type,r=o.tmpData.source[i],n=de(r,i,t),a=yield ce(n,i);return yield pe(a.data,o,!0,t)})),pe=(e,o,i=!0,r)=>a(void 0,void 0,void 0,(function*(){try{const{converse:n,mapFields:s}=o.tmpData.source;return n&&n.use&&i?yield new Promise(((o,i)=>a(void 0,void 0,void 0,(function*(){const i=yield function(e,o,i,r){return a(this,void 0,void 0,(function*(){let i,n=e,{use:a,data:s}=t.cloneDeep(o);if(a)for(let e=0;e<s.length;e++)if(s[e].use){let o=s[e].dependVars,a={};r&&a&&o&&o.length&&o.map((e=>{let o=t.cloneDeep(r).filter((t=>{let o=t.mapField==e;return o&&(a[e]=t.value),o}));o&&0!=o.length||(a[e]="")})),i=yield H(s[e].code,n,a,s[e].mode?s[e].mode:"worker"),n=i.data}return n}))}(t.cloneDeep(e),n,0,r);o(i)})))):yield new Promise(((t,o)=>{t(e)}))}catch(t){return console.error("执行过滤器发生错误:"+t),yield new Promise(((t,o)=>{t(e)}))}})),me=(e,t,o)=>{const{source:i}=e.tmpData,r=i.type;o?("static"===r&&i[r]&&(i[r].originData=o),"indicatorCQ"===r?i.indicator.data=t:i[r].data=t):"indicatorCQ"===r?i.indicator.data=t:i[r].data=t,e.source=t},fe=(e,t,o=[],i,r,n)=>a(void 0,void 0,void 0,(function*(){try{let a=e.tmpData.source.type,s=yield ue(e,a,o,i,n||!1);if(null==s||!s)return r&&r({error:!0}),Promise.resolve({error:!0});let l=yield pe(s,e,t,o);return yield me(e,l),r&&r(l),(null==e?void 0:e.cid)&&F(e.cid),Promise.resolve(l)}catch(t){return r&&r(t),Q.error("Error in updateComData"),console.error("Error in updateComData:",t,e),Promise.reject(t)}})),ge=e=>{const t={};if(e&&e.includes("?")){const o=e.split("?")[1].split("&");for(let e of o){const[o,i]=e.split("=").map(decodeURIComponent);t[o]=i}}return t},ve=e=>{try{return(null==e?void 0:e.value)&&"string"==typeof e.value?JSON.parse(e.value):"string"==typeof e?JSON.parse(e):e}catch(t){return e}},ye=(e,t)=>{if(!t)return ve(e);if("string"==typeof e){if(""===e.trim())return"";try{if("string"!=typeof JSON.parse(e))return"number"==typeof JSON.parse(e)?e:ye(JSON.parse(e),t);{let o=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,i)=>{const r=o||i,n=t.find((e=>e.mapField===r));return n?n.value||n.originalValue||"":e}));return ve(o)}}catch(o){let i=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,i)=>{const r=o||i,n=t.find((e=>e.mapField===r));return n?n.value:e}));return ve(i)}}else{if(Array.isArray(e))return e.map((e=>ye(e,t)));if("object"==typeof e&&null!==e){const o={};for(let i in e)o[i]=ye(e[i],t);return ve(o)}}return ve(e)},be=(e,t)=>{const o=e.agency,i=e,{url:r=null,headers:n,params:a,requestType:s}=i,l=r?ye(r,t):void 0,d=n&&n.use?ye(n.value,t):{};return{url:l,requestType:s,params:a?ye(a,t):{},headers:d,agency:o}},we=(e,t)=>{const{headers:o,params:i}=e,r=o&&o.use?ye(o.value,t):{};return{params:i?ye(i,t):{},headers:r}},De=(e,t,o,i,r)=>a(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const n of e){O(t,n.value,o)&&(yield fe({tmpData:{source:{type:"globalData",globalData:{id:n.key}}}},!0,o,e,(e=>{console.log("数据更新成功-变量改变全局数据跟新")}),!0),C(i,(t=>{var i,a,s;if("globalData"===(null===(a=null===(i=null==t?void 0:t.tmpData)||void 0===i?void 0:i.source)||void 0===a?void 0:a.type)){(null===(s=null==t?void 0:t.tmpData)||void 0===s?void 0:s.source.globalData).id===n.key&&fe(t,!0,o,e,(e=>{r(t,e)}),!1)}})))}})),Ne=(e,t,o,i,r)=>a(void 0,void 0,void 0,(function*(){e&&(yield fe({tmpData:{source:{type:"globalData",globalData:{id:e.key}}}},!0,t,o,(e=>{console.log("数据更新成功")}),!0),C(i,(i=>{var n,a,s;if("globalData"===(null===(a=null===(n=null==i?void 0:i.tmpData)||void 0===n?void 0:n.source)||void 0===a?void 0:a.type)){(null===(s=null==i?void 0:i.tmpData)||void 0===s?void 0:s.source.globalData).id===e.key&&fe(i,!0,t,o,(e=>{r(i,e)}),!1)}})))}));class ke{constructor(e,t){this.isUpdating=!1,this.des=e.des,this.field=e.field,this.id=e.id,this.key=e.key,this.mapping=e.mapping,this.mapField=e.mapField,this.type=e.type,this.originalValue=e.originalValue,this.model=(null==e?void 0:e.model)||0==(null==e?void 0:e.model)?null==e?void 0:e.model:1,this.converter=e.converter,this.converterCode=e.converterCode,this.fork=e.fork,this.delayUpdate=!!(null==e?void 0:e.delayUpdate),t&&(this.globalVariables=t),e.fork&&(this.model=5,this.forkValue=e.forkValue,this.originalValue=this.getForkedValue())}get value(){if(this.fork&&(this.originalValue=this.getForkedValue()),this.converter&&this.converterCode){let e=[];return E(this.converterCode,this.originalValue,e)}return this.originalValue}togglePropertyState(e){let t=Object.prototype.hasOwnProperty.call(this,e);this[e]=!t||!e}getForkedValue(){if(this.forkValue&&Array.isArray(this.forkValue))return this.forkValue.map((e=>{const t=this.globalVariables.get(e);return t?t.value:null}));if(this.forkValue){const e=this.globalVariables.get(this.forkValue);return e?e.value:null}return null}updateValue(e,t){var i;const r=Object.assign({},this,e);this.des=r.des,r.field&&(this.field=r.field),this.mapping=r.mapping,this.type=r.type,this.originalValue=r.originalValue,this.converter=r.converter,this.converterCode=r.converterCode,this.fork=r.fork,this.delayUpdate=null==r?void 0:r.delayUpdate,this.model=null==r?void 0:r.model,e.id&&(this.id?"string"==typeof this.id?e.id instanceof Array?this.id=o([this.id,...e.id]):this.id=[this.id,e.id]:this.id instanceof Array&&(e.id instanceof Array?this.id=o([...this.id,...e.id]):this.id=o([...this.id,e.id])):this.id=e.id),e.fork&&(this.model=5,this.forkValue=null!==(i=e.forkValue)&&void 0!==i?i:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}updateWidthOriginalValue(e,t){var o;this.originalValue=e,this.fork&&(this.forkValue=null!==(o=this.forkValue)&&void 0!==o?o:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}renew(e){e&&e(this)}static create(e,t){return new ke(e,t)}}class Ce{constructor(){this.variables=new Map,this.globalObservers=[],this.url=window.location.search,this.list=[]}clearVars(){this.list=[],this.variables.clear()}togglePropertyState(e,t,o){try{let i=this.getVariable(e);if(!i)throw new Error("没有找到相应的变量!");i.togglePropertyState(t),this.addToObjectArray(this.list,i),o&&o()}catch(e){console.error(e)}}static getInstance(){return Ce.instance||(Ce.instance=new Ce),Ce.instance}getFullUrl(){this.url=window.location.search}getAllUrlParams(){const e=new URLSearchParams(window.location.search),t={};for(const[o,i]of e.entries())t[o]=i;return t}delVariable(e,t){this.variables.delete(e),this.list=this.list.filter((t=>t.mapField!=e)),t&&t()}addUrlParamsToGlobalVars(){this.getFullUrl();let e=this.getAllUrlParams(),t=Object.keys(e),o=[];for(const i of t)o.push({mapField:i,originalValue:e[i],model:4});if(o.length)for(const e of o)this.addVariable(e)}addVariables(e,t){if(Array.isArray(e)?e.map(((e,t)=>{this.addVariable(e)})):this.addVariable(e),t&&"coms"==t)for(let t of this.variables.values())0==t.model&&(e.some((e=>e.mapField==t.mapField))||this.delVariable(t.mapField));this.addUrlParamsToGlobalVars()}addVariable(e,t){if(!e||!(null==e?void 0:e.mapField))return console.error("新增全局变量:"+e+"参数不合法!"),!1;if(this.isVariableNameExist(e.mapField)){let o=this.getVariable(e.mapField);return this.sameValue(o,e)?o:(this.editVariable(e,t),!1)}const o=ke.create(e,this.variables);return this.variables.set(o.mapField,o),this.addToObjectArray(this.list,o),t&&t(o),this.notifyGlobalObservers(o),o}toJSON(e){try{return!!e&&JSON.stringify(e)}catch(e){return!1}}sameValue(e,t){if(e.mapfield!==t.mapfield)return!1;for(const o in t)if(!(["mapfield","field","key","value","name","globalVariables"].includes(o)||o in e&&e[o]==t[o]))return!1;return!0}creatVarJson(e){const{des:t,field:o,id:i,key:r,mapping:n,mapField:a,type:s,value:l,originalValue:d,model:c,converter:u,converterCode:h,fork:p,forkValue:m,update:f,delayUpdate:g}=e,v={};return void 0!==t&&(v.des=t),void 0!==o&&(v.field=o),void 0!==i&&(v.id=i),void 0!==r&&(v.key=r),void 0!==n&&(v.mapping=n),void 0!==a&&(v.mapField=a),void 0!==s&&(v.type=s),void 0!==l&&(v.value=l),void 0!==d&&(v.originalValue=d),void 0!==c&&(v.model=c),void 0!==u&&(v.converter=u),void 0!==h&&(v.converterCode=h),void 0!==p&&(v.fork=p),void 0!==m&&(v.forkValue=m),void 0!==f&&(v.update=f),void 0!==g&&(v.delayUpdate=g),v}addToObjectArray(e,t){let o=!1;for(let i=0;i<e.length;i++)if(e[i].mapField==t.mapField){e[i]=this.creatVarJson(t),o=!0;break}o||e.push(t)}editVariable(e,t){const o=this.getVariable(e.mapField);if(o&&this.isVariableNameExist(e.mapField)){if(this.sameValue(o,e))return}const i=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),t&&t(e),e.isUpdating=!1}};o?o.updateValue(e,i):this.addVariable(e,i)}getForkList(e){let t=this.isMapFieldInForkValues(e);return t||[]}editVariableForValue(e,t,o){const i=this.getVariable(e),r=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),o&&o(e),e.isUpdating=!1}};i&&i.updateWidthOriginalValue(t,r)}isMapFieldInForkValues(e){return this.getAllVariables().filter((e=>e.fork&&e.forkValue)).filter((t=>t.forkValue==e||Array.from(t.forkValue).includes(e)))}isVariableNameExist(e){return this.variables.has(e)}checkExist(e,t){if("string"==typeof e&&this.isVariableNameExist(e)){let o=this.getVariable(e);return t==o.id&&!o.id.includes(t)&&[{key:e}]}if(Array.isArray(e)){const o=e.filter((e=>{let o=this.getVariable(e);return this.isVariableNameExist(e)&&t!=o.id&&!(o.id&&o.id.includes(t))})).map((e=>({key:e})));return!!o.length&&o}return!1}getVariable(e){return this.variables.get(e)}getVariableForId(e){var o;let i=[];for(const[,t]of this.variables)(t.id===e||(null===(o=t.id)||void 0===o?void 0:o.includes(e)))&&i.push(t);return t.uniq(i)}getAllVariables(e=!1){return this.addUrlParamsToGlobalVars(),e?(this.list=Array.from(this.variables.values()),this.list):[...this.list]}restoreVariables(e){e.forEach((e=>{this.addVariable(e)}))}registerGlobalObserver(e){this.globalObservers.push(e)}notifyGlobalObservers(e){this.globalObservers.forEach((t=>{t.update(e)}))}}Ce.instance=null;const Ae=Ce.getInstance(),Se=(e,t)=>Array.isArray(t)?t.some((t=>e&&(void 0!==e[t]||e.hasOwnProperty(t)))):"string"==typeof t&&(e&&(void 0!==e[t]||e.hasOwnProperty(t))),xe=(e,t,o,i)=>{const r=((e,t,o,i)=>{var r;let n;if(Se(e,null==t?void 0:t.field)||Se(e,null==t?void 0:t.forkValue))n=e[null==t?void 0:t.field]||0==e[null==t?void 0:t.field]?e[null==t?void 0:t.field]:"";else if(Se(e.data,null==t?void 0:t.field)||Se(e.data,null==t?void 0:t.forkValue))n=e.data[null==t?void 0:t.field]||0==e.data[null==t?void 0:t.field]?e.data[null==t?void 0:t.field]:"";else{const e=I(o,i),a=(null===(r=null==e?void 0:e.tmpData)||void 0===r?void 0:r.actions)||[];for(const e of a){const o=e.vars.find((e=>(null==e?void 0:e.mapField)===(null==t?void 0:t.mapField)));if(o){n=o.value;break}}}return n})(e,t,o,i);return void 0!==r?r:t.value},Oe=(e,t,o,i,r,n,a,s,l)=>{var d;switch(e.type){case"link":let c=ye(e.link,n);window.open(c,e.target);break;case"page":if(null===(d=null==e?void 0:e.params)||void 0===d?void 0:d.length)for(let t=0;t<e.params.length;t++){const o=e.params[t],i=n.find((e=>e.mapField==o.mapField));i&&(o.value=i.value)}l&&l(e);break;case"dynamic":((e,t,o,i,r)=>{const n=e.dynamic||[];for(const a of n){if(e.id!==t.cid)continue;const n=I(o,a.pid);n&&(n.activeDynamic=a.name,n.isShow=a.visible||!i||e.index===t.index-1,r({cid:n.cid,flag:a.visible}))}})(e,t,o,i,r);break;case"toggle":((e,t,o,i,r)=>{const n=e.children||[];for(const o of n){const n=o.visible&&(!i||e.index===t.index-1);r({cid:o.cid,flag:n})}})(e,t,0,i,r);break;case"update":((e,t,o,i,r)=>{const n=e.children||[];for(const e of n){const n=I(t,e.cid);n&&fe(n,!0,o,i,(e=>{r({cid:n.cid,data:e})}))}})(e,o,n,a,s)}},Ie=(e,o,i,r,n,a,s,l,d,c)=>{const{cid:u,actions:h,index:p}=n,{eventName:m,mode:f}=h,g=2===f;((e,o,i,r,n,a)=>{let s=Ae.getVariableForId(o.cid);if(null==s?void 0:s.length)for(const l of s)if(l.type==e){let e=xe(o,l,i,r);Ae.editVariableForValue(l.mapField,e,(()=>{let e=n[l.mapField]||[],o=Ae.getForkList(l.mapField);if(o)for(const i of o){let o=n[i.mapField];e=t.concat(e,o)}a&&a(l,t.uniq(e))}))}})(m,n,r,u,i,((e,t)=>{if(De(d,e.mapFile,Ae.getAllVariables(),r,((e,t)=>{s({cid:e.cid,data:t})})),null==t?void 0:t.length)for(const o of t){e.eventSourceId=o;const t=I(r,o);!(null==e?void 0:e.delayUpdate)&&t&&fe(t,!0,Ae.getAllVariables(),d,(e=>{s({cid:t.cid,data:e})}))}}));const v=((e,t,o,i,r)=>e.filter((e=>e.id===t&&e.eventType===o&&(!r||parseInt(e.index||"0")+1===parseInt(i||"0")))))(e,u,m,p,g);for(const e of v)Oe(e,n,r,g,a,Ae.getAllVariables(),d,s,l)};function Te(e,t){const o={};for(const i in e)if(e.hasOwnProperty(i))if("object"!=typeof e[i]||null===e[i]||Array.isArray(e[i]))Array.isArray(e[i])?JSON.stringify(e[i])!==JSON.stringify(t[i])&&(o[i]=t[i]):e[i]!==t[i]&&(o[i]=t[i]);else{const r=Te(e[i],t[i]);null!==r&&Object.keys(r).length>0&&(o[i]=r)}return Object.keys(o).length>0?o:null}function je(e,t){const o=Object.assign({},e);for(const e in t)t.hasOwnProperty(e)&&("object"!=typeof t[e]||null===t[e]||Array.isArray(t[e])?o[e]=t[e]:o[e]=je(o[e],t[e]));return o}const Ee=(e,t={})=>{let o={},i={type:"static",converse:{use:!1,data:[]},static:{data:e},api:{requestType:"get",url:"",headers:{use:!1,value:""},params:"",agency:!1,cookie:!0,autoUpdate:{open:!1,time:10},data:""}};return Object.assign(o,i,t),o},Ve=(e,o)=>{let{option:i,actions:r,data:n,optionDes:a,actionsDes:s,source:l,theme:d}=((e,o)=>{let{option:i,actions:r,data:n,optionDes:a,actionsDes:s,source:l,theme:d}=t.cloneDeep(o[e]);return{option:i,actions:r,data:n,optionDes:a,actionsDes:s,source:l,theme:d}})(e,o);return{iconClass:null,isAssembly:null,source:n,cid:(Math.random().toString().substr(3,10)+Date.now()).toString(),isLock:!1,isShow:!0,tmpData:{option:i,source:Ee(n,l),actions:r},baseData:Pe(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},Fe=(e,o,i)=>{let r=Ve(e,o);return i?t.merge(r,i):r},Pe=e=>{let t={left:0,top:0,width:100,height:100,angle:0,penetrate:0,opacity:100,perspective:100,rotateX:0,rotateY:0,rotateZ:0,transformOriginX:"center",transformOriginY:"center",transformSwitch:!1};return e?Object.assign(t,e):t};class $e{constructor(e,t,o){this.theme=null,this.plant=null,this.list=[],this.titleHeqadeHeight=70,this.clearance=3,this.checkComponentIntersection=(e,t,o=10)=>{const i=e.left,r=e.left+e.width,n=e.top,a=e.top+e.height,s=t.left,l=t.left+t.width,d=t.top,c=t.top+t.height,u=i<l&&r>s&&n<c&&a>d,h=Math.abs(e.left+e.width/2-(t.left+t.width/2)),p=Math.abs(e.top+e.height/2-(t.top+t.height/2));return u||h<o&&p<o},this.calculateCombinedComponent=e=>{if(0===e.length)return{left:0,top:0,width:0,height:0};let t=e[0].left,o=e[0].top,i=e[0].left+e[0].width,r=e[0].top+e[0].height;for(let n=1;n<e.length;n++){const a=e[n];t=Math.min(t,a.left),o=Math.min(o,a.top),i=Math.max(i,a.left+a.width),r=Math.max(r,a.top+a.height)}return{left:t,top:o,width:i-t,height:r-o}},this.getAnTextNormaltText=e=>{var t,o;try{return null===(o=null===(t=null==e?void 0:e.tmpData)||void 0===t?void 0:t.option)||void 0===o?void 0:o.text}catch(e){return console.error("配置优化(ConfigOptimizer):",e),""}},this.initProp(e),this.upgradePlant(),this.staticComponentData=t,this.upgradeHeaderComponent(),o&&Object.assign(this,o)}isStringOrObject(e){return"string"==typeof e?"string":"object"==typeof e&&null!==e&&"object"}initProp(e){try{let t,o=this.isStringOrObject(e);if(o&&"string"===o)t=JSON.parse(e);else{if(!o||"object"!==o)throw new Error(`initProp fn error :-- 传入参数${e}不合法!`);t=e}if(t){this.originData=t;const{theme:e,plant:o,list:i}=t;this.theme=e,this.plant=o,this.list=i,this.filterFileGroup()}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradePlant(){this.plant&&(this.plant.option.bg={type:1,code:"70942ec525344c96aa32b81b2c9155f6",path:"/anov-prod/resources/page/png/bg22 科技星球背景.png",thumb:"/anov-prod/resources/page/thumbnail/1e48f8fb26ec4edfb1a0f499627e84fc.png"})}areComponentsIntersecting(e,t){let o=e.baseData,i=t.baseData;const r=Math.max(0,Math.min(o.left+o.width,i.left+i.width)-Math.max(o.left,i.left)),n=Math.max(0,Math.min(o.top+o.height,i.top+i.height)-Math.max(o.top,i.top));return r>0&&n>0}filterFileGroup(){this.list=t.cloneDeep(this.list).map((e=>{var t,o;if(1===(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)&&!(null===(o=null==e?void 0:e.children[0])||void 0===o?void 0:o.children)){const t=e.children[0],{left:o,top:i}=e.baseData;return t.baseData.left=o,t.baseData.top=i,t}return e}))}getText(e,t,o){const i=document.createElement("canvas").getContext("2d");if(!i)throw new Error("Failed to get 2D context from canvas.");i.font=`${o}px ${t}`;return i.measureText(e).width}calculateMaxWidths(e){const t=Math.min(...e.map((e=>e.width))),o=[];let i=[],r=e[0].width;for(const n of e){const e=n.width;Math.abs(e-r)<=t?i.push(e):(i.length>0&&o.push(i),i=[e]),r=e}i.length>0&&o.push(i);const n=[];for(const e of o){const t=Math.max(...e);n.push(t)}return n}findClosestValue(e,t){let o=t[0],i=Math.abs(e-o);for(const r of t){const t=Math.abs(e-r);t<i&&(i=t,o=r)}return o}adjustHeightAndTop(e,t){const o=t-e.height;return Object.assign(Object.assign({},e),{height:t,top:e.top-o/2})}findNearestComponent(e,o,i){let r=null,n=1/0;o.tmpData.option.textNormal.text;try{const a=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===o.cid||"AnTextNormal"===e.viewComName||i&&i.includes(e.cid)))),s=t.cloneDeep(o).baseData;s.top,s.height;for(const e of a){const t=e.baseData;t.top,t.height;if(s.left<t.left+t.width&&s.left+s.width>t.left){const o=t.top-s.top;o<n&&o<100&&(n=o,r=e)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}findNearestComponentForPoint(e,t,o){let i=null,r=1/0;t.tmpData.option.textNormal.text;try{const n=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),a=t.baseData;a.top,a.height;for(const e of n){const t=e.baseData;let o=this.getDistance(a.left,a.top+a.height,t.left,t.top);o<r&&o<a.width&&(r=o,i=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return i}findNearestComponentForTitlePoint(e,t,o){let i=null,r=1/0;t.tmpData.option.textNormal.text;try{const n=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),a=t.baseData;a.top,a.height;for(const e of n){const t=e.baseData;let o=this.getDistance(a.left,a.top+a.height,t.left,t.top);o<r&&o<a.width&&t.top-a.top>100&&(r=o,i=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return i}findNearestTitleForPoint(e,t,o){let i=null,r=1/0;t.tmpData.option.textNormal.text;try{const n=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||o&&o.includes(e.cid)))),a=t.baseData;a.top,a.height;for(const e of n){const t=e.baseData;let o=t.top-a.top;o<r&&o<a.width&&t.top-a.top>100&&(r=o,i=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return i}getDistance(e,t,o,i){return Math.sqrt(Math.pow(o-e,2)+Math.pow(i-t,2))}findNearestComponent2(e,o,i){let r=null,n=1/0,a=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top));try{const e=a.filter((e=>!(e.cid===o.cid||"AnTextNormal"===e.viewComName||i&&i.includes(e.cid)))),s=t.cloneDeep(o).baseData,l=s.top+s.height;for(const t of e){const e=t.baseData,o=e.top+e.height;if(s.left<e.left+e.width&&s.left+s.width>e.left){const e=o-l;e>=0&&e<n&&(n=e,r=t)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}verticalDistance(e,t){e.left,e.width;const o=e.top+e.height,i=(t.left,t.width,t.top);return Math.abs(o-i)}extractAmount(e){const t=e.match(/(\d{1,3}(?:,\d{3})*)(\D+)/);if(t){const e=t[1].replace(/,/g,"");return[parseInt(e,10),t[2].trim()]}return[!1,!1]}getAnTextNormal(){return this.list.filter((e=>"AnTextNormal"==e.viewComName))}getAnDeckTitle3(){return this.list.filter((e=>"AnDeckTitle3"==e.viewComName)).sort(((e,t)=>e.baseData.left-t.baseData.left))}judgeAnOdometer(){let e=this.getAnTextNormal().sort(((e,t)=>e.baseData.left-t.baseData.left)),t=[],o=new Set;for(const i of e){if(o.has(i.cid))continue;let r=[];for(const t of e){if(!o.has(t.cid)&&i.cid!=t.cid){this.checkComponentIntersection(i.baseData,t.baseData)&&(o.add(t.cid),o.add(i.cid),r.push(t))}}t.push([i,...r])}let i=[];for(const e of t)for(const t of e){let o=this.getAnTextNormaltText(t);this.extractAmount(o).every((e=>e))&&i.push(e)}return i}createAnOdometer(){var e,o;let i=this.judgeAnOdometer();for(const r of i){let i,n,a,s=this.calculateCombinedComponent(r.map((e=>e.baseData)));for(const e of r){let o=this.getAnTextNormaltText(e),r=this.extractAmount(o);r.every((e=>!e))&&(i=o),r.every((e=>e))&&(n=r[0],a=r[1]),t.remove(this.list,(t=>t.cid==e.cid))}let l=Fe("AnIndicatorNormal",this.staticComponentData,t.cloneDeep({baseData:s}));(null===(o=null===(e=null==l?void 0:l.tmpData)||void 0===e?void 0:e.source)||void 0===o?void 0:o.static)&&(l.tmpData.source.static.data={text:i,num:n,unit:a},l.tmpData.source.static.originData={text:i,num:n,unit:a}),this.list.push(l)}}upgradeHeaderComponent(){for(let e=0;e<this.list.length;e++){const t=this.list[e];"AnDeckHeader3"==t.viewComName&&(t.baseData.left=0,t.baseData.top=0)}}upgradeTitleComponent(){let e=this.getAnDeckTitle3().map((e=>e.baseData)),t=this.calculateMaxWidths(e);for(let e=0;e<this.list.length;e++){const o=this.list[e];if("AnDeckTitle3"==o.viewComName){let e=this.findClosestValue(o.baseData.width,t);o.baseData.width=e>300?e:300,o.baseData=this.adjustHeightAndTop(o.baseData,this.titleHeqadeHeight)}}this.removeErroneousComponents()}containsFractionStructure(e){return/\b\d+\/\d+\b/.test(e)}removeErroneousComponents(){let e=this.getAnDeckTitle3(),t=[];for(let o=0;o<e.length;o++){const i=e[o];let r=i.tmpData.option.textNormal.text;if(this.containsFractionStructure(r))for(let o=0;o<e.length;o++){const r=e[o];if(i.cid!=r.cid){this.areComponentsIntersecting(i,r)&&t.push(i.cid)}}}this.list=this.list.filter((e=>!t.includes(e.cid)))}upgradeGroupComponent(){try{let e=this.getAnDeckTitle3(),t=this.list.filter((e=>"AnDeckTitle3"!=e.viewComName&&"AnDeckHeader3"!=e.viewComName&&"AnTextNormal"!=e.viewComName)),o=[],i=[];for(let r=0;r<e.length;r++){const n=e[r];let a=this.findNearestComponentForPoint(t,n,o);if(a&&a.cid&&o.push(a.cid),a){n.baseData.left=a.baseData.left;let t=this.upgradeComponentHeight(n,e,i);t&&t>=30&&(a.baseData=Object.assign({},a.baseData,{top:n.baseData.top+n.baseData.height+this.clearance}))}}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradeComponentHeight(e,o,i=[]){const r=e;let n=this.findNearestTitleForPoint(t.cloneDeep(o),r);return n?n.baseData.top-r.baseData.top-this.titleHeqadeHeight:1080-r.baseData.top-this.titleHeqadeHeight}getData(){return this.originData.list=this.list,this.originData.plant=this.plant,this.originData}}const Me=new class{randomNum(e,t){return Math.floor(Math.random()*(t-e+1))+e}generateRandomIntArray(e,t,o,i){const r=[];for(let i=0;i<e;i++){const e=this.randomNum(t,o);r.push(e)}return i&&"asc"===i?r.sort(((e,t)=>e-t)):i&&"desc"===i?r.sort(((e,t)=>t-e)):r}randomString(e,t){const o="abcdefghijklmnopqrstuvwxyz",i=this.randomNum(e,t);let r="";for(let e=0;e<i;e++){const e=Math.floor(26*Math.random());r+=o.charAt(e)}return r}generateRandomNameArray(e,t,o){const i=[];for(let r=0;r<e;r++){const e=this.randomString(t,o);i.push(e)}return i}pick(e,t){const o=void 0!==t?e.filter((e=>e!==t)):e;return o[Math.floor(Math.random()*o.length)]}},Re=()=>{const e=[],t=Me.pick([!0,!1]);let o=Me.randomNum(3,20);const i=Me.pick([null,null,null,{}]);let r=Me.pick(["asc","desc",void 0,void 0,void 0]);for(let n=0;n<Me.randomNum(1,9);n++)e.push({data:Me.generateRandomIntArray(o,0,300,r),type:"line",smooth:t,symbolSize:Me.randomNum(1,10),lineStyle:{width:Me.randomNum(1,4)},areaStyle:i});return{xAxis:{type:"category",show:!1,boundaryGap:!1,data:Me.generateRandomNameArray(o,3,6)},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},Be=(e,t)=>{let o={type:e,show:!1};return"category"===e&&(o.data=Me.generateRandomNameArray(t,3,6)),o},Ue=()=>{const e=[],t=Me.pick([!0,!1]);let o=Me.randomNum(3,20);const i=Me.pick([null,null,null,{}]);let r=Me.pick(["asc","desc",void 0,void 0,void 0]),n=Me.randomNum(1,9),a=Me.pick([!0,!1]);for(let s=0;s<n;s++){let n={data:Me.generateRandomIntArray(o,0,300,r),type:"bar",smooth:t,stack:a,areaStyle:i};e.push(n)}let s=Me.pick(["value","category"]),l=Me.pick(["value","category"],s);return{xAxis:Be(s,o),grid:{left:0,top:0,bottom:0,right:0},yAxis:Be(l,o),series:e}},qe=()=>{const e=[];let t=Me.randomNum(3,20);Me.pick([null,null,null,{}]);let o=Me.pick(["asc","desc",void 0,void 0,void 0]),i=Me.pick([1,2]),r=[Me.pick(["10%","20%","30%","40%","50%","60%","70%","80%"]),Me.pick(["90%","100%"])];return e.push({data:Me.generateRandomIntArray(t,3,20,o),type:"pie",radius:1==i?"100%":r,roseType:1==i?Me.pick(["area",null,null]):null,padAngle:1==i?0:Me.randomNum(1,5),startAngle:1==i?Me.pick([0,180]):0,endAngle:360,label:{show:!1},itemStyle:{borderRadius:3}}),{grid:{left:0,top:0,bottom:0,right:0},series:e}},Le=()=>{const e=[];Me.pick([!0,!1]),Me.randomNum(3,20),Me.pick([null,null,null,{}]),Me.pick(["asc","desc",void 0,void 0,void 0]);for(let t=0;t<Me.randomNum(1,20);t++){let t=Me.randomNum(3,Me.randomNum(3,20)),o=[];for(let e=0;e<t;e++){let e=[];for(let t=0;t<2;t++)e.push(Me.randomNum(1,30));o.push(e)}e.push({type:"scatter",symbolSize:Me.randomNum(3,30),data:o})}return{xAxis:{show:!1},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},He=()=>{const e=[],t=Me.pick(["polygon","circle"]);let o=Me.randomNum(1e4,99999),i=Me.randomNum(3,10),r=[];for(let e=0;e<i;e++)r.push({name:Me.randomString(4,8),max:o});for(let t=0;t<Me.randomNum(2,10);t++)e.push({value:Me.generateRandomIntArray(i,1e4,o),name:Me.randomString(4,8)});return{radar:{shape:t,indicator:r,axisName:{show:!1},radius:"100%"},grid:{left:0,top:0,bottom:0,right:0},series:[{type:"radar",symbol:"none",lineStyle:{width:1},data:e}]}},ze=()=>{const e=[];for(let t=0;t<Me.randomNum(4,15);t++)e.push({value:Me.randomNum(1,100),name:Me.randomString(4,8)});return{grid:{left:0,top:0,bottom:0,right:0},series:[{type:"funnel",left:"0%",top:0,bottom:0,width:"100%",min:0,minSize:"0%",maxSize:"100%",label:{show:!1,position:"inside"},sort:Me.pick(["descending","ascending"]),gap:2,lineStyle:{width:1},data:e}]}};let Ge=Me.randomNum(5,20);const Je={width:Ge};Me.pick([!0,!1])&&(Je.color=[[.3,"#67e0e3"],[.7,"#37a2da"],[1,"#fd666d"]]);class _e{constructor(){this.names=["line","bar","pie","scatter","radar","funnel","gauge"]}static getInstance(){return _e.instance||(_e.instance=new _e),_e.instance}createLine(){switch(Me.pick(this.names)){case"line":return{type:"line",typeNum:1,option:Re()};case"bar":return{type:"bar",typeNum:2,option:Ue()};case"pie":return{type:"pie",typeNum:3,option:qe()};case"scatter":return{type:"scatter",typeNum:4,option:Le()};case"radar":return{type:"radar",typeNum:5,option:He()};case"funnel":return{type:"funnel",typeNum:6,option:ze()};case"gauge":return{type:"gauge",typeNum:7,option:{grid:{left:0,top:0,bottom:0,right:0},series:[{type:"gauge",radius:"100%",detail:{formatter:"{value}"},progress:{show:Me.pick([!0,!1]),width:Ge},axisLine:{lineStyle:Je},data:[{value:Me.randomNum(1,100),name:"SCORE"}]}]}}}}}_e.instance=null;const We=_e.getInstance();const Xe=new class{constructor(){this.directions=["row","row"],this.direction="column",this.splitNumbers=24,this.margin=[0,0]}baseLayout(e){const t=(null==e?void 0:e.maRrows)?null==e?void 0:e.maRrows:this.splitNumbers,o=(null==e?void 0:e.colNum)?null==e?void 0:e.colNum:this.splitNumbers,i=e.wrapWidth/o,r=e.wrapHeight/t;let n=U(this.directions);n&&(this.direction=n);let a=[];if("row"===this.direction){let e=U([3,4]);a=this.simulateRandomSegments(24,4,12,e)}else{let e=U([2,3]);a=this.simulateRandomSegments(24,4,6,e)}let s=[],l=[];if("row"===this.direction){for(let e=0;e<a.length;e++)if(0==e)s.push({x:0,y:0,w:a[e],h:24,i:e,wStep:i,hStep:r});else{let t=s[e-1].x;s.push({x:a[e-1]+t,y:0,w:a[e],h:24,i:e,wStep:i,hStep:r})}let e=U([2,3]),t=this.simulateRandomSegments(24,6,12,e);for(let e=0;e<s.length;e++){const o=s[e];for(let n=0;n<t.length;n++){const a=t[n];l.push({x:o.x,y:a,w:o.w,h:a,i:10*e+n,wStep:i,hStep:r})}}}else{for(let e=0;e<a.length;e++)if(0==e)s.push({x:0,y:0,w:24,h:a[e],i:e,wStep:i,hStep:r});else{let t=s[e-1].y;s.push({x:0,y:a[e-1]+t,w:24,h:a[e],i:e,wStep:i,hStep:r})}for(let e=0;e<s.length;e++){const t=s[e];let o=U([1,2,3,4]),n=this.simulateRandomSegments(24,5,12,o),a=[];for(let o=0;o<n.length;o++){const s=n[o];if(0==o)a.push({x:0,y:t.y,w:s,h:t.h,i:10*e+o,wStep:i,hStep:r}),l.push({x:0,y:t.y,w:s,h:t.h,i:10*e+o,wStep:i,hStep:r});else{let d=a[o-1].x;a.push({x:n[o-1]+d,y:t.y,w:s,h:t.h,i:10*e+o,wStep:i,hStep:r}),l.push({x:n[o-1]+d,y:t.y,w:s,h:t.h,i:10*e+o,wStep:i,hStep:r})}}}}return{layouts:l.map((t=>{let{option:o,typeNum:i}=We.createLine(),r=t.x*t.wStep+t.w*t.wStep/2,n=t.y*t.hStep+t.h*t.hStep/2,a=t.w*t.wStep,s=t.h*t.hStep;if(3==i||5==i||7==i){let e=Math.min(a,s);a=e,s=e}let l=e.wrapWidth,d=e.wrapHeight;return t.chartsOption=o,t.typeNum=i,t.txt=i+" "+r/l+" "+n/d+" "+a/l+" "+s/d,console.log(t.txt),t})),option:{colNum:o,margin:(null==e?void 0:e.margin)?null==e?void 0:e.margin:this.margin,isDraggable:!!(null==e?void 0:e.isDraggable)&&(null==e?void 0:e.isDraggable),isResizable:!!(null==e?void 0:e.isResizable)&&(null==e?void 0:e.isResizable),verticalCompact:!(null==e?void 0:e.verticalCompact)||(null==e?void 0:e.verticalCompact),useCssTransforms:!(null==e?void 0:e.useCssTransforms)||(null==e?void 0:e.useCssTransforms),rowHeight:e.wrapHeight/t,maRrows:t}}}simulateRandomSegments(e,t,o,i){const r=[];let n=e,a=i;for(;a>0;)if(1===a)r.push(n),a--;else{const e=Math.min(o,n-t*(a-1)),i=Math.floor(Math.random()*(e-t+1))+t;r.push(i),n-=i,a--}return r}simulateRandomSegments2(e,t,o,i){const r=[];let n=e,a=i;for(;a>0;)if(1==a){const t=e-r.reduce(((e,t)=>e+t),0);r.push(t),a--}else{let e=Math.floor(Math.random()*o),i=Math.max(t,e),s=n-t*a;const l=Math.min(i,s);r.push(l),n-=l,a--}return r}},Ke=e=>{try{return JSON.parse(e)}catch(t){return e}};const Qe=new class{constructor(){this.requested=new Set,this.dbName="go-db",this.storeName="store",this.init()}init(){return a(this,void 0,void 0,(function*(){const e=indexedDB.open(this.dbName,10);e.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName,{keyPath:"key"})},e.onsuccess=()=>{},e.onerror=e=>{var t;console.error("数据库错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}pushCaseIdToRequested(e){this.requested.add(e)}add(e,t){return a(this,void 0,void 0,(function*(){if(!(yield this.isExist(e))){t.caseDetailData&&(t.caseDetailData="string"==typeof t.caseDetailData?Ke(t.caseDetailData):t.caseDetailData),this.pushCaseIdToRequested(e);const o=(yield this.getDB()).transaction(this.storeName,"readwrite");o.objectStore(this.storeName).add({key:e,value:t}),o.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}))}bulkPut(e){return a(this,void 0,void 0,(function*(){const t=(yield this.getDB()).transaction(this.storeName,"readwrite"),o=t.objectStore(this.storeName);for(const t of e){const{caseId:e,id:i}=t,r=`${e}_${i}`;(yield this.isExist(r))||(t.caseDetailData&&(t.caseDetailData=Ke(t.caseDetailData)),this.pushCaseIdToRequested(r),o.put({key:r,value:t}))}t.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}get(e){return a(this,void 0,void 0,(function*(){if(!(yield this.isExist(e)))return null;const t=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((o,i)=>{const r=t.get(e);r.onsuccess=e=>{o(e.target.result?e.target.result.value:null)},r.onerror=e=>{var t;i("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}getAllData(){return a(this,void 0,void 0,(function*(){const e=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((t,o)=>{const i=e.getAll();i.onsuccess=e=>{t(e.target.result)},i.onerror=e=>{var t;o("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}update(e,t){return a(this,void 0,void 0,(function*(){if(yield this.isExist(e)){const o=yield this.get(e),i=Ke(t),r=(yield this.getDB()).transaction(this.storeName,"readwrite");r.objectStore(this.storeName).put({key:e,value:Object.assign(Object.assign({},o),{caseDetailData:i})}),r.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}else console.error("更新 IndexedDB 错误")}))}delete(e){this.requested.delete(e);indexedDB.open(this.dbName).onsuccess=t=>{const o=t.target.result.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(e),o.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}isExist(e){return a(this,void 0,void 0,(function*(){const t=(yield this.getDB()).transaction(this.storeName,"readonly").objectStore(this.storeName);return new Promise(((o,i)=>{const r=t.count(e);r.onsuccess=e=>{o(e.target.result>0)},r.onerror=e=>{var t;i("请求错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}))}reset(){this.requested.clear();indexedDB.open(this.dbName).onsuccess=e=>{const t=e.target.result.transaction(this.storeName,"readwrite");t.objectStore(this.storeName).clear(),t.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}}clear(){return a(this,void 0,void 0,(function*(){const e=(yield this.getDB()).transaction(this.storeName,"readwrite");e.objectStore(this.storeName).clear(),e.onerror=e=>{var t;console.error("事务错误: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}}))}isExistStore(){return a(this,void 0,void 0,(function*(){const e=indexedDB.open(this.dbName);return new Promise((t=>{e.onsuccess=()=>{t(!0)},e.onerror=()=>{t(!1)}}))}))}getDB(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const o=indexedDB.open(this.dbName);o.onsuccess=t=>{e(t.target.result)},o.onerror=e=>{var o;t("数据库错误: "+(null===(o=e.target.error)||void 0===o?void 0:o.message))}}))}))}};function Ye(e){!function(e,t){e.depends?r(e):Ze(e,t)}(e,!1)}function Ze(e,t=!0){let{theme:o,option:i,optionDes:r}=e;i&&r&&o&&Object.keys(r).forEach((n=>{"conditionSeries"!==r[n].type&&"tabs"!==r[n].type||!i[n]?r[n].theme?i.hasOwnProperty(n)&&function({theme:e,option:t,optionDes:o},i,r){let n;if("color"!=o[i].type||!r&&t[i]){if("bgcolor"==o[i].type&&(r||!t[i]||!t[i].style)){t[i]||(t[i]={});let{key:r,points:a,degree:s,type:l,opacity:d}=o[i].theme;if(a){s||(s=90),l||(l="linear");let o=`${l}-gradient(${s}deg`,r=100/(a.length-1),c=[];a.forEach(((t,i)=>{n=et(e,t),o+=`,${tt(n,t.opacity)} ${r*i}%`;let{red:a,green:s,blue:l,alpha:u}=ot(n,d);c.push({red:a,green:s,blue:l,alpha:u,left:r*i})})),o+=")",t[i].style=o,t[i].degree=s,t[i].flag=a.length?3:2,t[i].points=c,t[i].type=l}else r&&(n=et(e,o[i].theme),t[i]=Object.assign(Object.assign({},ot(n,d)),{style:tt(n,d)}))}}else{let{opacity:r}=o[i].theme;n=et(e,o[i].theme),t[i]=tt(n,r)}}(e,n,t):r[n].hasOwnProperty("type")&&"slot"!=r[n].type&&"textStyle"!=r[n].type&&"sheet"!=r[n].type||r[n].constructor!=Object||Ze({option:i[n],optionDes:r[n],theme:o},t):function(e,t,o,i,r,n){let a=t.form,s=e;if(Array.isArray(a))for(let e=0;e<a.length;e++){let t,o=a[e];t=n?s[e].form:s[e],Ze({option:t,optionDes:o,theme:i},r)}else{let e=s.length;for(let t=0;t<e;t++){let e;e=n?s[t].form:s[t],Ze({option:e,optionDes:a,theme:i},r)}}}(i[n],r[n],0,o,t,"conditionSeries"===r[n].type)}))}function et(e,t){if(e[t.key])return e[t.key]||e.color;if(t.key.indexOf(".")>-1){return[e,...t.key.split(".")].reduce(((t,o)=>"object"==typeof t&&o in t?t[o]:(it(`属性${o}不存在,获取主题颜色错误,将使用默认主题色`),e.color)))}return it(`属性${t.key}不存在,获取主题颜色错误,将使用默认主题色`),e.color}function tt(e,t){let{red:o,green:i,blue:r,alpha:n}=ot(e,t);return`rgba(${o},${i},${r},${n})`}function ot(e,t){return-1!=e.indexOf("#")&&(e=e.substr(1)),null==t&&(t=1),{red:parseInt("0x"+e.slice(0,2)),green:parseInt("0x"+e.slice(2,4)),blue:parseInt("0x"+e.slice(4,6)),alpha:t}}function it(e){console.warn(e)}class rt{constructor(e){this.processedIds=new Set,this.validateAccessResolve=null,e?(e.caseId&&(this.caseId=e.caseId),e.pageId&&(this.pageId=e.pageId),e.mode&&(this.mode=e.mode),e.environment&&(this.environment=e.environment),e.xhr&&(this.xhr=e.xhr),e.staticComponentData&&(this.staticComponentData=e.staticComponentData),e.theme&&(this.theme=e.theme),e.fetchMode&&(this.fetchMode=e.fetchMode)):console.log("初始化错误!"),this.defaultTheme={name:"科技蓝",color:"#006aee",background:"#00000033",pageBackground:"#051836",text:"#F0F0F0",groups:["#006aee","#00eae9","#00a9ec","#00ec80","#edc700","#9913ee"]}}checkHardware(){return a(this,void 0,void 0,(function*(){return yield new Promise(((e,t)=>{e("Hardware is not available")}))}))}checkSecurity(e){return a(this,void 0,void 0,(function*(){return yield new Promise(((t,o)=>{"preview"==this.environment?t(0):this.getShareForRelease(e).then((e=>{2e4==e.code&&e.data?(e.data,e.data.loginLimitSwitch?t(1):e.data.hasAuth?t(2):t(3)):t(4)}))}))}))}validateAccess(e,t){return a(this,void 0,void 0,(function*(){return new Promise(((o,i)=>{this.validateAccessResolve=o,t&&t(e)}))}))}initBefore(){return new Promise(((e,t)=>{let o=v("secretFree");o?sessionStorage.setItem("secret-free",o):sessionStorage.setItem("secret-free",null),console.log("运行免登录设置完成!"),e(!0)}))}fetchCaseId(e,t){return a(this,void 0,void 0,(function*(){try{const o=yield this.getKey(e,t);return 2e4===(null==o?void 0:o.code)&&(null==o?void 0:o.data)?o.data:e}catch(t){return console.error("Error fetching caseId:",t),e}}))}getDataForrelease(){return new Promise(((e,t)=>{e("data")}))}onProjectLoaded(e){}authenticate(){return a(this,void 0,void 0,(function*(){this.environment}))}getShareForRelease(e){return this.xhr.get(`/go/v1/go-share/v1/${e}/config`)}findById(e,t="",o=0,i=""){return"release"===this.environment?this.xhr.get(`/go/v1/go-share/v1/${e}?pwd=${t}&mode=${o}&token=${i}`):this.xhr.get(`/go/v1/go-cases/v1/${e}?mode=${o}&token=${i}`)}getKey(e,t=0){return this.xhr.get(`/go/v1/go-cases/v1/key/${e}?caseMode=${t}`)}getPageData(e,t){return a(this,void 0,void 0,(function*(){if("local"==this.fetchMode){const o=yield Qe.get(e+"_"+t);if(o)return{data:o}}return"release"===this.environment?this.xhr.get(`/go/v1/go-share/v1/${e}/pages/${t}`):this.xhr.get(`/go/v1/go-cases/v1/${e}/pages/${t}`)}))}getPageId(e,t){if(null==t?void 0:t.length){if(t.find((t=>t.id==e)))return e;let o=t.find((t=>t.caseDetailPath==e||t.caseDetailName==e));return o?o.id:e}return e}fetchProjectForId(e,t="",o=0,i=""){return a(this,void 0,void 0,(function*(){return yield this.findById(e,t,o,i)}))}updataPageData(e,t){var o;return a(this,void 0,void 0,(function*(){const i=this.getPageId(t,this.projectInfo.details);let r=yield this.getPageDataForID(e,i);if(null==r?void 0:r.data){let e=yield this.pageInit(r.data);null===(o=null==this?void 0:this.lifecycleHooks)||void 0===o||o.onPageDataReady(e)}else console.error("请求数据发生错误!")}))}getPageDataForID(e,t,o){return a(this,void 0,void 0,(function*(){const i=this.getPageId(t,this.projectInfo.details);if(this.processedIds.has(i)&&"local"==this.fetchMode){console.log(`ID ${i} has already been processed.`);const t=yield Qe.get(e+"_"+i);if(t)return{data:t}}const r=this.getPageData(e,i);this.processedIds.add(i),o&&o.length&&o.map((t=>a(this,void 0,void 0,(function*(){try{if(this.processedIds.has(t))return void console.log(`ID ${i} has already been processed.`);const o=yield this.getPageData(e,t);Qe.add(e+"_"+t,o.data),this.processedIds.add(t)}catch(e){console.error(`Error processing ID ${t}: ${e}`)}}))));const n=yield r;return Qe.add(e+"_"+i,n.data),n}))}fetchPageDataForId(e,t="",o=0,i=""){return a(this,void 0,void 0,(function*(){return yield this.findById(e,t,o,i)}))}setTheme(){console.log("设置主题")}setBackground(){console.log("设置背景信息")}updateVariables(){console.log("更新变量信息")}beforeRender(e){}renderComponents(){return a(this,void 0,void 0,(function*(){}))}setGlobalThemeVars(e){document.body.style.cssText=`\n --theme-background: ${e.background};\n --theme-color: ${e.color};\n --theme-pageBackground: ${e.pageBackground};\n --theme-text: ${e.text};\n ${e.groups.map(((e,t)=>`--theme-groups-${t}: ${e};`)).join("\n")}\n `}listenForRenderCompletion(){}showAnimation(){console.log("所有组件渲染完成,显示动画。")}setComTheme(e,t){var o,i;let r=null===(o=this.staticComponentData[t.viewComName])||void 0===o?void 0:o.optionDes,n=null===(i=this.staticComponentData[t.viewComName])||void 0===i?void 0:i.theme;return Ye({theme:e,option:t.tmpData.option,optionDes:r,depends:n}),t}getComData(e,t,o,i){return a(this,void 0,void 0,(function*(){return new Promise(((i,r)=>{if(e.tmpData&&e.tmpData.source)try{fe(e,!0,t,o,(t=>{e.source=t,i(1)}))}catch(e){i(e)}else i("")}))}))}processingData(e){return a(this,void 0,void 0,(function*(){try{let t=this.defaultTheme;return(null==e?void 0:e.theme)&&(t=e.theme),e}catch(t){return console.warn("页面初始化发生错误:",t),e}}))}pageInit(e){var o;return a(this,void 0,void 0,(function*(){try{let i=null==e?void 0:e.caseDetailData,r=this.defaultTheme;if((null==i?void 0:i.theme)&&(r=i.theme),this.setGlobalThemeVars(r),i.resource){let e=(null===(o=null===window||void 0===window?void 0:window.anovuiConfig)||void 0===o?void 0:o.fonts)||[],r=t.concat(i.resource.fonts,e),n=t.cloneDeep(i.resource);n.fonts=r,yield m(n)}Ae.clearVars(),Ae.addVariables(i.globalVars);Ae.getAllVariables();return i}catch(t){return console.warn("页面初始化发生错误:",t),(null==e?void 0:e.data)?e.data:e}}))}validate(e,t,o){return a(this,void 0,void 0,(function*(){return new Promise(((i,r)=>{const n=(e,o)=>a(this,void 0,void 0,(function*(){let r=yield this.validateAccess(e,o),a=(null==r?void 0:r.pwd)?r.pwd:"",s=(null==r?void 0:r.mode)?r.mode:0,l=(null==r?void 0:r.token)?r.token:"",d=yield this.fetchProjectForId(t,a,s,l);2e4==(null==d?void 0:d.code)&&(null==d?void 0:d.data)?(this.projectInfo=d.data,console.log("验证成功!"),this.lifecycleHooks.message("验证成功!"),i(!0)):(this.lifecycleHooks.validateError(d),this.lifecycleHooks.message(d.msg,"warning"),n(e,o))}));n(e,o)}))}))}init(e){var t;return a(this,void 0,void 0,(function*(){try{this.lifecycleHooks=e,yield this.checkHardware();let o=yield this.fetchCaseId(this.caseId,this.mode),i=yield this.checkSecurity(o),r=e.onValidateAccess||(()=>{});(yield this.validate(i,o,r))&&e.onCaseReady(this.projectInfo);let n=(null===(t=this.projectInfo)||void 0===t?void 0:t.details).map((e=>e.id)),a=this.getPageId(this.pageId,this.projectInfo.details),s=yield this.getPageDataForID(o,a||n[0],n);const l=yield this.pageInit(s.data);return e.onPageDataReady(l),{currentData:this.projectInfo,currentPageData:l}}catch(e){console.error("加载页面时出错:",e)}}))}}class nt{constructor(){this.animations=[],this.globalConfig={duration:3,direction:"topLeft",type:1},this.timeline=n.timeline({paused:!0}),this.presetAnimations={1:{type:"fade",from:{opacity:0},to:{opacity:1,duration:1}},2:{type:"scale",from:{opacity:0,scale:0},to:{opacity:1,scale:1,duration:1}},3:{type:"x",from:{x:-100,opacity:0},to:{x:0,opacity:1,duration:1}},4:{type:"y",from:{y:-100,opacity:0},to:{y:0,opacity:1,duration:1}},fade:{type:"fade",from:{opacity:0},to:{opacity:1,duration:1}},scale:{type:"scale",from:{opacity:0,scale:0},to:{opacity:1,scale:1,duration:1}},x:{type:"x",from:{x:-100,opacity:0},to:{x:0,opacity:1,duration:1}},y:{type:"y",from:{y:-100,opacity:0},to:{y:0,opacity:1,duration:1}}}}setGlobalConfig(e){this.globalConfig=Object.assign(Object.assign({},this.globalConfig),e)}getElement(e){if("string"==typeof e){if(e.startsWith("#"))return document.getElementById(e.substring(1));if(e.startsWith(".")){const t=document.querySelectorAll(e);return t.length>0?t[0]:null}}else if(e instanceof HTMLElement)return e;return null}createAnimation(e,t){const{from:o,to:i,duration:r=1,delay:a=0,onStart:s,onComplete:l}=t;return n.fromTo(e,o||{},Object.assign(Object.assign({},i),{duration:r,delay:a,onStart:()=>{s&&s()},onComplete:()=>{l&&l()}}))}registerAnimation(e,t=1){const o=this.getElement(e);if(!o)return console.warn(`Component not found: ${e}`),null;const i=`anim_${Math.random().toString(36).substr(2,9)}`;let r;r="number"==typeof t||"string"==typeof t?Object.assign({},this.presetAnimations[t]):Object.assign({},t),r=Object.assign(Object.assign({},this.globalConfig),r);const n=this.createAnimation(o,r);return n&&this.timeline.add(n,"<25%"),this.animations.push({id:i,component:o,config:r,timeline:this.timeline}),i}playAllAnimations(e){const t=this.globalConfig.duration||3,o=this.animations.length;if(0===o)return;let i=(null==e?void 0:e.direction)?e.direction:this.globalConfig.direction,r=(null==e?void 0:e.type)?e.type:this.globalConfig.type;var n,a;n=this.animations,a=i,console.log(a,"positionposition1"),n.sort(((e,t)=>{const o=e.component.getBoundingClientRect(),i=t.component.getBoundingClientRect(),r=o.left+o.width,n=i.left+i.width,s=o.top+o.height,l=i.top+i.height,d=Math.sqrt(Math.pow(o.left,2)+Math.pow(o.top,2)),c=Math.sqrt(Math.pow(i.left,2)+Math.pow(i.top,2)),u=Math.sqrt(Math.pow(window.innerWidth-r,2)+Math.pow(o.top,2)),h=Math.sqrt(Math.pow(window.innerWidth-n,2)+Math.pow(i.top,2));switch(a){case"top":return o.top-i.top;case"left":return o.left-i.left;case"right":return n-r;case"bottom":return l-s;case"topLeft":return d-c;case"topRight":return u-h;default:return 0}}));const s=t/o;this.timeline.clear(),this.animations.forEach(((e,t)=>{const{component:o,config:i}=e,n=s,a=Object.assign(Object.assign({},i),{duration:n});let l=Object.assign({},a,this.presetAnimations[r]);const d=this.createAnimation(o,l);d&&this.timeline.add(d,"<20%")})),console.log("Playing all animations..."),this.timeline.play()}playExitAnimations(e={}){this.globalConfig.duration;const t=e.speed||2,o=(null==e?void 0:e.onComplete)||(()=>{console.log("onReverseComplete")});this.timeline.timeScale(t),this.timeline.reverse(),this.timeline.eventCallback("onReverseComplete",(()=>{o(),this.destroyAll()}))}stopAllAnimations(){console.log("Stopping all animations..."),this.timeline.pause()}destroyAll(){console.log("Destroying all animations..."),this.timeline.clear(),this.animations=[]}}export{nt as AnimationController,$e as ConfigOptimizer,Ce as GlobalVariables,Y as Http,Q as Log,rt as PageLoader,g as addPreloadLink,oe as agentData,je as applyDiff,A as asyncRecursion,F as delFetchStatus,Te as diffObjects,Xe as displayGenerator,me as editItem,Ie as emitEvent,he as fetchDataByGlobal,ue as fetchDataByType,pe as filterData,I as findItemDeep,T as findItemDeep2,te as getData,ie as getDataForApi,ne as getDataForDataSet,se as getDataForSource,le as getDataForStatic,re as getDataForZb,ae as getDataForZbCQ,$ as getResourceForComponent,D as getSessionData,y as getStandardData,S as getStringVars,v as getUrlParams,xe as getVarDefaultVal,Ae as globalVars,O as hasVar,b as isJSON,p as loadFont,c as loadFontResource,u as loadScript,m as loadTag,C as recursion,f as removeTag,ye as replaceVariable,j as safeEval,E as safeEvalForCode,V as setFetchStatus,w as setSessionData,De as updataGlobalDataSourceForVar,fe as updateComData,Ne as updateGlobalDataSource};
@@ -0,0 +1,33 @@
1
+ type DomPosition = "top" | "left" | "right" | "bottom" | "topLeft" | "topRight";
2
+ interface AnimationConfig {
3
+ duration?: number;
4
+ delay?: number;
5
+ from?: gsap.TweenVars;
6
+ to?: gsap.TweenVars;
7
+ onStart?: () => void;
8
+ onComplete?: () => void;
9
+ type?: string | number;
10
+ name?: string;
11
+ direction?: DomPosition;
12
+ }
13
+ declare class AnimationController {
14
+ private animations;
15
+ private globalConfig;
16
+ private timeline;
17
+ private presetAnimations;
18
+ setGlobalConfig(config: AnimationConfig): void;
19
+ private getElement;
20
+ private createAnimation;
21
+ registerAnimation(target: string | HTMLElement, presetOrConfig?: number | string | AnimationConfig): string | null;
22
+ playAllAnimations(option?: {
23
+ type: any;
24
+ direction: DomPosition;
25
+ }): void;
26
+ playExitAnimations(options?: {
27
+ speed?: number;
28
+ onComplete?: () => void;
29
+ }): void;
30
+ stopAllAnimations(): void;
31
+ destroyAll(): void;
32
+ }
33
+ export { AnimationController };
@@ -23,6 +23,7 @@ interface Options {
23
23
  staticComponentData: any;
24
24
  theme?: Theme;
25
25
  pageId?: string;
26
+ fetchMode?: string;
26
27
  }
27
28
  /**
28
29
  *
@@ -35,6 +36,7 @@ export declare class PageLoader {
35
36
  caseId?: string;
36
37
  pageId?: string;
37
38
  mode?: string | number;
39
+ fetchMode?: string;
38
40
  environment?: "preview" | "release";
39
41
  xhr?: any;
40
42
  staticComponentData?: any;
@@ -49,7 +49,7 @@ export declare function getDataForZb(id: any, params: any, headers: any): Promis
49
49
  * @param {any[]} headers 请求头参数
50
50
  * @returns {Promise<any>} 包装了 Axios 请求结果的 Promise 对象
51
51
  */
52
- export declare function getDataForDataSet(params: any, headers: any): Promise<any>;
52
+ export declare function getDataForDataSet(params: any, headers: any, key: string): Promise<any>;
53
53
  /**
54
54
  * 获取 ZB CQ 数据
55
55
  * @param {String} zbName 指标名称
@@ -7,3 +7,4 @@ export * from "./globalVars";
7
7
  export * from "./ConfigOptimizer";
8
8
  export * from "./DisplayGenerator/index";
9
9
  export * from "./PageLoader/index";
10
+ export * from "./Animation/index";
@@ -38,6 +38,7 @@ export declare const getSessionData: (key: string) => any;
38
38
  * @param callback - 回调函数
39
39
  */
40
40
  export declare const recursion: (array: GoComponent[], callback: (args: any) => void) => void;
41
+ export declare const asyncRecursion: (array: GoComponent[], callback: (args: any) => Promise<void>) => Promise<void>;
41
42
  /**
42
43
  * 处理字符串中的变量
43
44
  * @param url - 包含变量的字符串
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdslib/go-utils",
3
- "version": "0.3.93",
3
+ "version": "0.3.95",
4
4
  "description": "go-core utils",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/types/index.d.ts",
@@ -49,6 +49,7 @@
49
49
  "crypto-js": "^4.1.1",
50
50
  "deep-diff": "^1.0.2",
51
51
  "dexie": "^4.0.4",
52
+ "gsap": "^3.11.3",
52
53
  "lodash": "^4.17.21",
53
54
  "rollup-plugin-typescript": "^1.0.1",
54
55
  "ts-indexdb": "^0.0.8",